Support Sigstore bundle verification for cosign v3#3123
Support Sigstore bundle verification for cosign v3#3123simonbaird merged 3 commits intoconforma:mainfrom
Conversation
Review Summary by QodoSupport Sigstore bundle verification for cosign v3
WalkthroughsDescription• Add support for Sigstore bundle verification for cosign v3 - Detect bundles via cosign.GetBundles() and route through bundle-aware code path - Implement ProvenanceFromBundlePayload() for parsing DSSE envelope payloads - Add parseAttestationsFromBundles() for extracting attestations from bundles • Fix CLI help text typos and incorrect command examples - Correct "form" to "from" in sigstore initialize help - Fix "expresssion" to "expression" typo in validate image help - Update example commands to use correct ec sigstore initialize syntax • Expose CreateRemoteOptions() as public function for bundle verification Diagramflowchart LR
A["Image with Bundles"] -->|hasBundles check| B["Bundle Path"]
A -->|no bundles| C["Legacy Tag Path"]
B -->|VerifyImageAttestations| D["parseAttestationsFromBundles"]
D -->|ProvenanceFromBundlePayload| E["Attestation Objects"]
C -->|VerifyImageSignatures| F["ProvenanceFromSignature"]
F --> E
File Changes1. cmd/sigstore/initialize.go
|
Code Review by Qodo
1. hasBundles() ignores GetBundles error
|
internal/evaluation_target/application_snapshot_image/application_snapshot_image.go
Show resolved
Hide resolved
internal/evaluation_target/application_snapshot_image/application_snapshot_image.go
Show resolved
Hide resolved
|
/ok-to-test |
|
@SequeI Did you look at the Qodo suggestions? Are any of them worthwhile fixing before merge in your opinion? I do think the "Rego sigstore not bundle-aware" is something we need to fix, but it could have it's own separate PR and Jira. Related question: Is there a Jira open for this one? |
|
FYI I've tested this with a v2 and v3 signed image in a version of #3140 rebased on this PR, and it seems to be working nicely. |
|
For the enterprise contract failure, it's a known issue. Will aim to get it fixed in main branch, then a rebase should get this green. |
|
1 and 2 are by design, if we cannot detect sigstore bundle via referrers API, we fallback to checking for tags so it's fine. Any network/auth failures will get caught by the tag check. Fixed 3rd issue, sig field is populated correctly now. One quick run through to check correctness and should be good |
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
cosign v3 stores signatures as OCI referrer bundles by default, but ec only supported the legacy tag-based format. Detect bundles via cosign.GetBundles() and route verification through the bundle-aware code path, matching what the cosign CLI already does internally. Also fix typos and incorrect examples in CLI help text. Signed-off-by: SequeI <[email protected]>
Signed-off-by: SequeI <[email protected]>
Signed-off-by: SequeI <[email protected]>
|
/ok-to-test |
cosign v3 stores signatures as OCI referrer bundles by default, but ec
only supported the legacy tag-based format. Detect bundles via
cosign.GetBundles() and route verification through the bundle-aware
code path, matching what the cosign CLI already does internally.
Also fix typos and incorrect examples in CLI help text.
You can check this behaviour out by using Cosign V3, signing an image, attaching the predicate.json, and trying to use
ec validatefrom main branch, then from this branch.Ref: https://issues.redhat.com/browse/EC-1689