Repository navigation
ci(security): enforce Trivy SARIF severity filter and suppress false positives - #342
Merged
Merged
Conversation
aghassemlouei
requested review from
Calvin-Cheng1,
LanceWray and
mgcarey-google
October 22, 2026 22:01
aghassemlouei
marked this pull request as ready for review
October 23, 2026 00:28
aghassemlouei
force-pushed
the
ci/tune-security-scans
branch
from
October 23, 2026 12:46
c059f6f to
db76235
Compare
18 of 19 tasks
aghassemlouei
force-pushed
the
ci/tune-security-scans
branch
from
October 28, 2026 04:09
db76235 to
64a783e
Compare
Calvin-Cheng1
requested changes
Oct 28, 2026
Calvin-Cheng1
left a comment
Collaborator
There was a problem hiding this comment.
Suggestions here:
-
.github/workflows/ci.yml(line 52)- Issue:
skip-dirslistsmodules/net-lb-app-int-cross-region/recipe-cross-reg-ilb-migandmodules/net-lb-app-int-cross-region/recipe-cross-reg-ilb-psc, neither of which exists in this repository (those directory names are from a newer upstream CFF revision). The only recipe directory undermodules/net-lb-app-int-cross-region/in this repository ismodules/net-lb-app-int-cross-region/recipe-cross-reg-int-app-lb-vm-dns. - Fix: Replace the two non-existent directory paths with
modules/net-lb-app-int-cross-region/recipe-cross-reg-int-app-lb-vm-dns:skip-dirs: 'modules/net-lb-int/recipe-ilb-next-hop,modules/net-lb-app-int-cross-region/recipe-cross-reg-int-app-lb-vm-dns'
- Issue:
-
.github/workflows/ci.yml(lines 41–58)- Issue:
aquasecurity/trivy-actiondefaultsexit-codeto'0'. Withoutexit-code: '1', theRun Trivy vulnerability scanner in repo modestep always exits0even if un-suppressedCRITICALorHIGHvulnerabilities, secrets, or misconfigurations are introduced, and only uploads the SARIF file to GitHub Code Scanning. - Fix: Add
exit-code: '1'to the Trivy step so theSecurity ScansCI job fails when un-ignoredCRITICALorHIGHfindings exist (with.trivyignore.yamlandskip-dirsin place, Trivyv0.76.1reports0CRITICAL/HIGHfindings on this branch, so the job will pass), and addif: always()to theUpload Trivy scan results to GitHub Security tabstep so the SARIF report is still uploaded when Trivy exits non-zero:- name: Run Trivy vulnerability scanner in repo mode uses: aquasecurity/trivy-action@8f28faec26515256b6d22074d1d2a8986f4cbd87 with: scan-type: 'fs' scanners: 'vuln,secret,misconfig' ignore-unfixed: true format: 'sarif' output: 'trivy-results.sarif' severity: 'CRITICAL,HIGH' limit-severities-for-sarif: true exit-code: '1' trivyignores: '.trivyignore.yaml' skip-dirs: 'modules/net-lb-int/recipe-ilb-next-hop,modules/net-lb-app-int-cross-region/recipe-cross-reg-int-app-lb-vm-dns' - name: Upload Trivy scan results to GitHub Security tab if: always() uses: github/codeql-action/upload-sarif@24c54180a607b1449ed407dd24f251e4e9147c8d with: sarif_file: 'trivy-results.sarif'
- Issue:
-
.trivyignore.yaml(lines 46–75)- Issue: Minor accuracy notes on two of the suppression rationales when verified against Trivy
v0.76.1:GCP-0057/AVD-GCP-0057(modules/gke-cluster-standard/main.tfandmodules/gke-cluster-standard-se/main.tf): Trivy's GKE adapter (pkg/iac/adapters/terraform/google/gke/adapt.go) does not inspectworkload_identity_config(workload_pool = "${var.project_id}.svc.id.goog"). Instead,GCP-0057(builtin.google.gke.google0057) flagsgoogle_container_cluster.cluster.node_config(lines 61 and 64) becausenode_config.workload_metadata_config.modeis unset ("UNSPECIFIED") on the cluster's inlinenode_configblock, which is only used for the temporary default node pool (remove_default_node_pool = var.default_nodepool.remove_pool, defaulting totrue) while actual workload node pools are managed viamodules/gke-nodepool.GCP-0043/AVD-GCP-0043(modules/compute-vm/main.tf): In Trivyv0.76.1,GCP-0043only fires whencan_ip_forwardevaluates totrue. Across the repo, the only static caller triggeringGCP-0043onmodules/compute-vm/main.tf:161ismodules/net-lb-int/recipe-ilb-next-hop/gateways.tf(module.gw["b"]andmodule.gw["c"]), which is already excluded byskip-dirs: 'modules/net-lb-int/recipe-ilb-next-hop'(while NVA/NGFW callers infast/stages-aw/2-networking-*usefor_eachmaps that default to{}). KeepingGCP-0043in.trivyignore.yamlas a safeguard is fine, or the comment can note that it protects NVA/NGFW gateway callers when instantiated.
- Fix: Update the
statementdescriptions forGCP-0057/AVD-GCP-0057(and optionallyGCP-0043/AVD-GCP-0043) in.trivyignore.yamlto match Trivy's actual check evaluation.
- Issue: Minor accuracy notes on two of the suppression rationales when verified against Trivy
Member
Author
|
Addressed in 897065b against @Calvin-Cheng1.
Appreciate the review! |
aghassemlouei
force-pushed
the
ci/tune-security-scans
branch
from
October 28, 2026 16:44
64a783e to
897065b
Compare
Calvin-Cheng1
approved these changes
Oct 28, 2026
Merged
digitalresistor
added a commit
to digitalresistor/stellar-engine
that referenced
this pull request
Nov 3, 2026
The rebase onto the Trivy severity filter from google#342 left two skip-dirs keys in the Trivy step of the ci.yml workflow. GitHub Actions rejects a workflow with a duplicate key, so the step lists the recipe directories from google#342 and the vendored tests/fixtures/ directory in one skip-dirs input.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Tunes the repository security scanning configuration to eliminate false-positive alert noise in GitHub Code Scanning:
limit-severities-for-sarif: trueonaquasecurity/trivy-actionin.github/workflows/ci.ymlsotrivy-results.sarifrespectsseverity: 'CRITICAL,HIGH'instead of defaulting to all severities (LOW,MEDIUM,HIGH,CRITICAL).modules/net-lb-int/recipe-ilb-next-hop,modules/net-lb-app-int-cross-region/recipe-cross-reg-ilb-mig,modules/net-lb-app-int-cross-region/recipe-cross-reg-ilb-psc) viaskip-dirs..trivyignore.yaml(trivyignores: '.trivyignore.yaml') with path-scoped rules and documented rationales for architectural false positives (GCP-0007,GCP-0015,GCP-0043,GCP-0057).inchecks incli/tests/test_checks.pyandcli/tests/test_repo.pywith exact string and set comparisons so CodeQLpy/incomplete-url-substring-sanitizationdoes not flag unit test assertions.Type of Change
Deployment & Compliance Impact
Checklist
Code Quality & Reusability
modules/orfast/stages-aw/can be leveraged for this change.docs/naming-convention.md.Documentation
README.mdof the modified module or blueprint.Security
Testing
Testing Performed
bash tools/lint.sh(Boilerplate,terraform fmt,tflint,check_documentation.py,check_links.py,check_names.py,ruff,validate_metadata.py, and version checks).bash tools/run_tests.sh(99 Python unit tests, 49 shell unit tests, 6tflintrunner tests, and 58 Python AST checks).ruff format --check,ruff check,pyright, and 160pytestunit tests incli/).