feat: support npm cli provenance v1 attestations#776
feat: support npm cli provenance v1 attestations#776ramonpetgrave64 merged 26 commits intoslsa-framework:mainfrom
Conversation
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
|
My implementation turns out to be very similar to another earlier draft in #706 |
|
@laurentsimon @ianlewis @haydentherapper |
loosebazooka
left a comment
There was a problem hiding this comment.
I think this looks good. It'd be nice to see an actual npm provenance included in here for documentation (instead of having to go parse the dsse envelope)
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
slugclub
left a comment
There was a problem hiding this comment.
Thanks so much for looking at this, v1 support will be great!
verifiers/internal/gha/slsaprovenance/v1.0/npmcli_github_actions.go
Outdated
Show resolved
Hide resolved
| slsav1 "github.com/slsa-framework/slsa-verifier/v2/verifiers/internal/gha/slsaprovenance/v1.0" | ||
| ) | ||
|
|
||
| func verifyProvenanceMatchesCertificate(prov iface.Provenance, workflow *WorkflowIdentity) error { |
There was a problem hiding this comment.
This isn't new with this change, but it seems this function assumes that the provenance is going to be generated by GitHub but its possible that it comes from elsewhere (e.g. GitLab https://registry.npmjs.org/-/npm/v1/attestations/@ps-testing%2fgitlab-npm-provenance@1.0.19). Is my interpretation correct? Are there any plans to support verifying provenance that doesn't come from GitHub?
There was a problem hiding this comment.
As they're still on provenance v0.2, I think I agree with laurent that we should wait until they start generating slsa v1 provenance
There was a problem hiding this comment.
OK that makes sense. My only other concern would be making sure the errors the library returns if you try to verify an unsupported type of provenance (e.g. gitlab v0.2) are clear. This switch statement defaults to calling verifySystemParameters for any type that isn't slsav1.NpmCLIGithubActionsProvenance (with verifySystemParameters assuming its a GitHub attestation). Another way to do it would be to check for all expected types and then default to returning some "unsupported type" error, to make it clear to external clients what's going on. But maybe this is handled elsewhere in the code before it gets to this function?
There was a problem hiding this comment.
Yes, earlier in the code, the codepath is routed based on BuilderID,
slsa-verifier/verifiers/verifier.go
Lines 26 to 32 in 96619e4
slsa-verifier/verifiers/internal/gha/verifier.go
Lines 42 to 45 in 96619e4
and will error for unsupported builders, like those from GitLab.
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
Signed-off-by: Ramon Petgrave <ramon.petgrave64@gmail.com>
I added some docs in a new commit |
| slsav1 "github.com/slsa-framework/slsa-verifier/v2/verifiers/internal/gha/slsaprovenance/v1.0" | ||
| ) | ||
|
|
||
| func verifyProvenanceMatchesCertificate(prov iface.Provenance, workflow *WorkflowIdentity) error { |
There was a problem hiding this comment.
OK that makes sense. My only other concern would be making sure the errors the library returns if you try to verify an unsupported type of provenance (e.g. gitlab v0.2) are clear. This switch statement defaults to calling verifySystemParameters for any type that isn't slsav1.NpmCLIGithubActionsProvenance (with verifySystemParameters assuming its a GitHub attestation). Another way to do it would be to check for all expected types and then default to returning some "unsupported type" error, to make it clear to external clients what's going on. But maybe this is handled elsewhere in the code before it gets to this function?
|
@haydentherapper |
Fixes #614, #450, #449, #515
Adds support for NPM CLIs build provenances, generated when running
npm publish --provenance --access publicfrom a GitHub Actions workflow.Testing
Future work
--print-provenance