Skip to content

Commit d301250

Browse files
committed
ci: add gitleaks secret-scan (SCM-SECRETSCAN-001)
1 parent ae275b4 commit d301250

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

.github/workflows/secret-scan.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: secret-scan
2+
# Detects committed secrets with the gitleaks BINARY (free; no org license needed — the gitleaks Action
3+
# requires a paid license for organizations, the binary does not). --redact guarantees no secret VALUE is ever
4+
# printed in logs. Added by the compliance hardening pass as the plan-independent substitute for GitHub's
5+
# native secret scanning, which is a paid add-on on private repos. A failing run means a real secret is
6+
# committed: rotate it and purge it from history.
7+
on:
8+
pull_request:
9+
push:
10+
branches: ["main"]
11+
schedule:
12+
- cron: "0 6 * * 1"
13+
workflow_dispatch:
14+
permissions:
15+
contents: read
16+
jobs:
17+
gitleaks:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
- name: Run gitleaks (redacted)
24+
run: |
25+
set -euo pipefail
26+
ver="$(curl -sSL https://api.github.com/repos/gitleaks/gitleaks/releases/latest \
27+
| grep -oP '"tag_name": *"v\K[^"]+')"
28+
curl -sSL "https://github.com/gitleaks/gitleaks/releases/download/v${ver}/gitleaks_${ver}_linux_x64.tar.gz" \
29+
| tar -xz gitleaks
30+
./gitleaks detect --source . --redact --no-banner --exit-code 1

0 commit comments

Comments
 (0)