chore: add workflow to check for stale cve suppressions#3055
chore: add workflow to check for stale cve suppressions#3055AmberFryar wants to merge 11 commits intomainfrom
Conversation
Greptile SummaryThis PR replaces the previously proposed shell-script approach with a TypeScript implementation that adds a weekly GitHub Actions workflow to audit Confidence Score: 5/5Safe to merge — all findings are P2 style suggestions with no functional impact on the core audit logic. Only P2 findings present (interface typo, process.exit bypassing summary on one rare error path, hardcoded base branch). The core scan-compare-verify-PR flow is logically sound and all previously flagged bugs have been addressed in the TypeScript rewrite. .github/workflows/scripts/audit-grype-suppressions.ts — minor style issues noted above, no blocking defects. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A([Weekly Schedule / workflow_dispatch]) --> B[Build pepr:dev image]
B --> C[Install grype]
C --> D[Scan image with current .grype.yaml]
D --> E{Stale entries in .grype.yaml?}
E -- No --> F[Write 'all clear' summary]
E -- Yes --> G[guardSingleKeyEntries check]
G -- Multi-key entries found --> H[process.exit 1 - no summary written]
G -- OK --> I[removeStaleEntries from .grype.yaml]
I --> J[Re-scan image with updated .grype.yaml]
J --> K{Match count unchanged?}
K -- No --> L[git restore .grype.yaml + throw Error]
L --> M[Write failure summary + Exit 1]
K -- Yes --> N[createOrUpdatePR: git commit + push + gh pr]
N --> O{PR step outcome}
O -- success --> P[Write summary: PR created/updated]
O -- failure --> Q[Write summary: PR failed + Exit 1]
F --> R([Done])
P --> R
Reviews (6): Last reviewed commit: "chore: skip success path" | Re-trigger Greptile |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
samayer12
left a comment
There was a problem hiding this comment.
Since we're doing somewhat complex data processing here and there's a good bit of string-manipulation and file management I'd like to consider the pros/cons of rewriting this check in Typescript for the sake of maintenance. We can also probably bring in some libraries to handle the string-processing and file I/O for us.
We could accept an additional 200-ish lines of bash to automate away this developer toil, but I'd like to evaluate other ways to manage a net-new automation before resorting to yet another bash script. My litmus test here is that we're doing more than ~50 lines worth of work and the actions are more complex than simple mv/cp commands that don't require in-depth bash familiarity. If we decide bash makes the most sense, then we can proceed.
Co-authored-by: Sam Mayer <sam.mayer@defenseunicorns.com>
.grype.yamlCVE suppression list requires manual maintance to remove entries that are no longer needed. This PR adds an automated weekly workflow to audit the CVE suppression list in.grype.yamland remove any entries that are no longer needed.The workflow scans
pepr:dev. Grype's output identifies which suppressed CVEs it actually matched against the image. Any entry in.grype.yamlthat wasn't matched is stale —the CVE is no longer present in the image and the suppression can be safely removed.This workflow only removes suppressions. It never adds them.
How it works
Files added
workflow_dispatch
...
End to End Test:
(See Pepr Excellent Examples)
Related Issue
Fixes #
Relates to #
Type of change
Checklist before merging