-
Notifications
You must be signed in to change notification settings - Fork 51
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
feat: Verify all artifacts passed in cmdline #419
feat: Verify all artifacts passed in cmdline #419
Conversation
+1 on not showing the Usage when it fails. I think there's a tracking issue for it. tracks it, IIUC
We don't check the subject name, so this seems correct. We only check for a matching hash. I am a little worried that printing Gathering all errors in a proper "log" structure is something that would be useful #161. It would allow us to also report everything in a JSON format (if users want to parse the results or if it's the response to a REST API). |
We only print |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Would you be able to add some tests in main_test.go?
(We can add some e2e in the slsa-framework/example-package repo later)
Let me look into it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also update the documentation in the README.md?
Awesome, that sounds great! Maybe we can point that out in the README.md too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Seems like just a few lint/build failures
Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
Mention that we support multiple artifacts as long as they come from the same provenance. Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
16e15fa
to
ec54e9f
Compare
Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
Since all images should come from the same provenance file, there's an invariant that we will always get exactly one builderID. So, no need to return a slice of them. Just to preempt the case when the invariant would be broken, add a specific check. Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
No new tests added, just changing table test data type. Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
For now, just allow passing the entire array of artifacts to command line / arguments. The functionality should still be the same. Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
f20b76c
to
46d0c3c
Compare
Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
9c8b156
to
7543a87
Compare
Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
Ok, got it. The issue was that there are a lot of occurrences of Updating the README.md and it should all be done in the next 5-10 mins |
Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
All ready for a new review, PTAL and sorry it took so long to fix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the README!
provenanceOpts := &options.ProvenanceOpts{ | ||
ExpectedSourceURI: c.SourceURI, | ||
ExpectedBranch: c.SourceBranch, | ||
ExpectedDigest: artifactHash, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apologies for only seeing this now!
likely it probably makes the most sense to migate ExpectedDigest
to ExpectedDigests
so that we don't have to run signature verification more than once. I realize that's a breaking change -- maybe we should file a cleanup issue before the next major release?
doing it in a backwards compatible way with a new field would i guess be possible, and we could check for both ExpectedDigest/ExpectedDigests. It's not urgent to me though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good idea. Created #422 to track
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it breaking for CLI or just the API? If just for the API, we could add a section to the README saying that we respect semver for the CLI only at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it would be just for the API -- the CLI would still have the versioning.
Interesting about CLI semver -- in the past I've experienced only API being the versioning importance, but actually here CLI may be the only thing. No one is using as a library yet..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like what OSV does: the call out exactly what follows semver https://github.com/google/osv-scanner#semver-adherence. Created slsa-framework/slsa-github-generator#1427 for tracking.
@mihaimaruseac in a follow-up PR, we also need to update the REST service. See https://github.com/slsa-framework/slsa-verifier/blob/main/experimental/rest/service.go#L21 used by https://github.com/slsa-framework/slsa-verifier/blob/main/cli/experimental/service/main.go |
Ready to merge? |
Ready to merge on my side. I'll look into upgrading the REST service and the e2e test in the example repo as well as #422 (shouldn't break anything, afaik, but I'll check to be sure) |
Great, thanks @mihaimaruseac Maybe also we need to update the |
MAde #423 to track that. Thanks for review and merging! |
So I look at these and this is just the verification, it will need to be updated only after #422, when we migrate to do a single verification for multiple artifacts. I could be mistaken though? |
+1, you're correct. Just wanted to be sure we have a tracking issue for it |
Added a mention of this in #422 |
Fixes slsa-framework#425 introduces by slsa-framework#419 Signed-off-by: Mihai Maruseac <mihaimaruseac@google.com>
This should close #91.
Turns out that even if we pass an artifact that does not match provenance (same name, invalid hash) or an artifact that is not covered by the provenance (not in
subject
), the verifier reports the same error: hash not matching provenance. See below:In this case, I used the artifacts from the test repo and passed the provenance as an additional artifact to verify. Observe how verification fails for this additional "artifact".
If I only pass
fib
andhello
, all passes:Verification still passes if passing one single blob for a correct artifact:
And it fails if the artifact cannot be verified:
I think maybe we should not print the usage if validation fails. Also, should we do the same for image verification or allow only one argument there?
At the moment, validation fails on the first error. If needed, I'll send a different PR that tries to do as much work as possible and report all errors at the end.
Signed-off-by: Mihai Maruseac mihaimaruseac@google.com