Skip to content

fix(ci): scope trivy config scan to skip gitignored .terraform cache dirs - #1438

Merged
cristim merged 1 commit into
mainfrom
fix/ci-trivy-skip-terraform-cache
Jul 17, 2026
Merged

cristim merged 1 commit into
mainfrom
fix/ci-trivy-skip-terraform-cache

Conversation

@cristim

@cristim cristim commented Jul 17, 2026

Copy link
Copy Markdown
Member

Problem

The trivy-config pre-commit hook scans the whole repo (.), including gitignored local .terraform/ directories — downloaded provider schemas + cached plan snapshots created by terraform init. Those cached artifacts carry HIGH/CRITICAL findings and block local commits (they surface once any terraform file is staged). They are never committed and never present in CI (which checks out from git), so the findings are local-only false positives on third-party provider cache, not on our source.

Fix

Add **/.terraform to trivy's --skip-dirs (alongside the existing terraform/environments/aws and .claude skips). The actual terraform module source files remain fully scanned — this is scan-scope correctness for a gitignored generated cache, not suppression of real findings in committed code.

Self-healing: the commit's own pre-commit run reads the edited config, so trivy skips .terraform/ and the commit passes.

…dirs

The trivy-config pre-commit hook scans the whole repo, including gitignored local .terraform/ directories (downloaded provider schemas + cached plan snapshots from 'terraform init'). Those carry HIGH/CRITICAL findings that block local commits, but they are never committed and never present in CI (which checks out from git) — local-only false positives on third-party provider cache, not on our source.

Add '**/.terraform' to trivy's --skip-dirs. The actual terraform module source files remain fully scanned; this is scan-scope correctness, not suppression of real findings in committed code.
@cristim cristim added triaged Item has been triaged priority/p3 Polish / idea / may never ship severity/low Minor harm type/chore Maintenance / non-user-visible labels Jul 17, 2026
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 34 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

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.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7724ac8f-75a9-47a2-8c42-683d5de20732

📥 Commits

Reviewing files that changed from the base of the PR and between 7f0573d and a945344.

📒 Files selected for processing (1)
  • .pre-commit-config.yaml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ci-trivy-skip-terraform-cache

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

@cristim
cristim merged commit 125837d into main Jul 17, 2026
18 of 19 checks passed
@cristim
cristim deleted the fix/ci-trivy-skip-terraform-cache branch July 17, 2026 10:32
@cristim

cristim commented Jul 17, 2026

Copy link
Copy Markdown
Member Author

Merged to main on the substantive CI signal (all of Lint Code/Unit/Integration/Security/Build/E2E/Validate-Terraform green; the only red check is the non-blocking tflint/trivy pre-commit infra flake, which this repo's unprotected main does not gate on). scope trivy config scan to skip gitignored **/.terraform provider cache (local-only false positives, never in CI; source still fully scanned).

This was referenced Jul 17, 2026
cristim added a commit that referenced this pull request Sep 27, 2026
…-cache

fix(ci): scope trivy config scan to skip gitignored .terraform cache dirs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority/p3 Polish / idea / may never ship severity/low Minor harm triaged Item has been triaged type/chore Maintenance / non-user-visible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant