-
-
Notifications
You must be signed in to change notification settings - Fork 567
chore(security): Add trivy scanner for image vulnerabilities #915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughA new GitHub Actions workflow file has been added to automate vulnerability scanning of Docker images using Trivy. The workflow runs on manual dispatch, pull request events, and on a daily schedule, scanning both "latest" and "nightly" tagged images for vulnerabilities and failing if any CRITICAL severity issues are found (excluding unfixed vulnerabilities). Changes
Sequence Diagram(s)sequenceDiagram
participant GitHub Actions
participant Docker Registry
participant Trivy
GitHub Actions->>Docker Registry: Pull "latest" image
GitHub Actions->>Trivy: Run scan on "latest" image
Trivy-->>GitHub Actions: Return scan results
GitHub Actions->>Docker Registry: Pull "nightly" image
GitHub Actions->>Trivy: Run scan on "nightly" image
Trivy-->>GitHub Actions: Return scan results
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Suggested reviewers
Note 🔌 MCP (Model Context Protocol) integration is now available in Early Access!Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context. 📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
.github/workflows/trivy.yaml (1)
13-41
: DRY up duplicate jobs with a matrix strategy
latest-scan
andnightly-scan
are identical except for the tag. Maintaining two copies increases maintenance overhead and risk of drift. A single matrix job keeps the file concise and easier to extend (e.g., addingstable
).-jobs: - latest-scan: - name: Scan Latest Image tag - runs-on: ubuntu-latest - steps: - - name: Pull image - run: docker pull ghcr.io/antonbabenko/pre-commit-terraform:latest - - name: Run Trivy vulnerability scanner - uses: aquasecurity/trivy-action@dc5a429b52fcf669ce959baa2c2dd26090d2a6c4 # v0.32.0 - with: - image-ref: ghcr.io/antonbabenko/pre-commit-terraform:latest - exit-code: '1' - ignore-unfixed: true - - nightly-scan: - name: Scan Nightly Image tag - runs-on: ubuntu-latest - steps: - - name: Pull image - run: docker pull ghcr.io/antonbabenko/pre-commit-terraform:nightly - - name: Run Trivy vulnerability scanner - uses: aquasecurity/trivy-action@dc5a429b52fcf669ce959baa2c2dd26090d2a6c4 # v0.32.0 - with: - image-ref: ghcr.io/antonbabenko/pre-commit-terraform:nightly - exit-code: '1' - ignore-unfixed: true +jobs: + trivy-scan: + strategy: + matrix: + tag: [latest, nightly] + runs-on: ubuntu-latest + name: Scan ${{ matrix.tag }} image + steps: + - name: Pull image + run: docker pull ghcr.io/antonbabenko/pre-commit-terraform:${{ matrix.tag }} + - name: Run Trivy vulnerability scanner + uses: aquasecurity/trivy-action@dc5a429b52fcf669ce959baa2c2dd26090d2a6c4 # v0.32.0 + with: + image-ref: ghcr.io/antonbabenko/pre-commit-terraform:${{ matrix.tag }} + exit-code: '1' + ignore-unfixed: true(Nice-to-have; feel free to defer if keeping explicit jobs improves clarity.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rabbit's suggestion to use matrix looks relevant — is it plausible and feasible? #915 (review)
This PR has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this PR will be closed in 10 days |
Terrascan will soon be not supported at all, and current issues will not be fixed ![]() Not sure what to do with this workflow |
Put an
x
into the box if that apply:Description of your changes
Add Tryvy security scanner to check most resent Docker image tags for known vulnerabilities