Skip to content

Commit 7411027

Browse files
committed
ci: redistribute canonical secret-scanner.yml (concurrency-cancel guard) (Refs hyperpolymath/standards#122)
1 parent f5763b2 commit 7411027

1 file changed

Lines changed: 20 additions & 7 deletions

File tree

.github/workflows/secret-scanner.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-License-Identifier: PMPL-1.0-or-later
1+
# SPDX-License-Identifier: PMPL-1.0
22
# Prevention workflow - scans for hardcoded secrets before they reach main
33
name: Secret Scanner
44

@@ -7,26 +7,36 @@ on:
77
push:
88
branches: [main]
99

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.
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: true
17+
1018
permissions:
1119
contents: read
1220

1321
jobs:
1422
trufflehog:
1523
runs-on: ubuntu-latest
1624
steps:
17-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
25+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
1826
with:
1927
fetch-depth: 0 # Full history for scanning
2028

2129
- name: TruffleHog Secret Scan
22-
uses: trufflesecurity/trufflehog@8a8ef8526528d8a4ff3e2c90be08e25ef8efbd9b # v3
30+
uses: trufflesecurity/trufflehog@6c05c4a00b91aa542267d8e32a8254774799d68d # v3
2331
with:
24-
extra_args: --only-verified --fail
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
2535

2636
gitleaks:
2737
runs-on: ubuntu-latest
2838
steps:
29-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
39+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
3040
with:
3141
fetch-depth: 0
3242

@@ -38,12 +48,15 @@ jobs:
3848
# Rust-specific: Check for hardcoded crypto values
3949
rust-secrets:
4050
runs-on: ubuntu-latest
41-
if: hashFiles('**/Cargo.toml') != ''
4251
steps:
43-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
52+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
4453

4554
- name: Check for hardcoded secrets in Rust
4655
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
4760
# Patterns that suggest hardcoded secrets
4861
PATTERNS=(
4962
'const.*SECRET.*=.*"'

0 commit comments

Comments
 (0)