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
@@ -15,25 +15,28 @@ concurrency:
1515 group : ${{ github.workflow }}-${{ github.ref }}
1616 cancel-in-progress : true
1717
18- permissions : read-all
18+ permissions :
19+ contents : read
1920
2021jobs :
2122 trufflehog :
2223 runs-on : ubuntu-latest
2324 steps :
24- - uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4
25+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
2526 with :
2627 fetch-depth : 0 # Full history for scanning
2728
2829 - name : TruffleHog Secret Scan
29- uses : trufflesecurity/trufflehog@116e7171542d2f1dad8810f00dcfacbe0b809183 # v3
30+ uses : trufflesecurity/trufflehog@6c05c4a00b91aa542267d8e32a8254774799d68d # v3
3031 with :
31- 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
3235
3336 gitleaks :
3437 runs-on : ubuntu-latest
3538 steps :
36- - uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4
39+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
3740 with :
3841 fetch-depth : 0
3942
@@ -45,12 +48,15 @@ jobs:
4548 # Rust-specific: Check for hardcoded crypto values
4649 rust-secrets :
4750 runs-on : ubuntu-latest
48- if : hashFiles('**/Cargo.toml') != ''
4951 steps :
50- - uses : actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4
52+ - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
5153
5254 - name : Check for hardcoded secrets in Rust
5355 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
5460 # Patterns that suggest hardcoded secrets
5561 PATTERNS=(
5662 'const.*SECRET.*=.*"'
0 commit comments