-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: audit signatures verifies attestations
Update `audit signatures` to also verify Sigstore attestations. Additional changes: - Adding error message to json error output as there are a lot of different failure cases with signature verification that would be hard to debug without this - Adding predicateType to json error output for attestations to diffentiate between provenance and publish attestations References: - Pacote changes: npm/pacote#259 - RFC: npm/rfcs#626 Signed-off-by: Philip Harrison <[email protected]>
- Loading branch information
Showing
6 changed files
with
610 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,6 +53,7 @@ exports[`test/lib/commands/audit.js TAP audit signatures json output with invali | |
"invalid": [ | ||
{ | ||
"code": "EINTEGRITYSIGNATURE", | ||
"message": "[email protected] has an invalid registry signature with keyid: SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA and signature: bogus", | ||
"integrity": "sha512-QqZ7VJ/8xPkS9s2IWB7Shj3qTJdcRyeXKbPQnsZjsPEwvutGv0EGeVchPcauoiDFJlGbZMFq5GDCurAGNSghJQ==", | ||
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA", | ||
"location": "node_modules/kms-demo", | ||
|
@@ -76,11 +77,34 @@ exports[`test/lib/commands/audit.js TAP audit signatures json output with invali | |
} | ||
` | ||
|
||
exports[`test/lib/commands/audit.js TAP audit signatures json output with invalid attestations > must match snapshot 1`] = ` | ||
{ | ||
"invalid": [ | ||
{ | ||
"code": "EATTESTATIONVERIFY", | ||
"message": "[email protected] failed to verify attestation: artifact signature verification failed", | ||
"integrity": "sha512-e+qfbn/zf1+rCza/BhIA//Awmf0v1pa5HQS8Xk8iXrn9bgytytVLqYD0P7NSqZ6IELTgq+tcDvLPkQjNHyWLNg==", | ||
"keyid": "", | ||
"location": "node_modules/sigstore", | ||
"name": "sigstore", | ||
"registry": "https://registry.npmjs.org/", | ||
"resolved": "https://registry.npmjs.org/sigstore/-/sigstore-1.0.0.tgz", | ||
"signature": "MEYCIQD10kAn3lC/1rJvXBtSDckbqkKEmz369gPDKb4lG4zMKQIhAP1+RhbMcASsfXhxpXKNCAjJb+3Av3Br95eKD7VL/BEB", | ||
"predicateType": "https://slsa.dev/provenance/v0.2", | ||
"type": "dependencies", | ||
"version": "1.0.0" | ||
} | ||
], | ||
"missing": [] | ||
} | ||
` | ||
|
||
exports[`test/lib/commands/audit.js TAP audit signatures json output with invalid signatures > must match snapshot 1`] = ` | ||
{ | ||
"invalid": [ | ||
{ | ||
"code": "EINTEGRITYSIGNATURE", | ||
"message": "[email protected] has an invalid registry signature with keyid: SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA and signature: bogus", | ||
"integrity": "sha512-QqZ7VJ/8xPkS9s2IWB7Shj3qTJdcRyeXKbPQnsZjsPEwvutGv0EGeVchPcauoiDFJlGbZMFq5GDCurAGNSghJQ==", | ||
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA", | ||
"location": "node_modules/kms-demo", | ||
|
@@ -173,6 +197,17 @@ audited 1 package in xxx | |
` | ||
|
||
exports[`test/lib/commands/audit.js TAP audit signatures with invalid attestations > must match snapshot 1`] = ` | ||
audited 1 package in xxx | ||
1 package has an invalid attestation: | ||
[email protected] (https://registry.npmjs.org/) | ||
Someone might have tampered with this package since it was published on the registry! | ||
` | ||
|
||
exports[`test/lib/commands/audit.js TAP audit signatures with invalid signatures > must match snapshot 1`] = ` | ||
audited 1 package in xxx | ||
|
@@ -203,6 +238,18 @@ audited 1 package in xxx | |
[email protected] (https://registry.npmjs.org/) | ||
` | ||
|
||
exports[`test/lib/commands/audit.js TAP audit signatures with multiple invalid attestations > must match snapshot 1`] = ` | ||
audited 2 packages in xxx | ||
2 packages have invalid attestations: | ||
[email protected] (https://registry.npmjs.org/) | ||
[email protected] (https://registry.npmjs.org/) | ||
Someone might have tampered with these packages since they were published on the registry! | ||
` | ||
|
||
exports[`test/lib/commands/audit.js TAP audit signatures with multiple invalid signatures > must match snapshot 1`] = ` | ||
audited 2 packages in xxx | ||
|
@@ -247,6 +294,15 @@ audited 2 packages in xxx | |
[email protected] (https://registry.npmjs.org/) | ||
` | ||
|
||
exports[`test/lib/commands/audit.js TAP audit signatures with valid attestations > must match snapshot 1`] = ` | ||
audited 1 package in xxx | ||
1 package has a verified registry signature | ||
1 package has a verified attestation | ||
` | ||
|
||
exports[`test/lib/commands/audit.js TAP audit signatures with valid signatures > must match snapshot 1`] = ` | ||
audited 1 package in xxx | ||
|
Oops, something went wrong.