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+ # 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.
14+ concurrency :
15+ group : ${{ github.workflow }}-${{ github.ref }}
16+ cancel-in-progress : true
17+
1018permissions :
1119 contents : read
1220
1321jobs :
1422 trufflehog :
1523 runs-on : ubuntu-latest
1624 steps :
17- - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
25+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
1826 with :
1927 fetch-depth : 0 # Full history for scanning
2028
2129 - name : TruffleHog Secret Scan
2230 uses : trufflesecurity/trufflehog@6c05c4a00b91aa542267d8e32a8254774799d68d # v3
2331 with :
24- 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
2535
2636 gitleaks :
2737 runs-on : ubuntu-latest
2838 steps :
29- - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
39+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
3040 with :
3141 fetch-depth : 0
3242
@@ -38,12 +48,15 @@ jobs:
3848 # Rust-specific: Check for hardcoded crypto values
3949 rust-secrets :
4050 runs-on : ubuntu-latest
41- if : hashFiles('**/Cargo.toml') != ''
4251 steps :
43- - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
52+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
4453
4554 - name : Check for hardcoded secrets in Rust
4655 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
4760 # Patterns that suggest hardcoded secrets
4861 PATTERNS=(
4962 'const.*SECRET.*=.*"'
0 commit comments