Skip to content

Commit c448f8f

Browse files
ci(secret-scan): canonical estate scanner caller, key scan (D243) (#102)
## 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 ## Deferred red checks - Deferred: `PR (address)` → #103 - Deferred: `governance / Actions lockfile verify` → #103 - Deferred: `governance / Guix packaging policy (Nix retired)` → #103 - Deferred: `hypatia / Hypatia Neurosymbolic Analysis` → #103 - Deferred: `rust-ci / Cargo audit (security)` → #103 - Deferred: `rust-ci / Cargo check + clippy + fmt` → #103 --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 83f272f commit c448f8f

1 file changed

Lines changed: 11 additions & 66 deletions

File tree

Lines changed: 11 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +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
412

513
on:
614
pull_request:
715
push:
816
branches: [main]
917

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.
1418
concurrency:
1519
group: ${{ github.workflow }}-${{ github.ref }}
1620
cancel-in-progress: true
1721

1822
permissions:
19-
actions: read
2023
contents: read
2124

2225
jobs:
23-
trufflehog:
24-
runs-on: ubuntu-latest
25-
steps:
26-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v4
27-
with:
28-
fetch-depth: 0 # Full history for scanning
29-
30-
- name: TruffleHog Secret Scan
31-
uses: trufflesecurity/trufflehog@4dd8831c5f12599465d4d45c3c447b4018a34c85 # v3
32-
with:
33-
# The v3 action injects --fail automatically on pull_request events.
34-
# Passing --fail here triggers "flag 'fail' cannot be repeated".
35-
extra_args: --only-verified
36-
37-
gitleaks:
38-
runs-on: ubuntu-latest
39-
steps:
40-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v4
41-
with:
42-
fetch-depth: 0
43-
44-
- name: Gitleaks Secret Scan
45-
uses: gitleaks/gitleaks-action@e0c47f4f8be36e29cdc102c57e68cb5cbf0e8d1e # v3.0.0
46-
env:
47-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48-
49-
# Rust-specific: Check for hardcoded crypto values
50-
rust-secrets:
51-
runs-on: ubuntu-latest
52-
steps:
53-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v4
54-
55-
- name: Check for hardcoded secrets in Rust
56-
run: |
57-
if ! find . -name Cargo.toml -not -path './target/*' -print -quit | grep -q .; then
58-
echo 'No Cargo.toml found — skipping Rust secrets check'
59-
exit 0
60-
fi
61-
# Patterns that suggest hardcoded secrets
62-
PATTERNS=(
63-
'const.*SECRET.*=.*"'
64-
'const.*KEY.*=.*"[a-zA-Z0-9]{16,}"'
65-
'const.*TOKEN.*=.*"'
66-
'let.*api_key.*=.*"'
67-
'HMAC.*"[a-fA-F0-9]{32,}"'
68-
'password.*=.*"[^"]+"'
69-
)
70-
71-
found=0
72-
for pattern in "${PATTERNS[@]}"; do
73-
if grep -rn --include="*.rs" -E "$pattern" src/; then
74-
echo "WARNING: Potential hardcoded secret found matching: $pattern"
75-
found=1
76-
fi
77-
done
78-
79-
if [ $found -eq 1 ]; then
80-
echo "::error::Potential hardcoded secrets detected. Use environment variables instead."
81-
exit 1
82-
fi
26+
scan:
27+
uses: hyperpolymath/standards/.github/workflows/secret-scanner-reusable.yml@74d2f66f575246cf6e313ae7775f44df6e097ff2

0 commit comments

Comments
 (0)