Skip to content

Commit f05e055

Browse files
committed
fix(ci): remove invalid job-level hashFiles call from secret-scanner.yml
1 parent 94f783d commit f05e055

1 file changed

Lines changed: 34 additions & 4 deletions

File tree

.github/workflows/secret-scanner.yml

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# SPDX-License-Identifier: PMPL-1.0-or-later
2-
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <jonathan.jewell@open.ac.uk>
1+
# SPDX-License-Identifier: MPL-2.0
32
# Prevention workflow - scans for hardcoded secrets before they reach main
43
name: Secret Scanner
54

@@ -17,10 +16,10 @@ jobs:
1716
steps:
1817
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1918
with:
20-
fetch-depth: 0
19+
fetch-depth: 0 # Full history for scanning
2120

2221
- name: TruffleHog Secret Scan
23-
uses: trufflesecurity/trufflehog@6c05c4a00b91aa542267d8e32a8254774799d68d # v3
22+
uses: trufflesecurity/trufflehog@6961f2bace57ab32b23b3ba40f8f420f6bc7e004 # v3
2423
with:
2524
extra_args: --only-verified --fail
2625

@@ -35,3 +34,34 @@ jobs:
3534
uses: gitleaks/gitleaks-action@ff98106e4c7b2bc287b24eaf42907196329070c7 # v2
3635
env:
3736
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
38+
# Rust-specific: Check for hardcoded crypto values
39+
rust-secrets:
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
43+
44+
- name: Check for hardcoded secrets in Rust
45+
run: |
46+
# Patterns that suggest hardcoded secrets
47+
PATTERNS=(
48+
'const.*SECRET.*=.*"'
49+
'const.*KEY.*=.*"[a-zA-Z0-9]{16,}"'
50+
'const.*TOKEN.*=.*"'
51+
'let.*api_key.*=.*"'
52+
'HMAC.*"[a-fA-F0-9]{32,}"'
53+
'password.*=.*"[^"]+"'
54+
)
55+
56+
found=0
57+
for pattern in "${PATTERNS[@]}"; do
58+
if grep -rn --include="*.rs" -E "$pattern" src/; then
59+
echo "WARNING: Potential hardcoded secret found matching: $pattern"
60+
found=1
61+
fi
62+
done
63+
64+
if [ $found -eq 1 ]; then
65+
echo "::error::Potential hardcoded secrets detected. Use environment variables instead."
66+
exit 1
67+
fi

0 commit comments

Comments
 (0)