Skip to content

Commit 421accf

Browse files
ci(secret-scan): canonical estate scanner caller, key scan (D243) (#83)
## What Write the canonical estate secret-scanner caller to `.github/workflows/secret-scanner.yml` so this repo emits `scan / gitleaks`, the context the estate Secret-Scan-Floor ruleset (D243/D244) requires. 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. Job key `scan`; reusable `hyperpolymath/standards/.github/workflows/secret-scanner-reusable.yml@74d2f66f575246cf6e313ae7775f44df6e097ff2`; push trigger on `main`. actionlint clean (previous file findings: 0). Commit via GraphQL `createCommitOnBranch` (GitHub-signed, valid: true). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_0136eszqrQ53Kj7aBH1D4rXK --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 29850e4 commit 421accf

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+
# No `secrets:` line, deliberately: the reusable references no secrets
9+
# (gitleaks runs as a checksum-verified binary, not gitleaks-action), so
10+
# `secrets: inherit` would only hand it every repo and org secret (CWE-250).
311
name: Secret Scanner
12+
413
on:
514
pull_request:
615
push:
716
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.
17+
1218
concurrency:
1319
group: ${{ github.workflow }}-${{ github.ref }}
1420
cancel-in-progress: true
21+
1522
permissions:
1623
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
3924

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
25+
jobs:
26+
scan:
27+
uses: hyperpolymath/standards/.github/workflows/secret-scanner-reusable.yml@74d2f66f575246cf6e313ae7775f44df6e097ff2

0 commit comments

Comments
 (0)