Skip to content

Purge certificates/ and the old SNMP community from git history #10

Closed

Description

@Gerrrt

Encrypted TLS private keys and the old SNMP community are still recoverable from git history even though they are gone from the working tree:

git show 647d90a~1:certificates/Gandalf.Gondor.Lab/ca-key.pem

Requires a force-push to main, which is destructive to existing clones, so it is deliberately left for a human to run.

Runbook: docs/runbooks/purge-git-history.md

Steps

  • make purge-history-dry-run — rewrites a scratch mirror in /tmp and asserts the results; the real repo is untouched
  • make purge-history and force-push main
  • Regenerate the CA and leaf certificates — purging history does not un-leak a key that was published
  • Delete .gitleaksignore; the Secret scan job should stay green on its own merits afterwards
  • Re-clone anywhere the repo already exists — old clones keep the old objects

Notes

The repo had 0 forks when checked, so a purge is actually effective; no third-party copy retains the objects.

.gitleaksignore currently enumerates the known historical findings with a reason for each, which is what keeps CI green today. Removing it is the last step, not the first — it is the proof the purge worked.

Related to #9, but not blocked on it. If you only have time for one, rotate first: rotation invalidates the credential whether or not history is ever rewritten.

Activity

  1. added
    securityA credential, an exposure, or a control that is weaker than recorded
    on Aug 8, 2026
  2. Gerrrt commented on Aug 19, 2026

    @Gerrrt
    OwnerAuthor

    Done — history rewritten and force-pushed

    Re-verified just now rather than from memory:

    certificates/ in full history   0 commits
    .gitleaksignore                 deleted
    gitleaks (full history, no ignore file)   no leaks found
    

    Both literals — the shared SNMP community and the inline Grafana password — are
    absent from every commit and from the worktree. The repository has no forks,
    so this removed public reachability rather than only tidying.

    Two traps worth knowing, both now in the runbook

    The verification can pass having tested nothing. It greps for each entry in
    .purge-secrets.txt, so a literal that never appeared in history reports PASS
    having checked nothing. The Grafana line is GF_SECURITY_ADMIN_PASSWORD=admin,
    with an equals sign; the colon form passes verification and redacts nothing.
    Caught only by reading the rewritten blobs by hand.

    gitleaks matches its own redaction placeholder. community: REDACTED-ROTATED-CREDENTIAL
    still satisfies a rule looking for community:\s*<anything>, so a clean purge
    stayed red on four findings. .gitleaks.toml now allowlists the placeholder —
    without it there is no way to prove the purge worked, which is most of the point.

    Still true, and not fixed by this

    GitHub has not garbage-collected. ade2aef — the pre-rewrite commit — is
    still resolvable through the API, checked again today, and a file was fetched
    from it after the force-push. Unreachable objects linger, and this will not
    clear on its own on any useful timescale. A GitHub Support ticket asking them to
    run GC on the repository is the only lever. Tracking that here would keep an
    issue open on something outside the repository's control, so it is recorded in
    SECURITY.md instead.

    Anything cloned before the rewrite keeps a copy, permanently. A stale clone
    that pushes would reintroduce the removed objects. #33 landed after the rewrite
    and did not, but that was luck rather than a guarantee.

    Which is why rotation was always the real remediation and the purge is tidying.
    The SNMP communities were rotated first (#9), and the CA and leaf certificates
    were replaced afterwards rather than merely purged.

    Local copies of the pre-purge history — the backup bundle and
    .purge-secrets.txt — have been shredded.

    Runbook: docs/runbooks/purge-git-history.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    securityA credential, an exposure, or a control that is weaker than recorded

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions