Skip to content

Keys never live in a repo: an ignore list and a scanner that actually looks - #1

Merged
eugeniosp3 merged 1 commit into
mainfrom
security/keys-out-of-git
Jul 30, 2026
Merged

Keys never live in a repo: an ignore list and a scanner that actually looks#1
eugeniosp3 merged 1 commit into
mainfrom
security/keys-out-of-git

Conversation

@eugeniosp3

Copy link
Copy Markdown
Contributor

Model attribution — written by Claude Opus 5, 2026-07-30, not Fable 5.

Same change, opened on every repo in the org.

Why

On 2026-07-30 a VPN connection profile carrying an unencrypted private key was found committed to the planning repo. It had been there since 2026-07-01 — pushed as a side effect of a folder move, not a decision — readable by five people for 29 days. The entire VPN trust chain was burned the day it was found.

Secret scanning didn't miss it. It never looked. Three separate holes:

Hole Was Now
Wrong repo ran on 3 of 14 repos every repo, public ones included
Wrong trigger pull requests only — that repo pushes straight to main pushes too, every branch
Wrong scope read only a PR's diff weekly run reads the entire history

What this adds

.github/workflows/gitleaks.yml — scans on pull requests, on pushes, weekly over full history, and on demand. Fail-closed: a hit fails the job, and so does a scanner that couldn't run. A scan that can't run must never report success — that's the same trap as a test that passes while measuring nothing.

.gitignore — the credential patterns, as a second layer: VPN profiles, keys and certificates, environment files (.env.example deliberately still allowed), and cloud service-account files.

What this does NOT do

It does not untrack or delete anything already committed. Purely preventive. If this repo already has files matching the patterns, they stay exactly as they are.

Note for infra / lambdas / cf-internal-hub

You already run gitleaks inside review.yml on pull requests. This is additive — it brings the push and full-history coverage that one doesn't have. Slight overlap on pull requests; ~30 seconds, and I'd rather have one identical file across all fourteen repos than fourteen variations.

On a hit

The credential is compromised. Remove it, rotate it — git history keeps the old value — and confirm the ignore list covers it. Rewriting history alone does not make a leaked key safe. Today proved that: the object stayed retrievable from GitHub by hash after the rewrite.

🤖 Generated with Claude Code

… looks

On 2026-07-30 a VPN profile with an unencrypted private key was found in the
planning repo. It had been there since 2026-07-01, readable by five people, and
the whole VPN trust chain had to be burned. Secret scanning did not miss it --
it never looked. Three holes, all closed here:

  wrong repo    - scanning ran on 3 of 14 repos. This goes on every one.
  wrong trigger - it fired on pull requests only, and that repo pushes straight
                  to main. This fires on pushes too, every branch.
  wrong scope   - it read only a pull request's diff. The weekly run reads the
                  ENTIRE history, so anything that slipped in earlier surfaces.

Fail-closed: a hit fails the job, and so does a scanner that could not run. A
scan that cannot run must never report success.

The ignore list is the second layer -- it stops the file being staged at all.
It is preventive only: nothing already committed is untracked or removed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@eugeniosp3
eugeniosp3 merged commit 493657f into main Jul 30, 2026
2 checks passed
@eugeniosp3
eugeniosp3 deleted the security/keys-out-of-git branch July 30, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant