ci: add Trivy security scan to PR pipeline - #131
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughChangesTrivy security checks
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant PullRequest as Pull request workflow
participant TrivyScan as trivy_scan
participant TrivyAction as Local Trivy action
participant Trivy as Trivy
PullRequest->>TrivyScan: Run for eligible pull request
TrivyScan->>TrivyAction: Execute local action
TrivyAction->>Trivy: Scan Maven dependencies and Dockerfile base images
Trivy-->>TrivyAction: Return HIGH/CRITICAL findings
TrivyAction-->>TrivyScan: Report results and exit status
PullRequest->>PullRequest: Wait in all-checks
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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
🧹 Nitpick comments (1)
.github/steps/trivy/action.yml (1)
14-17: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winPin
aquasecurity/setup-trivyto a commit SHA.
aquasecurity/setup-trivy@v0.3.1relies on a mutable tag. Pin this action to the commit SHA, for example81e5143, to reduce supply-chain risk from tag replacement or compromise.🤖 Prompt for 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. In @.github/steps/trivy/action.yml around lines 14 - 17, Update the aquasecurity/setup-trivy action reference from the mutable v0.3.1 tag to the specified commit SHA 81e5143, while preserving the existing version and cache inputs.
🤖 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 @.github/steps/trivy/action.yml:
- Around line 56-68: Update the failed-scan branch in the image-processing loop
around the trivy image invocation to emit a GitHub Actions ::warning:: or
::error:: annotation that includes the affected image and failure context, while
retaining the existing continue behavior. Keep intentional skips for aliases,
scratch, and variable-based tags unchanged and distinct from actual trivy
failures.
In @.github/workflows/test.yml:
- Around line 34-37: Update the Checkout step in the trivy_scan job to set
persist-credentials to false in its actions/checkout@v4 configuration, while
preserving the existing pull-request head SHA ref.
---
Nitpick comments:
In @.github/steps/trivy/action.yml:
- Around line 14-17: Update the aquasecurity/setup-trivy action reference from
the mutable v0.3.1 tag to the specified commit SHA 81e5143, while preserving the
existing version and cache inputs.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a8719eb0-e791-4150-a73d-328180348b29
📒 Files selected for processing (3)
.github/steps/trivy/action.yml.github/workflows/test.yml.trivyignore
…s for skipped scans
…to scan_code/scan_image
Adds a Trivy-based PR security gate:
Summary by CodeRabbit
New Features
Documentation