Drop config.revocationsExpire, always honour revocation expiration instead (#1736)

Unclear motivation for adding the original config option; if an expiration is there, it should
be honoured.

Breaking change:
the option used to default to `false`, and ignore revocation expirations. We now honour
those expirations, namely match the behaviour resulting from setting the option to `true`.
This commit is contained in:
larabr 2024-03-28 14:24:23 +01:00 committed by GitHub
parent 6ebd179ed5
commit aa222fecb2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 3 additions and 8 deletions

1
openpgp.d.ts vendored
View File

@ -328,7 +328,6 @@ interface Config {
allowUnauthenticatedStream: boolean; allowUnauthenticatedStream: boolean;
minRSABits: number; minRSABits: number;
passwordCollisionCheck: boolean; passwordCollisionCheck: boolean;
revocationsExpire: boolean;
ignoreUnsupportedPackets: boolean; ignoreUnsupportedPackets: boolean;
ignoreMalformedPackets: boolean; ignoreMalformedPackets: boolean;
versionString: string; versionString: string;

View File

@ -155,11 +155,6 @@ export default {
* @property {Boolean} passwordCollisionCheck * @property {Boolean} passwordCollisionCheck
*/ */
passwordCollisionCheck: false, passwordCollisionCheck: false,
/**
* @memberof module:config
* @property {Boolean} revocationsExpire If true, expired revocation signatures are ignored
*/
revocationsExpire: false,
/** /**
* Allow decryption using RSA keys without `encrypt` flag. * Allow decryption using RSA keys without `encrypt` flag.
* This setting is potentially insecure, but it is needed to get around an old openpgpjs bug * This setting is potentially insecure, but it is needed to get around an old openpgpjs bug

View File

@ -282,7 +282,7 @@ export async function isDataRevoked(primaryKey, signatureType, dataToVerify, rev
!signature || revocationSignature.issuerKeyID.equals(signature.issuerKeyID) !signature || revocationSignature.issuerKeyID.equals(signature.issuerKeyID)
) { ) {
await revocationSignature.verify( await revocationSignature.verify(
key, signatureType, dataToVerify, config.revocationsExpire ? date : null, false, config key, signatureType, dataToVerify, date, false, config
); );
// TODO get an identifier of the revoked object instead // TODO get an identifier of the revoked object instead

View File

@ -4275,7 +4275,8 @@ VYGdb3eNlV8CfoEC
const key = await openpgp.readKey({ armoredKey: pub_revoked_subkeys }); const key = await openpgp.readKey({ armoredKey: pub_revoked_subkeys });
key.revocationSignatures = []; key.revocationSignatures = [];
key.users[0].revocationSignatures = []; key.users[0].revocationSignatures = [];
return openpgp.encrypt({ encryptionKeys: [key], message: await openpgp.createMessage({ text: 'random data' }), date: new Date(1386842743000) }).then(() => { const subkeyRevocationTime = key.subkeys[0].revocationSignatures[0].created;
return openpgp.encrypt({ encryptionKeys: [key], message: await openpgp.createMessage({ text: 'random data' }), date: subkeyRevocationTime }).then(() => {
throw new Error('encryptSessionKey should not encrypt with revoked public key'); throw new Error('encryptSessionKey should not encrypt with revoked public key');
}).catch(error => { }).catch(error => {
expect(error.message).to.equal('Error encrypting message: Could not find valid encryption key packet in key ' + key.getKeyID().toHex() + ': Subkey is revoked'); expect(error.message).to.equal('Error encrypting message: Could not find valid encryption key packet in key ' + key.getKeyID().toHex() + ': Subkey is revoked');