11# SPDX-License-Identifier: PMPL-1.0-or-later
2- # Prevention workflow - scans for hardcoded secrets before they reach main
32name : Secret Scanner
43
54on :
65 pull_request :
76 push :
87 branches : [main]
98
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.
149concurrency :
1510 group : ${{ github.workflow }}-${{ github.ref }}
1611 cancel-in-progress : true
@@ -19,63 +14,6 @@ permissions:
1914 contents : read
2015
2116jobs :
22- trufflehog :
23- runs-on : ubuntu-latest
24- steps :
25- - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
26- with :
27- fetch-depth : 0 # Full history for scanning
28-
29- - name : TruffleHog Secret Scan
30- uses : trufflesecurity/trufflehog@6c05c4a00b91aa542267d8e32a8254774799d68d # v3
31- with :
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
35-
36- gitleaks :
37- runs-on : ubuntu-latest
38- steps :
39- - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
40- with :
41- fetch-depth : 0
42-
43- - name : Gitleaks Secret Scan
44- uses : gitleaks/gitleaks-action@ff98106e4c7b2bc287b24eaf42907196329070c7 # v2
45- env :
46- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
47-
48- # Rust-specific: Check for hardcoded crypto values
49- rust-secrets :
50- runs-on : ubuntu-latest
51- steps :
52- - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
53-
54- - name : Check for hardcoded secrets in Rust
55- 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
60- # Patterns that suggest hardcoded secrets
61- PATTERNS=(
62- 'const.*SECRET.*=.*"'
63- 'const.*KEY.*=.*"[a-zA-Z0-9]{16,}"'
64- 'const.*TOKEN.*=.*"'
65- 'let.*api_key.*=.*"'
66- 'HMAC.*"[a-fA-F0-9]{32,}"'
67- 'password.*=.*"[^"]+"'
68- )
69-
70- found=0
71- for pattern in "${PATTERNS[@]}"; do
72- if grep -rn --include="*.rs" -E "$pattern" src/; then
73- echo "WARNING: Potential hardcoded secret found matching: $pattern"
74- found=1
75- fi
76- done
77-
78- if [ $found -eq 1 ]; then
79- echo "::error::Potential hardcoded secrets detected. Use environment variables instead."
80- exit 1
81- fi
17+ scan :
18+ uses : hyperpolymath/standards/.github/workflows/secret-scanner-reusable.yml@3e4bd4c93911750727e2e4c66dff859e00079da0
19+ secrets : inherit
0 commit comments