Repository navigation
62 lines (60 loc) · 2.78 KB
/
Copy pathgitleaks.yml
File metadata and controls
62 lines (60 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: gitleaks
# Secret scanning for this private repo (no GitHub Advanced Security on private repos).
# Fails the build if a secret is committed. Part of secret-hygiene 2026-07-15.
on:
push:
branches: ['**']
pull_request:
workflow_dispatch:
jobs:
gitleaks:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Run gitleaks
uses: gitleaks/gitleaks-action@v3
env:
# Required by gitleaks-action@v2 to scan pull_request events
# (without it the job hard-fails before scanning anything).
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITLEAKS_ENABLE_UPLOAD_ARTIFACT: 'false'
GITLEAKS_ENABLE_SUMMARY: 'true'
# ---------------------------------------------------------------------------
# The job above scans the COMMITS IN THIS PUSH/PR RANGE. That is the correct
# gate for new secrets and it is blind to old ones: a secret committed before
# this workflow existed sits in HEAD forever, and every subsequent PR reports
# a clean scan — several logged "0 commits scanned" and passed.
#
# Found exactly that way on 2026-08-03: a funded Base Sepolia private key and a
# live engine API key had been sitting in a tracked `.claude/settings.local.json`
# for weeks, inside `permissions.allow` strings, with every gitleaks check green.
#
# So this second job scans the CHECKED-OUT TREE with no git history at all. It
# answers a different question — "is there a secret in the repo right now?" —
# and it is the one that catches resident secrets rather than incoming ones.
# ---------------------------------------------------------------------------
resident-secrets:
name: resident-secrets
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v7
- name: Scan the working tree, not the diff
run: |
curl -sSL -o /tmp/gitleaks.tar.gz \
https://github.com/gitleaks/gitleaks/releases/download/v8.28.0/gitleaks_8.28.0_linux_x64.tar.gz
tar -xzf /tmp/gitleaks.tar.gz -C /tmp gitleaks
# --no-git: treat the checkout as plain files, so a secret that has been
# resident for months is seen. --exit-code 0 because the RATCHET below is
# the gate, not the raw count: the tree has 27 pre-existing findings (x402
# test fixtures / EIP-712 constants) and a hard fail would go red on day
# one and be switched off within a week.
/tmp/gitleaks detect --no-git --source . --redact -f json -r /tmp/leaks.json --exit-code 0
- name: Ratchet — fail on any finding outside the recorded baseline
run: node scripts/ci/resident-secret-gate.js /tmp/leaks.json