Repository navigation
ROX-34488: discover cosign signatures via OCI 1.1 Referrers API - #21908
Conversation
|
Skipping CI for Draft Pull Request. |
🚀 Build Images ReadyImages are ready for commit fe56193. To use with deploy scripts: export MAIN_IMAGE_TAG=4.12.x-625-gfe56193b04 |
4fecac8 to
ea85a49
Compare
17ac497 to
cebd12e
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #21908 +/- ##
==========================================
- Coverage 51.23% 51.20% -0.04%
==========================================
Files 2864 2865 +1
Lines 178713 178805 +92
==========================================
- Hits 91558 91549 -9
- Misses 79119 79194 +75
- Partials 8036 8062 +26
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
fa3f8b2 to
bd0f325
Compare
bd0f325 to
aa2e65b
Compare
guzalv
left a comment
There was a problem hiding this comment.
Looks great! I left a couple comments/questions, nothing blocking.
Also AI mentioned that we should add a test that uploads a real sigstore bundle and fetches it via fetchSignaturesByReferrer, didn't verify that claim.
9492b3b to
61ae691
Compare
563306b to
71fbcee
Compare
The fourth PR in the stack has explicit e2e tests that include fetching and verification of real certificates. |
Extract signature payload fetching into cosign_payload_fetcher.go and add referrer-based discovery alongside the existing tag-based method. FetchSignatures now queries both paths and merges results. Referrer errors are swallowed so registries without OCI 1.1 support keep working. This enables discovery of signatures created by cosign v3+, which defaults to storing signatures as OCI referrers instead of legacy tags. Partially generated by AI.
- Pass imgSHA string instead of *storage.Image to fetchSignaturesByTag and newTagSignedEntity since only the SHA is used. - Filter referrer manifests by artifact type before clamping to the 50-manifest budget so non-sigstore referrers don't consume the limit. - Return single signaturePayload from fetchSigstoreBundle instead of a slice since it always produces exactly one payload. - Add comment explaining that 404 from Referrers API means the registry does not support OCI 1.1. - Consolidate TestConvertPayloadsToSignatures into one table-driven test. Partially generated by AI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Both Attestations() and Attachment() on tagSignedEntity are unused safe defaults for the oci.SignedEntity interface. Return nil, nil from both for consistency. Partially generated by AI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
71fbcee to
4160635
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe signature fetcher now supports retry modifiers, concurrently discovers SimpleSigning tags and OCI 1.1 sigstore bundle referrers, converts both payload formats, handles partial failures, and returns deduplicated signatures. ChangesCosign signature fetching
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant SignatureFetcher
participant fetchWithRetry
participant OCIRegistry
participant convertPayloadsToSignatures
SignatureFetcher->>fetchWithRetry: run tag and referrer discovery
fetchWithRetry->>OCIRegistry: issue retryable requests with attempt timeout
OCIRegistry-->>fetchWithRetry: return payloads or errors
fetchWithRetry-->>SignatureFetcher: merge and deduplicate payloads
SignatureFetcher->>convertPayloadsToSignatures: convert signature payloads
convertPayloadsToSignatures-->>SignatureFetcher: return storage signatures
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/signatures/cosign_payload_fetcher.go`:
- Around line 127-139: Update the referrer-fetch loop around fetchSigstoreBundle
to propagate bundle-fetch failures instead of logging and continuing, allowing
fetchWithRetry to retry incomplete scans. Also return the context cancellation
error when cancellation stops the scan, while preserving successful payload
accumulation and returning normally only after all descriptors are processed
successfully.
In `@pkg/signatures/cosign_sig_fetcher.go`:
- Around line 57-65: Update FetchSignatures so referrer discovery errors are
ignored whenever legacy tag discovery completes successfully, including when it
returns zero signatures. Determine path success from the absence of an error
rather than the number of signatures, and return an error only when both
discovery paths fail; preserve merging, deduplication, and unauthorized-error
handling.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Central YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: 11172bbd-9fab-40ff-9c9c-6418b1d94061
📒 Files selected for processing (6)
pkg/images/enricher/testing_test.gopkg/signatures/cosign_payload_fetcher.gopkg/signatures/cosign_payload_fetcher_test.gopkg/signatures/cosign_sig_fetcher.gopkg/signatures/cosign_sig_fetcher_test.gopkg/signatures/factory.go
Propagate bundle-fetch and context-cancellation errors from the referrer loop so fetchWithRetry can retry incomplete scans. Fix FetchSignatures merge logic to determine path success from absence of error rather than signature count, so referrer errors are ignored when tag discovery succeeds. Partially generated by AI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@stehessel: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Description
Extract signature payload fetching into
cosign_payload_fetcher.goand add referrer-based discovery alongside the existing tag-based method.FetchSignaturesnow queries both paths and merges results. Referrer errors are swallowed so registries without OCI 1.1 support keep working.This enables discovery of signatures created by cosign v3+, which defaults to storing signatures as OCI referrers instead of legacy tags.
User-facing documentation
Testing and quality
Automated testing
How I validated my change
Unit tests for tag-based and referrer-based payload fetching in
cosign_payload_fetcher_test.goandcosign_sig_fetcher_test.gousing an in-memory registry.