Use ValidateVSAAndComparePolicy for ec validate image VSA skip - #3489
Use ValidateVSAAndComparePolicy for ec validate image VSA skip#3489st3penta wants to merge 3 commits into
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: |
ReviewFindingsLow
Previous runReviewFindingsHigh
Medium
Low
Next steps:
Previous run (2)ReviewFindingsHigh
Medium
Low
Next steps:
Previous run (3)ReviewFindingsMedium
Low
Previous run (4)ReviewFindingsMedium
Low
Previous run (5)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: |
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, required when --vsa-upload is set. Change ValidateImageWithVSACheck to take *vsa.VSAValidationConfig instead of *vsa.VSAChecker + time.Duration. Ref: https://issues.redhat.com/browse/EC-1998 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
🤖 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 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
|
🤖 Finished Review · ✅ Success · Started 10:50 AM UTC · Completed 11:11 AM UTC Commit: |
Verify that ec validate image with --vsa-upload but without --vsa-public-key exits with status 1 and a clear error message. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
🤖 Finished Review · ✅ Success · Started 1:00 PM UTC · Completed 1:17 PM UTC Commit: |
PreRunE required --vsa-public-key whenever --vsa-upload was set, but the Konflux task uses --vsa-upload for upload-only (no skip path). Check --vsa-expiration > 0 instead, and set --vsa-expiration=0 in the Konflux task. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
🤖 Finished Review · ✅ Success · Started 2:27 PM UTC · Completed 2:43 PM UTC Commit: |
Superseded by updated review
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