1- # SPDX-License-Identifier: PMPL-1.0-or-later
1+ # SPDX-License-Identifier: PMPL-1.0
22# Prevention workflow - scans for hardcoded secrets before they reach main
33name : Secret Scanner
44
77 push :
88 branches : [main]
99
10- # Cause-B mitigation (#77): cancel superseded runs so stacked pushes
11- # to the same ref don't pile up identical jobs in the queue.
10+ # Estate guardrail: cancel superseded runs so re-pushes / rebased PR
11+ # updates do not pile up queued runs against the shared account-wide
12+ # Actions concurrency pool. Applied only to read-only check workflows
13+ # (no publish/mutation), so cancelling a superseded run is always safe.
1214concurrency :
1315 group : ${{ github.workflow }}-${{ github.ref }}
1416 cancel-in-progress : true
@@ -20,19 +22,21 @@ jobs:
2022 trufflehog :
2123 runs-on : ubuntu-latest
2224 steps :
23- - uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
25+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
2426 with :
2527 fetch-depth : 0 # Full history for scanning
2628
2729 - name : TruffleHog Secret Scan
28- uses : trufflesecurity/trufflehog@8a8ef8526528d8a4ff3e2c90be08e25ef8efbd9b # v3
30+ uses : trufflesecurity/trufflehog@6c05c4a00b91aa542267d8e32a8254774799d68d # v3
2931 with :
30- extra_args : --only-verified --fail
32+ # The v3 action injects --fail automatically on pull_request events.
33+ # Passing --fail here triggers "flag 'fail' cannot be repeated".
34+ extra_args : --only-verified
3135
3236 gitleaks :
3337 runs-on : ubuntu-latest
3438 steps :
35- - uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
39+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
3640 with :
3741 fetch-depth : 0
3842
@@ -45,21 +49,14 @@ jobs:
4549 rust-secrets :
4650 runs-on : ubuntu-latest
4751 steps :
48- - uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
49-
50- - name : Detect Rust sources
51- id : detect
52- run : |
53- if find . -name Cargo.toml -print -quit | grep -q .; then
54- echo "present=true" >> "$GITHUB_OUTPUT"
55- else
56- echo "present=false" >> "$GITHUB_OUTPUT"
57- echo "No Cargo.toml — skipping Rust secret heuristics." >> "$GITHUB_STEP_SUMMARY"
58- fi
52+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
5953
6054 - name : Check for hardcoded secrets in Rust
61- if : steps.detect.outputs.present == 'true'
6255 run : |
56+ if ! find . -name Cargo.toml -not -path './target/*' -print -quit | grep -q .; then
57+ echo 'No Cargo.toml found — skipping Rust secrets check'
58+ exit 0
59+ fi
6360 # Patterns that suggest hardcoded secrets
6461 PATTERNS=(
6562 'const.*SECRET.*=.*"'
0 commit comments