gitleaks action; trivy-gate scanners input, misconfigurations reported (never blocking)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7fae1fa2f6
commit
95abc7822e
3 files changed
+171
-1
No files matched your search
+17
-1
@@ -15,6 +15,11 @@ inputs:
|
||||
scan-ref:
|
||||
description: Directory for scan-type fs (git-tracked files plus untracked lockfiles).
|
||||
default: .
|
||||
scanners:
|
||||
description: >
|
||||
Trivy scanners. vuln and secret findings block (per mode); misconfig
|
||||
(Dockerfile, compose, k8s, ...) is only reported, never blocks.
|
||||
default: vuln,secret
|
||||
runtime:
|
||||
description: >
|
||||
auto = Trivy container when a Docker daemon is reachable, else the
|
||||
@@ -71,6 +76,7 @@ runs:
|
||||
SCAN_TYPE: ${{ inputs.scan-type }}
|
||||
SCAN_REF: ${{ inputs.scan-ref }}
|
||||
RUNTIME: ${{ inputs.runtime }}
|
||||
SCANNERS: ${{ inputs.scanners }}
|
||||
TRIVY_VERSION: "0.75.0"
|
||||
TRIVY_SHA256_AMD64: c6e65abddb348e25f10549df887045629cf28cc72453cd1c63acb717316b3f3f
|
||||
TRIVY_SHA256_ARM64: a1ee9f6ffb7d112b64ff726a2a0717c21175c1114361391f4a132956751a13b3
|
||||
@@ -108,7 +114,7 @@ runs:
|
||||
|| { echo "::error::jq is required"; exit 1; }
|
||||
fi
|
||||
|
||||
common="--skip-java-db-update --scanners vuln,secret --list-all-pkgs --format json --quiet"
|
||||
common="--skip-java-db-update --scanners $SCANNERS --list-all-pkgs --format json --quiet"
|
||||
ignore_args=""
|
||||
if [ -n "$IGNOREFILE" ] && [ -f "$IGNOREFILE" ]; then
|
||||
echo "ignore file: $IGNOREFILE ($(grep -c -- '- id:' "$IGNOREFILE" || true) entries)"
|
||||
@@ -196,6 +202,16 @@ runs:
|
||||
{ printf 'SECRET\tRULE\tTITLE\tFILE\tLINE\n'; cat "$work/secrets.tsv"; } | table
|
||||
fi
|
||||
|
||||
# Misconfigurations: reported, never blocking.
|
||||
jq -r --argjson sev "$sev_json" '[.Results[]? | .Target as $t | .Misconfigurations[]?
|
||||
| select(.Status == "FAIL" and (.Severity as $x | $sev | index($x)))
|
||||
| [.Severity, .ID, .Title, $t]] | unique | .[] | @tsv' "$report" >"$work/misconf.tsv"
|
||||
nm=$(wc -l <"$work/misconf.tsv")
|
||||
if [ "$nm" -gt 0 ]; then
|
||||
echo "::warning::Trivy config: $nm $SEVERITY misconfigurations in $target (not blocking)"
|
||||
{ printf 'SEVERITY\tID\tTITLE\tFILE\n'; cat "$work/misconf.tsv"; } | table
|
||||
fi
|
||||
|
||||
blocking=$((nv + ns))
|
||||
echo "report=$report" >>"$GITHUB_OUTPUT"
|
||||
echo "blocking=$blocking" >>"$GITHUB_OUTPUT"
|
||||
|
||||
Reference in new issue
Block a user