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
2129 - name : TruffleHog Secret Scan
2230 uses : trufflesecurity/trufflehog@6c05c4a00b91aa542267d8e32a8254774799d68d # v3
2331 with :
32+ # The v3 action injects --fail automatically on pull_request events.
33+ # Passing --fail here triggers "flag 'fail' cannot be repeated".
2434 extra_args : --only-verified
2535
2636 gitleaks :
@@ -43,12 +53,10 @@ jobs:
4353
4454 - name : Check for hardcoded secrets in Rust
4555 run : |
46- # Skip if no Rust files
47- if ! find . -name "Cargo.toml" -print -quit | grep -q .; then
48- echo "No Cargo.toml found, skipping Rust secret scan"
56+ if ! find . -name Cargo.toml -not -path './target/*' -print -quit | grep -q .; then
57+ echo 'No Cargo.toml found — skipping Rust secrets check'
4958 exit 0
5059 fi
51-
5260 # Patterns that suggest hardcoded secrets
5361 PATTERNS=(
5462 'const.*SECRET.*=.*"'
7179 echo "::error::Potential hardcoded secrets detected. Use environment variables instead."
7280 exit 1
7381 fi
74-
75- - name : K9-SVC Validation
76- run : |
77- echo "K9-SVC validation"
78- [ -d .machine_readable/contractiles ] && echo "Contractiles present" || echo "No contractiles"
0 commit comments