Uh oh!
There was an error while loading. Please reload this page.
fix(module-ci): exclude terraform-init'd .terraform/ deps from Trivy scan - #14
Merged
Merged
Conversation
raptor's module validation runs terraform init (vendoring remote module dependencies into .terraform/modules/) and then trivy config on the module directory with no --skip-dirs, so HIGH/CRITICAL findings in dependency code the module author never wrote fail CI (e.g. KSV-0041/KSV-0056 against nginx-gateway-fabric's ClusterRole pulled in via facets-utility-modules). Trivy binds every flag to a TRIVY_* env var and raptor runs it as a child process, so exporting TRIVY_SKIP_DIRS on the preview and publish steps scopes the scan to the module's own source without needing a raptor release. Verified with trivy 0.72.0 against a module sourcing facets-utility-modules: baseline reports 4 HIGH/CRITICAL from .terraform/modules/*/nginx_gateway_fabric, with TRIVY_SKIP_DIRS it reports 0, and a seeded misconfiguration in the module's own source is still flagged. Fixes#13 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
Problem
Fixes#13.
module-ci-actioncallsraptor create iac-module, whose validation runsterraform init(vendoring remote module dependencies into.terraform/modules/— Terraform clones the whole source repo per module call) and thentrivy config --severity HIGH,CRITICAL <module dir>with no--skip-dirs. Trivy therefore scans dependency code the module author never wrote and fails CI on findings they cannot fix (e.g.KSV-0041/KSV-0056against thenginx-gateway-fabricClusterRole pulled in transitively viafacets-utility-modules).Fix
Trivy binds every CLI flag to a
TRIVY_*env var, and raptor invokes it as a child process that inherits the step environment. This PR setson the preview and publish steps (the two that run raptor validation), scoping the scan to the module's own source. No raptor release is needed, and it works for any
raptor_version/trivy-version. A root-cause PR adding--skip-dirsto raptor's own Trivy invocation is being raised separately inFacets-cloud/raptor; this env var stays as protection for older pinned raptor versions (the CLI flag will take precedence, with the same value).Verification
Repro per the issue, with Trivy 0.72.0 (the action's pinned default) and a scratch module sourcing
facets-utility-modules//name+//aws_irsa, replicating raptor's exact invocation (trivy config --format json --severity HIGH,CRITICAL --exit-code 0 --quiet .):terraform init -backend=false.terraform/modules/{name,irsa}/nginx_gateway_fabric/charts/...:templates/rbac.yaml(2 checks × 2 vendored copies)TRIVY_SKIP_DIRS='**/.terraform,**/.terraform/**'bad.yamlin the module's own sourceKSV-0014,KSV-0017,KSV-0118) — the skip does not swallow real findingsRelease
After merge: tag
v1.0.1sorelease.ymlmoves thev1alias and consumers pinned to@v1pick this up on their next run.🤖 Generated with Claude Code