Skip to content

Fix/trivy docker scan#249

Open
palakjaiswal16 wants to merge 2 commits into
rishabh0510rishabh:mainfrom
palakjaiswal16:fix/trivy-docker-scan
Open

Fix/trivy docker scan#249
palakjaiswal16 wants to merge 2 commits into
rishabh0510rishabh:mainfrom
palakjaiswal16:fix/trivy-docker-scan

Conversation

@palakjaiswal16

Copy link
Copy Markdown

Description

Integrated Trivy into the release workflow to scan the backend Docker image for vulnerabilities before it is pushed to GHCR. This ensures releases fail when HIGH or CRITICAL OS/library vulnerabilities are detected.

Related Issues

Fixes #189

Changes Made

  • Split the backend Docker release flow into build, scan, and push steps.
  • Added aquasecurity/trivy-action@v0.36.0 to scan the built backend image.
  • Configured Trivy to fail the workflow on HIGH and CRITICAL vulnerabilities before pushing the image.

Verification

  • Added unit tests
  • Ran pytest tests/ successfully
  • Manually tested via the API / CLI
  • (If applicable) Generated scripts pass SafetyFilter
  • Verified .github/workflows/release.yml parses successfully as YAML

Documentation

  • Updated docs/FEATURES.md (if adding a feature/profile)
  • Updated CHANGELOG.md
  • Code is fully documented and type-hinted

@vercel

vercel Bot commented May 26, 2026

Copy link
Copy Markdown

@palakjaiswal16 is attempting to deploy a commit to the rishabhmishra0510-5147's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@palakjaiswal16, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 50 minutes and 29 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c9044206-542a-44ae-a010-edd22af3180f

📥 Commits

Reviewing files that changed from the base of the PR and between 3330691 and df56079.

📒 Files selected for processing (5)
  • .github/workflows/release.yml
  • backend/app/ai/providers/__init__.py
  • backend/app/ai/service.py
  • backend/app/config.py
  • backend/tests/unit/ai/test_fallback_provider.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the GitHub Release workflow to add a Trivy vulnerability scan step before pushing the backend Docker image to GHCR, and also introduces backend-side LLM provider fallback orchestration (plus config and unit tests) to support multi-provider retries.

Changes:

  • Split the backend Docker publish process in release.yml into build → Trivy scan → push.
  • Added ENVFORGE_LLM_PROVIDER_FALLBACKS support and implemented a FallbackProvider that tries multiple LLM providers in order.
  • Updated AI troubleshoot service logging/audit fields to capture the effective provider/model after fallback resolution, and added unit tests for the fallback chain.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
.github/workflows/release.yml Builds backend image locally, scans it with Trivy, then pushes tags to GHCR.
backend/app/ai/providers/__init__.py Adds provider fallback orchestration and provider-chain parsing/builder logic.
backend/app/ai/service.py Records provider/model after completion to reflect the actual provider used after fallback.
backend/app/config.py Adds a new settings field for fallback provider ordering.
backend/tests/unit/ai/test_fallback_provider.py Adds unit tests covering fallback behavior and provider-chain parsing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +156 to +157
primary_index = DEFAULT_FALLBACK_ORDER.index(primary)
chain = list(DEFAULT_FALLBACK_ORDER[primary_index:])
Comment on lines +58 to +76
- name: Build Backend Docker image
uses: docker/build-push-action@v5
with:
context: ./backend
file: ./backend/Dockerfile
push: true
load: true
tags: |
ghcr.io/${{ env.REPO_LC }}/backend:latest
ghcr.io/${{ env.REPO_LC }}/backend:${{ github.ref_name }}

- name: Scan Backend Docker image with Trivy
uses: aquasecurity/trivy-action@v0.36.0
with:
image-ref: ghcr.io/${{ env.REPO_LC }}/backend:${{ github.ref_name }}
scan-type: image
vuln-type: os,library
severity: CRITICAL,HIGH
exit-code: "1"

@rishabh0510rishabh

Copy link
Copy Markdown
Owner

hey @palakjaiswal16 please consider copilot review and make sure all checks are successful currently some checks have failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI/CD]: Integrate Trivy for automated Docker image vulnerability scanning

3 participants