Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: bump sigstore from 2.0.0 to 2.2.0 #343

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ class RegistryFetcher extends Fetcher {
// specify a public key from the keys endpoint: `registry-host.tld/-/npm/v1/keys`
const options = {
tufCachePath: this.tufCache,
tufForceCache: true,
keySelector: publicKey ? () => publicKey.pemkey : undefined,
}
await sigstore.verify(bundle, options)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"promise-retry": "^2.0.1",
"read-package-json": "^7.0.0",
"read-package-json-fast": "^3.0.0",
"sigstore": "^2.0.0",
"sigstore": "^2.2.0",
"ssri": "^10.0.0",
"tar": "^6.1.11"
},
Expand Down
60 changes: 0 additions & 60 deletions test/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,66 +552,6 @@ t.test('verifyAttestations invalid signature', async t => {
)
})

t.test('verifyAttestations errors when tuf update fails', async t => {
tnock(t, 'https://registry.npmjs.org')
.get('/sigstore')
.reply(200, {
_id: 'sigstore',
_rev: 'deadbeef',
name: 'sigstore',
'dist-tags': { latest: '0.4.0' },
versions: {
'0.4.0': {
name: 'sigstore',
version: '0.4.0',
dist: {
// eslint-disable-next-line max-len
integrity: 'sha512-KCwMX6k20mQyFkNYG2XT3lwK9u1P36wS9YURFd85zCXPrwrSLZCEh7/vMBFNYcJXRiBtGDS+T4/RZZF493zABA==',
// eslint-disable-next-line max-len
attestations: { url: 'https://registry.npmjs.org/-/npm/v1/attestations/sigstore@0.4.0', provenance: { predicateType: 'https://slsa.dev/provenance/v0.2' } },
},
},
},
})

const fixture = fs.readFileSync(
path.join(__dirname, 'fixtures', 'sigstore/valid-attestations.json'),
'utf8'
)

tnock(t, 'https://tuf-repo-cdn.sigstore.dev')
.get(/./) // match any path
.reply(404)

tnock(t, 'https://registry.npmjs.org')
.get('/-/npm/v1/attestations/sigstore@0.4.0')
.reply(200, JSON.parse(fixture))

const f = new RegistryFetcher('sigstore@0.4.0', {
registry: 'https://registry.npmjs.org',
cache,
verifyAttestations: true,
[`//registry.npmjs.org/:_keys`]: [{
expires: null,
keyid: 'SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA',
keytype: 'ecdsa-sha2-nistp256',
scheme: 'ecdsa-sha2-nistp256',
// eslint-disable-next-line max-len
key: 'MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE1Olb3zMAFFxXKHiIkQO5cJ3Yhl5i6UPp+IhuteBJbuHcA5UogKo0EWtlWwW6KSaKoTNEYL7JlCQiVnkhBktUgg==',
// eslint-disable-next-line max-len
pemkey: '-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE1Olb3zMAFFxXKHiIkQO5cJ3Yhl5i6UPp+IhuteBJbuHcA5UogKo0EWtlWwW6KSaKoTNEYL7JlCQiVnkhBktUgg==\n-----END PUBLIC KEY-----',
}],
})

return t.rejects(
f.manifest(),
/sigstore@0.4.0 failed to verify attestation: error refreshing TUF metadata/,
{
code: 'EATTESTATIONVERIFY',
}
)
})

t.test('verifyAttestations publish attestation for unknown public key', async t => {
tnock(t, 'https://registry.npmjs.org')
.get('/sigstore')
Expand Down