-
Notifications
You must be signed in to change notification settings - Fork 0
ci: split vulnerability scans into critical-fail and high-warn tiers #277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -96,22 +96,34 @@ jobs: | |||||||||||||||||||||||||||||||||||
| id: scan-ref | ||||||||||||||||||||||||||||||||||||
| run: echo "ref=ghcr.io/aureliolo/ai-company-backend:sha-${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT" | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - name: Trivy scan | ||||||||||||||||||||||||||||||||||||
| - name: Trivy scan (critical — hard fail) | ||||||||||||||||||||||||||||||||||||
| uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # v0.35.0 | ||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||
| image-ref: ${{ steps.scan-ref.outputs.ref }} | ||||||||||||||||||||||||||||||||||||
| format: table | ||||||||||||||||||||||||||||||||||||
| exit-code: "1" | ||||||||||||||||||||||||||||||||||||
| severity: CRITICAL,HIGH | ||||||||||||||||||||||||||||||||||||
| severity: CRITICAL | ||||||||||||||||||||||||||||||||||||
| trivyignores: .trivyignore.yaml | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - name: Trivy scan (high — warn only) | ||||||||||||||||||||||||||||||||||||
| uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # v0.35.0 | ||||||||||||||||||||||||||||||||||||
| continue-on-error: true | ||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||
| image-ref: ${{ steps.scan-ref.outputs.ref }} | ||||||||||||||||||||||||||||||||||||
| format: table | ||||||||||||||||||||||||||||||||||||
| exit-code: "0" | ||||||||||||||||||||||||||||||||||||
| severity: HIGH | ||||||||||||||||||||||||||||||||||||
| trivyignores: .trivyignore.yaml | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+108
to
+116
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The CRITICAL step (no Using
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: .github/workflows/docker.yml
Line: 108-116
Comment:
**`continue-on-error: true` masks scan infrastructure failures**
`exit-code: "0"` already instructs Trivy to exit with code 0 when vulnerabilities are found, making `continue-on-error: true` redundant for the intended use case. However, the combination is subtly problematic: if Trivy encounters a genuine infrastructure error (DB download failure, image pull error, malformed config), it still exits non-zero — but `continue-on-error: true` will swallow that failure and mark the step as passed.
The CRITICAL step (no `continue-on-error`) running first provides a partial mitigation — if the infrastructure is broken, the critical scan would fail first. However, there's a narrow window where the critical step succeeds and the high step then encounters a transient error (flaky network on DB re-download, ephemeral runner issues), resulting in the HIGH scan being silently skipped rather than visibly errored.
Using `exit-code: "0"` alone is sufficient to make findings non-blocking, while still correctly surfacing scan infrastructure failures in the step output. Consider removing `continue-on-error: true` from both the `build-backend` (line 110) and `build-web` (line 221) jobs:
```suggestion
- name: Trivy scan (high — warn only)
uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # v0.35.0
with:
image-ref: ${{ steps.scan-ref.outputs.ref }}
format: table
exit-code: "0"
severity: HIGH
trivyignores: .trivyignore.yaml
```
How can I resolve this? If you propose a fix, please make it concise. |
||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - name: Grype scan | ||||||||||||||||||||||||||||||||||||
| uses: anchore/scan-action@1638637db639e0ade3258b51db49a9a137574c3e # v6 | ||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||
| image: ${{ steps.scan-ref.outputs.ref }} | ||||||||||||||||||||||||||||||||||||
| fail-build: true | ||||||||||||||||||||||||||||||||||||
| severity-cutoff: high | ||||||||||||||||||||||||||||||||||||
| severity-cutoff: critical | ||||||||||||||||||||||||||||||||||||
|
greptile-apps[bot] marked this conversation as resolved.
|
||||||||||||||||||||||||||||||||||||
| severity-cutoff: critical | |
| severity-cutoff: critical | |
| grype-config: .grype.yaml |
Copilot
AI
Mar 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.grype.yaml is added in this PR, but the Grype scan step doesn’t explicitly reference it (no config/args pointing to .grype.yaml). If anchore/scan-action doesn’t automatically discover repo-local config in its execution environment, the CVE ignore won’t apply and the job can still fail on CVE-2026-22184. Consider passing the config explicitly (or adding a note/assertion in the workflow logs) so it’s unambiguous that Grype is using the intended ignore list.
| severity-cutoff: critical | |
| severity-cutoff: critical | |
| grype-config: .grype.yaml |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Grype configuration — CVE ignore list | ||
| # Kept in sync with .trivyignore.yaml. | ||
|
|
||
| ignore: | ||
| - vulnerability: CVE-2026-22184 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There appears to be a typo in the CVE identifier. Based on the context and the links provided in the PR description, the correct identifier should be - vulnerability: CVE-2022-37434 |
||
| reason: >- | ||
| Disputed zlib vulnerability affecting only the untgz demo utility | ||
| in contrib/, not core zlib. Upstream disputes CVE validity. | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,11 @@ | ||||||||||||||||||||||||||||||||||||||
| # Trivy CVE ignore list — structured YAML format | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| vulnerabilities: | ||||||||||||||||||||||||||||||||||||||
| - id: CVE-2026-22184 | ||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||||||||||||||||||||||||||||||
| statement: >- | ||||||||||||||||||||||||||||||||||||||
| Disputed zlib vulnerability affecting only the untgz demo utility | ||||||||||||||||||||||||||||||||||||||
| in contrib/, not core zlib compression. Our images do not ship or | ||||||||||||||||||||||||||||||||||||||
| invoke untgz. Upstream disputes CVE validity: | ||||||||||||||||||||||||||||||||||||||
| https://github.com/madler/zlib/issues/1148 | ||||||||||||||||||||||||||||||||||||||
| nginx-unprivileged maintainer closed as not-zlib: | ||||||||||||||||||||||||||||||||||||||
| https://github.com/nginx/docker-nginx-unprivileged/issues/381 | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+4
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No expiry date on CVE suppression Trivy's structured YAML ignore format supports an Consider adding an expiry date (e.g. 90 days out) so the entry automatically becomes actionable if the upstream situation hasn't resolved by then:
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: .trivyignore.yaml
Line: 4-11
Comment:
**No expiry date on CVE suppression**
Trivy's structured YAML ignore format supports an `expiry-date` field. Without it, this entry will silently suppress CVE-2026-22184 **indefinitely** — even after Alpine rebuilds its base image with a patched zlib. If the patch lands before the ignore entry is manually reviewed, future scans would still mask it with no alert.
Consider adding an expiry date (e.g. 90 days out) so the entry automatically becomes actionable if the upstream situation hasn't resolved by then:
```suggestion
vulnerabilities:
- id: CVE-2026-22184
expiry-date: "2026-06-10"
statement: >-
Disputed zlib vulnerability affecting only the untgz demo utility
in contrib/, not core zlib compression. Our images do not ship or
invoke untgz. Upstream disputes CVE validity:
https://github.com/madler/zlib/issues/1148
nginx-unprivileged maintainer closed as not-zlib:
https://github.com/nginx/docker-nginx-unprivileged/issues/381
```
How can I resolve this? If you propose a fix, please make it concise. |
||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.