Skip to content

fix(trivy): Preserve finding locations and honor disabled rules - #147

Open
lelia wants to merge 1 commit into
mainfrom
codex/trivy-locations-and-ignores
Open

lelia wants to merge 1 commit into
mainfrom
codex/trivy-locations-and-ignores

Conversation

@lelia

@lelia lelia commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Preserve Trivy finding locations in Socket facts and PR comments, and honor configured Trivy rule and vulnerability exclusions.

Changes

  • Carry the file path and available line range through to facts and PR comments. Render recurring Dockerfile findings as individual rows.
  • Match trivy_disabled_rules against Dockerfile rule IDs and container image and filesystem vulnerability IDs. Keep matched findings in facts as ignored and exclude them from notifications and CI blocking.
  • Document the suppression behavior and record both fixes in the unreleased changelog.

Testing

  • Full pytest suite passed with 520 tests passing and 1 skipped.
  • Compared the original and patched scanner using the published 3.5.0 container and bundled Trivy 0.76.1. The patched PR comment showed all 12 fixture findings with locations where available. The patched scan exited 0 after the blocking rules were disabled and retained the ignored findings in facts.

Fixes CE-527
Fixes CE-528

@lelia
lelia requested a review from a team as a code owner December 4, 2026 19:59
@cursor

cursor Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes Trivy CI gating, PR comment shape, and how trivy_disabled_rules is interpreted—teams relying on old grouped Dockerfile rows or expecting disabled CVEs to block may see different outcomes after upgrade.

Overview
Trivy Dockerfile misconfigurations now keep file path and line range in .socket.facts.json and GitHub PR comments. Directory scans resolve per-target paths, and the PR formatter emits one table row per occurrence (with a Location column and links) instead of collapsing duplicate rule IDs.

trivy_disabled_rules is applied inside the Trivy connector: matching Dockerfile rule IDs and CVE IDs (case-insensitive) get action: ignore with actionReason: disabled_rule in facts, are dropped from notifiers, and no longer affect exit/blocking logic. Suppression is no longer routed through the shared OpenGrep-style normalizer list.

The Trivy GitHub PR notifier was simplified to a unified per-finding flow (Dockerfile table + CVE panels). Docs and changelog describe the suppression behavior; new tests cover locations and disabled-ID handling.

Reviewed by Cursor Bugbot for commit d8c3d3f. Configure here.

@lelia

lelia commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit d8c3d3f. Configure here.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant