Skip to content

Commit 1274eb4

Browse files
ci(secret-scan): canonical estate scanner caller, key scan (D243)
Secret-Scan-Floor (D243/D244) requires the context `scan / gitleaks` estate-wide. The previous inline scanner jobs emitted bare contexts (e.g. `gitleaks`) that cannot satisfy the floor; the reusable deliberately drops TruffleHog as redundant with gitleaks. Write the canonical caller: job key `scan`, reusable pinned to standards@74d2f66, push trigger on the default branch `main`. actionlint: new file clean (findings in previous file: 0). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0136eszqrQ53Kj7aBH1D4rXK
1 parent 29850e4 commit 1274eb4

1 file changed

Lines changed: 15 additions & 67 deletions

File tree

Lines changed: 15 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,27 @@
11
# SPDX-License-Identifier: MPL-2.0
2-
# Prevention workflow - scans for hardcoded secrets before they reach main
2+
# Prevention workflow - scans for hardcoded secrets before they reach main.
3+
#
4+
# Calls the estate's shared secret scanner (gitleaks + rust-secrets +
5+
# shell-secrets). The job key MUST stay `scan`: the estate-wide
6+
# Secret-Scan-Floor ruleset requires the check context `scan / gitleaks`.
7+
#
8+
# `secrets: inherit` is REQUIRED - without it the gitleaks action's inner
9+
# secrets.GITHUB_TOKEN is empty and the scan silently degrades.
310
name: Secret Scanner
11+
412
on:
513
pull_request:
614
push:
715
branches: [main]
8-
# Estate guardrail: cancel superseded runs so re-pushes / rebased PR
9-
# updates do not pile up queued runs against the shared account-wide
10-
# Actions concurrency pool. Applied only to read-only check workflows
11-
# (no publish/mutation), so cancelling a superseded run is always safe.
16+
1217
concurrency:
1318
group: ${{ github.workflow }}-${{ github.ref }}
1419
cancel-in-progress: true
20+
1521
permissions:
1622
contents: read
17-
jobs:
18-
trufflehog:
19-
runs-on: ubuntu-latest
20-
timeout-minutes: 15
21-
steps:
22-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v4
23-
with:
24-
fetch-depth: 0 # Full history for scanning
25-
- name: TruffleHog Secret Scan
26-
uses: trufflesecurity/trufflehog@a5f3de55cc2065ae4dde8fee24076f137fd62fcf # v3
27-
with:
28-
# The v3 action injects --fail automatically on pull_request events.
29-
# Passing --fail here triggers "flag 'fail' cannot be repeated".
30-
extra_args: --only-verified
31-
32-
gitleaks:
33-
runs-on: ubuntu-latest
34-
timeout-minutes: 15
35-
steps:
36-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v4
37-
with:
38-
fetch-depth: 0
3923

40-
- name: Gitleaks Secret Scan
41-
uses: gitleaks/gitleaks-action@e0c47f4f8be36e29cdc102c57e68cb5cbf0e8d1e # v3.0.0
42-
env:
43-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44-
45-
# Rust-specific: Check for hardcoded crypto values
46-
rust-secrets:
47-
runs-on: ubuntu-latest
48-
timeout-minutes: 15
49-
steps:
50-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v4
51-
52-
- name: Check for hardcoded secrets in Rust
53-
run: |
54-
if ! find . -name Cargo.toml -not -path './target/*' -print -quit | grep -q .; then
55-
echo 'No Cargo.toml found — skipping Rust secrets check'
56-
exit 0
57-
fi
58-
# Patterns that suggest hardcoded secrets
59-
PATTERNS=(
60-
'const.*SECRET.*=.*"'
61-
'const.*KEY.*=.*"[a-zA-Z0-9]{16,}"'
62-
'const.*TOKEN.*=.*"'
63-
'let.*api_key.*=.*"'
64-
'HMAC.*"[a-fA-F0-9]{32,}"'
65-
'password.*=.*"[^"]+"'
66-
)
67-
68-
found=0
69-
for pattern in "${PATTERNS[@]}"; do
70-
if grep -rn --include="*.rs" -E "$pattern" src/; then
71-
echo "WARNING: Potential hardcoded secret found matching: $pattern"
72-
found=1
73-
fi
74-
done
75-
76-
if [ $found -eq 1 ]; then
77-
echo "::error::Potential hardcoded secrets detected. Use environment variables instead."
78-
exit 1
79-
fi
24+
jobs:
25+
scan:
26+
uses: hyperpolymath/standards/.github/workflows/secret-scanner-reusable.yml@74d2f66f575246cf6e313ae7775f44df6e097ff2
27+
secrets: inherit

0 commit comments

Comments
 (0)