Skip to content

Add secret-scan: git history secret sweep tooling - #107

Draft
longshuicy wants to merge 1 commit into
masterfrom
secret-history-scan
Draft

longshuicy wants to merge 1 commit into
masterfrom
secret-history-scan

Conversation

@longshuicy

Copy link
Copy Markdown
Member

Part of the history secret sweep in #48.

Adds a secret-scan/ folder with the script used for the one-time sweep across the org, plus a README.

Why

GitHub's secret scanning is enabled on the public repos and it does backfill full history when you turn it on — that coverage is real. But it leaves two gaps:

  • Private repos aren't covered. The org is on the free plan; private-repo secret scanning needs the paid Secret Protection add-on. That's 9 of our 29 repos.
  • Only ~200 partner patterns are matched. GitHub won't flag a hardcoded DB password, a Keycloak client secret, a connection string with inline credentials, or a committed .pem — which is most of our realistic exposure.

So this runs gitleaks + trufflehog over full history to cover the rest.

Notes for reviewers

  • Scans mirror clones on purpose — a normal clone misses commits only reachable from deleted branches, which is where forgotten secrets survive.
  • TruffleHog can't read bare/mirror repos (it stats for .git and an index). Each mirror is materialised as a temporary git clone --shared working clone; objects are shared via alternates so history isn't duplicated, and I verified a secret planted on a non-checked-out branch is still found.
  • Live verification is opt-in (VERIFY=1), off by default. It's what makes results triageable, but it exercises any real key found against AWS/GitHub/Slack/etc. from the machine running the scan, where live hits may surface in the provider's audit log. That felt like it should be a deliberate choice rather than the default.
  • .gitignore excludes sweep/ and reports/ — raw scan output contains unredacted secrets. The compiled report.md redacts to first/last four chars so it's safe to paste into an issue.

Status of the actual sweep

Draft because the triage isn't finished. Current raw counts across 29 repos: 88 gitleaks, 378 trufflehog — both pre-triage and expected to be mostly UUIDs, hashes, and lockfile digests. The 9 private repos, which had no coverage at all, came back clean apart from two DataWolf parameter UUIDs that are false positives.

I'll post the triaged results in #48.

🤖 Generated with Claude Code

Adds a script that sweeps the full git history of every IN-CORE repo with
gitleaks and trufflehog and compiles a redacted report.

Covers the two gaps in GitHub's own secret scanning: private repos (not
available on the org's free plan, currently 9 of 29 repos) and credentials
that don't match GitHub's ~200 partner patterns — DB passwords, Keycloak
client secrets, connection strings, committed .pem files.

Scans mirror clones so commits reachable only from deleted branches are
included. TruffleHog can't read bare repos, so each is materialised as a
temporary --shared working clone; objects are shared via alternates, and
refs from every branch stay visible.

Live credential verification is opt-in via VERIFY=1 and off by default,
since it exercises any real key found against the provider's API.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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