You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix bug to support rotated keys in signature/attestation audit
*Context*
`npm audit signatures` performs the registry signature and sigstore
attestation bundle verification in `pacote`.
The current code checks if the public key from the tuf trust root keys
target has expires set to in the past:
https://github.com/npm/pacote/blob/main/lib/registry.js#L174-L175
If we decide to rotate signing keys and add expires to a old public key,
verification will always fail saying the key for old packages has
expired.
This means we can't rotate signing keys for npm at the moment!
*Solution*
Check public key expiry against either `integratedTime` for attestations
or the publish time for registry signatures.
This allows us to rotate a key, setting expiry to after all packages
that where signed with that key where published.
Complication: some really old npm packages don't have `time` set so we
need some kind of cutoff date for these packages.
Having time in the packument also requires the npm/cli to fetch the full
manifest, not the minified packument that does not contain time.
This will restrict usage in the install loop.
Signed-off-by: Philip Harrison <[email protected]>
pemkey: '-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE1Olb3zMAFFxXKHiIkQO5cJ3Yhl5i6UPp+IhuteBJbuHcA5UogKo0EWtlWwW6KSaKoTNEYL7JlCQiVnkhBktUgg==\n-----END PUBLIC KEY-----',
227
+
},{
228
+
expires: null,
229
+
keyid: 'SHA256:123',
230
+
keytype: 'ecdsa-sha2-nistp256',
231
+
scheme: 'ecdsa-sha2-nistp256',
232
+
// eslint-disable-next-line max-len
233
+
key: '123',
234
+
// eslint-disable-next-line max-len
235
+
pemkey: '-----BEGIN PUBLIC KEY-----\n123\n-----END PUBLIC KEY-----',
pemkey: '-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE1Olb3zMAFFxXKHiIkQO5cJ3Yhl5i6UPp+IhuteBJbuHcA5UogKo0EWtlWwW6KSaKoTNEYL7JlCQiVnkhBktUgg==\n-----END PUBLIC KEY-----',
902
+
}],
903
+
})
904
+
905
+
constmani=awaitf.manifest()
906
+
t.ok(mani._attestations)
907
+
t.ok(mani._integrity)
908
+
})
909
+
840
910
t.test('verifyAttestations no registry keys at all',asynct=>{
0 commit comments