Use ValidateVSAAndComparePolicy for ec validate image VSA skip - #3489
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe ChangesVSA validation flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant ValidateImageWithVSACheck
participant UploadBackedRetriever
participant ValidateVSAAndComparePolicy
participant ImageValidation
CLI->>ValidateImageWithVSACheck: pass VSAValidationConfig
ValidateImageWithVSACheck->>UploadBackedRetriever: retrieve VSA envelope
UploadBackedRetriever-->>ValidateImageWithVSACheck: return envelope or retrieval error
ValidateImageWithVSACheck->>ValidateVSAAndComparePolicy: validate VSA
ValidateVSAAndComparePolicy-->>ValidateImageWithVSACheck: return validation result
ValidateImageWithVSACheck->>ImageValidation: continue when VSA validation fails or is unavailable
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
🤖 Review · Commit: |
PR Summary by QodoHarden
AI Description
Diagram
High-Level Assessment
Files changed (4)
|
Code Review by Qodo
1.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@internal/image/validate_test.go`:
- Around line 451-457: Update createPassingVSAEnvelope to define a PolicySpec
with the expected source and policy, assign it to the returned validation data,
and build the predicate.policy from that same specification so the passing test
exercises policy comparison.
🪄 Autofix
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: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: e34f50d2-f28d-4e42-9640-91153a2911eb
📒 Files selected for processing (4)
cmd/validate/image.gocmd/validate/image_test.gointernal/image/validate.gointernal/image/validate_test.go
|
🤖 Finished Review · ✅ Success · Started 9:10 AM UTC · Completed 9:27 AM UTC Commit: |
ReviewFindingsHigh
Medium
Low
Next steps:
Previous runReviewFindingsHigh
Medium
Low
Next steps:
Previous run (2)ReviewFindingsHigh
Medium
Low
Labels: PR is a security fix with a breaking CLI change affecting VSA validation. 'bug' reflects the security vulnerability fix (EC-1842). 'major' reflects the documented breaking change to --vsa-upload requiring --vsa-public-key. Next steps:
Previous run (3)ReviewFindingsHigh
Medium
Low
Labels: PR introduces breaking CLI change and has multiple documentation gaps for a security-relevant feature Next steps:
Previous run (4)ReviewFindingsLow
Previous run (5)ReviewFindingsHigh
Medium
Low
Next steps:
Previous run (6)ReviewFindingsHigh
Medium
Low
Next steps:
Previous run (7)ReviewFindingsMedium
Low
Previous run (8)ReviewFindingsMedium
Low
Previous run (9)ReviewFindingsMedium
Low
Labels: PR modifies CLI flag validation for VSA security hardening and addresses a red team finding about VSA bypass |
|
🤖 Finished Review · ✅ Success · Started 9:29 AM UTC · Completed 9:49 AM UTC Commit: |
|
🤖 Review · Commit: |
|
🤖 Finished Review · ✅ Success · Started 10:26 AM UTC · Completed 10:47 AM UTC Commit: |
|
🤖 Review · ❌ Terminated · Started 10:50 AM UTC · Ended 11:11 AM UTC Commit: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@internal/image/validate_test.go`:
- Around line 529-532: Strengthen fallback validation assertions in
internal/image/validate_test.go at lines 529-532 and 571-573: when expectSkip is
false, assert that the output from ValidateImageWithVSACheck is non-nil,
retaining the returned out value at lines 571-573 before asserting it. Keep the
existing error assertions and skip behavior unchanged.
🪄 Autofix
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: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: a88a7a2b-e0e6-4c73-b138-4cd4a468e64b
📒 Files selected for processing (1)
internal/image/validate_test.go
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 2 files with indirect coverage changes 🚀 New features to boost your workflow:
|
|
🤖 Finished Review · ✅ Success · Started 3:29 PM UTC · Completed 4:08 PM UTC Commit: |
|
/fs-fix rebase on top of main |
|
🤖 Review · Commit: |
|
🤖 Finished Review · ✅ Success · Started 12:53 PM UTC · Completed 1:12 PM UTC Commit: |
|
I'm trying to understand this. Docs say "Add --vsa-public-key to ec validate image, required when --vsa-upload is set.", but they don't say what it's used for. I guess it's used for doing a sig check on an existing VSA found in the storage backend specified by --vsa-upload, is that right? I'm thinking maybe --vsa-upload is a badly chosen param name. It sounds like a verb kinda. |
simonbaird
left a comment
There was a problem hiding this comment.
See my comment and linked PR about the removed snapshot data. Other than that, lgtm.
Yes that's correct. Btw, the same args are used both for vsa creation and vsa retrieval, and this creates some confusion imo. |
IsValidVSA only checked Found && !Expired, so forged VSAs could skip the entire validation pipeline (EC-1842). ValidateVSAAndComparePolicy already handles this for ec validate vsa: it verifies signatures, checks predicate status, and compares policy. Wire it into the image path too. Add --vsa-public-key to ec validate image. Change ValidateImageWithVSACheck to take *vsa.VSAValidationConfig instead of *vsa.VSAChecker + time.Duration. The key is required when --vsa-upload is set and --vsa-expiration > 0, i.e. only when the skip path is active. Upload-only callers (--vsa-expiration=0, as the Konflux task now sets) are unaffected. Flag help and the generated adoc match this guard. Includes an acceptance test covering the missing --vsa-public-key error. Ref: https://issues.redhat.com/browse/EC-1998 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
🤖 Finished Review · ✅ Success · Started 9:55 AM UTC · Completed 10:13 AM UTC Commit: |
|
🤖 Finished Retro · ✅ Success · Started 2:00 PM UTC · Completed 2:52 PM UTC Commit: |
Retro: PR #3489 — Use ValidateVSAAndComparePolicy for VSA-based validation skippingOverviewHuman-authored security fix (st3penta, co-authored with Claude Opus 4.6) that hardened the VSA validation-skip path in Timeline
What went well
What could improve
Existing issues with new evidence from this retro
Proposals filed |
IsValidVSA only checked
Found && !Expired, so forged VSAs could skipthe entire validation pipeline (EC-1842).
ValidateVSAAndComparePolicyalready handles this for
ec validate vsa: it verifies signatures,checks predicate status, and compares policy. Wire it into the image
path too.
Add
--vsa-public-keytoec validate image, required when--vsa-uploadis set. Change
ValidateImageWithVSACheckto take*vsa.VSAValidationConfiginstead of
*vsa.VSAChecker+time.Duration.Breaking change:
--vsa-uploadusers need to also pass--vsa-public-key.Default Konflux pipelines are unaffected.
Ref: https://issues.redhat.com/browse/EC-1998
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com