fix(security): bind Trivy IaC mitigations to source occurrences #15
No reviewers
Labels
No labels
app-migration
bug
ci-cd
cluster
Documentation
duplicate
enhancement
gpu
invalid
networking
question
security
Storage
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Homelab/workflows!15
Loading…
Reference in a new issue
No description provided.
Delete branch "kiyi/fix-trivy-occurrence-fingerprints"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Trivy 0.74 omits CauseMetadata.Resource for these IaC findings, causing separate same-rule defects in one file to share a mitigation fingerprint. Include the positive source StartLine and optional resource identity so each occurrence requires its own mitigation; reject missing or invalid lines and retain no coarse compatibility fallback. Document that source-line changes invalidate mitigations.
Validation: all 41 unit tests pass in Linux, including separate same-rule occurrences, one-occurrence-only mitigation, rejection of old coarse fingerprints, and malformed occurrence metadata. git diff --check passes.
Addresses the upstream blocker in Homelab/platform#20. After review and merge, publish the next patch release, update platform uses and library_ref together, regenerate/adjudicate each mitigation, and rerun hosted security. Platform adoption remains pending that reviewed release.
The Trivy IaC normalizer now fails closed without a positive integer
StartLine, includes that occurrence identity (plus an optional resource) in the fingerprint, and retains no coarse compatibility fallback. The regression proves two same-rule findings in one file receive distinct fingerprints and that mitigating one leaves the other blocking; mutation-testing the location hook makes that regression fail. Against the exact Trivy 0.74 platform report, all 166 IaC findings normalized to 166 unique fingerprints, including the previously colliding KSV-0014 occurrences. All 41 Python 3.12 tests and 16 scaffold cases pass; the exact-head hosted artifact reportspassed: true, zero blockers, five mitigated findings, and zero scanner errors. The branch is current, mergeable, andgit diff --checkis clean. No blocking findings.