fix(security): explain scan findings and handle image locations #22
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!22
Loading…
Reference in a new issue
No description provided.
Delete branch "kiyi/image-config-occurrences"
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?
Actual run 32 fails because Trivy image Dockerfile absence checks can omit source lines. Its decision artifact also strips the explanation needed to distinguish CVEs from configuration checks and assess remediation.
This PR fixes image finding normalization and publishes actionable scan artifacts:
Validation: 16 security, six reporting, 12 delivery and nine Forgejo contract tests pass locally. Tests cover exact fingerprint/mitigation stability, real Trivy image findings, missing/malformed locations, each disposition, scanner-error-only artifacts, secret/snippet omission, output escaping and all five upload workflows. A full Actual-image preview produces 252 explained findings with the same 79 policy blockers, including UNKNOWN severities. Hosted checks must pass.
The image findings still require applicability assessment; this PR does not certify the image safe. No budget data accessed or deployment performed. Intended patch release: v1.3.3.
Additional reproduction: a full local Trivy 0.74.0 scan (vuln,misconfig,secret plus image-config misconfig/secret) of the same pinned Actual amd64 image normalizes successfully with this fix: 252 findings total, including 59 HIGH and 4 CRITICAL vulnerability occurrences and 10 HIGH Dockerfile findings; zero secret findings. Counts use the locally refreshed DB and are not a replacement for the hosted gate or exploitability assessment. No mitigation was added. This confirms the parser failure concealed subsequent image findings that require separate review before release/deployment.
fix(security): retain image findings without source linesto fix(security): explain scan findings and handle image locationsExpanded this PR to address the owner’s request for useful future scan artifacts. summary.md and findings.csv now accompany enriched decision.json, with blockers first, descriptions, affected/fixed package versions, advisory links, scanner errors and exact mitigation controls. All five scan upload workflows include these files without adding raw scanner directories.
Local validation: 16 security + 6 reporting + 12 delivery + 9 Forgejo contract tests pass. The full reproduced Actual scan renders 252 findings with the same 79 blockers; no exceptions added. Description/fix metadata changes preserve fingerprints. Secret-match omission, Markdown escaping, CSV formula neutralization, error-only reports, and upload wiring are covered. The one shifted Semgrep fingerprint retains its original control/expiry. Hosted checks are rerunning on the final report-ordering revision.
Two blockers remain in the new report path.
pipeline/security.py:334— the production integration is not regression-tested. Replacingwrite_reports(output, decision)with the previous decision-only JSON write leaves all 61 unit tests and all 16 scaffold cases green. The reporting tests invokewrite_reports()directly, and the upload contract test only checks YAML paths, so neither proves thatscan()actually createssummary.mdandfindings.csv. The exact-head hosted security artifact does not close this gap: artifact 80 contains onlydecision.json, with noreport_versionor summary, because the repository self-scan still runs the older pinned reusable release. Add a scan-level regression using controlled/mocked scanner execution that calls the productionscan()path and requires all three reports, including the scanner-error/rejection path.pipeline/reporting.py:161— every finding heading contains literal mojibake:—rather than an em dash. A generated report currently renders## 1. rule — HIGH — blocking, and no test notices it. Replace the double-encoded characters and assert the generated UTF-8 heading so this user-facing artifact remains readable.Other adversarial checks passed: the image-Dockerfile missing-line fallback remains narrowly gated and preserves 15 unique fixture fingerprints; mutations removing that fallback, secret-detail scrubbing, CSV formula neutralization, or an upload path are killed by focused tests. The full 61-test suite, 16 scaffold cases, Kubernetes negative fixtures, compilation, and diff checks pass. All four hosted contexts are green. Exact-head artifact 80 reports the existing gate passed with zero blockers, five exact mitigations, and zero scanner errors, but—as noted above—it was produced by the older reporter and cannot validate this PR's new artifacts. Live, fetched, local, and payload SHAs matched before submission.
Addressed both blockers in
9f84529283.Validation: all 62 unit tests pass; Linux scaffold validation passes all 16 cases; git diff --check passes. A decision-only writer mutation fails all three scan scenarios, and reintroducing the garbled separators fails the heading assertion. Hosted checks are running. The pinned repository self-scan still uses the older release, so its artifact is not evidence of the new reporter; the scan integration regression now validates that wiring directly.
The two blockers from review #440 are resolved at this head.
scan()path now has integration coverage for passing scans, policy-blocking findings, and scanner failures. Every case requires enricheddecision.json,summary.md, andfindings.csv; deleting the productionwrite_reports()call causes the focused suite to fail.Verification: 62 unit tests passed; 16 scaffold scenarios passed; Kubernetes negative fixtures, Python compilation, and diff checks passed; all four hosted contexts are green; worktree is clean. Exact-head security artifact 82 reports
passed: true, zero blockers, and zero scanner errors. It still contains only the older pinned reporter'sdecision.json, so approval relies on the new production-path regression rather than misrepresenting that artifact as evidence of the new files. Live, fetched, local, and payload SHAs matched before submission.