Guides · ← All guides · Published November 14, 2026 · Reviewed November 14, 2026 · Ingenious AI team · 7 min read
Purging Secrets From an Eval Repo's History (Deleting the Line Is Not Enough)
Git remembers what the working tree forgets. A purged line and a live key is the worst of both worlds: the exposure, minus the evidence you still needed.
The short answer: deleting a secret from the current version of an eval file leaves it in every commit that contained it — retrievable by anyone with repo access, forever, in one command. Purging means rewriting the repository's history so the value is unrecoverable from retained commits (or retiring the repository and starting clean), and it is step four of the rotation sequence, after the value has been deactivated at its issuer: purge a dead value thoroughly, never rush to purge a live one while it still works. Sequence first: work from a current free scan and the rotation playbook; this guide covers the history step itself.
What is history purging?
History purging is the removal of content from a version-control repository's retained history — all commits, branches and tags that contain it — rather than from the current file versions alone. Because collaborators hold clones, a true purge also requires the old history to be abandoned everywhere: force-updated remotes, fresh clones, and expiry of the host's cached views where the platform supports it.
Where does a 'deleted' secret actually persist?
In the commit that introduced it and every descendant that carried the file, in other branches that merged it, in tags and release bundles cut from those commits, in the host's pull-request refs and cached diffs, in every clone and fork made while it lived, and in CI artefacts and eval archives that vendored the folder. The git object model is a content-addressed archive: deleting a line creates a new object and leaves the old one untouched and addressable. Anyone who can run one log command against the history can read the 'deleted' value in seconds — which is why scanners and auditors treat history as content, and why EvalEgress's remediations for credential classes say purge from version control history explicitly, not merely 'remove from the file'.
Calibrate the response to the value's state. If the credential has been rotated and deactivated, residual history copies are inert — purge them as hygiene, on a normal schedule, because inert copies still trip scanners, still confuse reviewers, and still become live again in the one scenario nobody plans for: someone reactivating an old key 'to match the repo'. If the credential is still live, history work is secondary to deactivation by a wide margin; a team that spends Friday rewriting history while the key works all weekend has polished the evidence of its own incident.
What does a defensible purge look like?
Inventory first: which values, introduced in which commits, present in which branches and artefacts — the scan findings give you values' locations in the current tree, and history search gives you their full footprint. Then rewrite with the standard tooling (history-filtering tools that replace the value or the file across all refs), force-update the remote, and have every collaborator re-clone rather than pull, because a pull from an old clone reintroduces the objects. Expire the host's caches where the platform offers it, and rebuild or discard artefacts cut from tainted commits. For small eval repos — the common case — the honest alternative deserves naming: retire the repository, export the cleaned tree into a fresh one, and archive the tainted original under restricted access until retention allows destruction. A fresh history is sometimes cheaper than a rewritten one, and always easier to vouch for.
Verify by searching the new history for the value's shape — and by re-scanning the current tree, which is the surface EvalEgress judges. Keep the purge record (values by class, not by value; commits; dates; the deactivation confirmations that preceded it) with the rotation exhibit. The record proves diligence without itself becoming a map to anything sensitive.
Why does this keep being necessary — and how does it stop?
Because eval repos are working folders with a commit habit, and working folders accumulate copies: the config copied in March, the bundle pasted in May, the archive committed 'temporarily' in July. Each lands in history the moment it is committed, before anyone has decided whether it should exist at all. The stopping rule is upstream: secrets never enter the tree (the manager pattern with references only), plus a pre-run scan that treats the current tree as the gate. History purging then becomes what it should be — the tail of a rare rotation, not a recurring chore.
There is a cultural corollary worth stating in the runbook: discovering a secret in history is a process success, not a personal failure to be hidden. Teams that treat it as blameworthy get concealment — quiet deletions that leave live values in history and no record anywhere. Teams that treat it as a findable, fixable, fileable event get rotations. The purge tooling is the easy part; the norm is the control.
Worked example: Emberline Studios, scored end to end
Example. Emberline, a fictional animation studio, 'removed' a staging credential from its eval repo in spring and considered the matter closed. Autumn's first proper scan programme reviewed the current tree (clean) and then, on this guide's logic, searched the history — where the spring value still sat, live, in fourteen commits. The current-tree scan of the repo's working set also showed what had joined since:
| Finding | Class | Severity | Weight |
|---|---|---|---|
| AWS access key ID in a newly added environment file | aws_access_key_id | HIGH | 15 |
| Debug mode enabled in the harness settings | debug_mode_enabled | MEDIUM | 8 |
| Debug route string declared in the viewer config | debug_route | LOW | 3 |
The arithmetic: 15 + 8 + 3 = 26 points of exposure, so the score is 100 − 26 = 74/100, grade C. Scoring uses EvalEgress's published weights — CRITICAL 25, HIGH 15, MEDIUM 8, LOW 3 — with grades at A ≥ 90, B ≥ 75, C ≥ 50 and D ≥ 25.
The studio rotated the spring credential that day — it had never been deactivated — then rewrote the small repo's history (nine contributors re-cloned within the week), fixed the new findings, and re-scanned clean. The post-incident note's central line was about the spring 'removal': the file edit had been the end of the team's attention and the beginning of the exposure's quiet second half. Their runbook now forbids the phrase 'removed the secret' unless it names the deactivation and the history state in the same sentence.
Purge history defensibly: the five actions
Dead values first, then thorough erasure:
- Confirm every value in scope is already deactivated. Purging follows rotation; if any value still works at its issuer, stop and rotate — the weekend rule: live keys outrank tidy history.
- Inventory the full footprint. Introducing commits, branches, tags, bundles and artefacts that carry the values — by class and location, never by transcribing values into the inventory.
- Rewrite or retire the repository. History-filtering across all refs with force-updated remotes and fresh clones for every collaborator — or a clean new repo with the tainted original restricted and scheduled for destruction.
- Expire caches and rebuild artefacts. Host-side cached views and CI artefacts cut from tainted commits get the same treatment as the refs themselves.
- Verify by search and by re-scan, then file the purge record. Search the new history for the shapes, re-scan the tree clean, and record classes, commits and dates beside the rotation exhibit.
History is the long tail of every credential finding. Work it after deactivation, thoroughly — the full sequence lives in the rotation playbook.
Keep checking the boundary
Run the free exposure scan on the files your next eval will run with. Compare plans, read the scoring documentation, and keep reading: what is eval-to-production exposure?, what is egress in AI evaluation?, pre-deployment eval safety checklist, how to stop an AI evaluation from reaching production secrets, isolating an eval environment from production, staging config copied into an eval folder, prompt-injection cases in eval datasets. EvalEgress is one of the Ingenious AI platforms.
Sources
- EvalEgress scoring documentation — the 16 finding classes, severity weights and declared-surface scope every judgement in this guide applies, published 2026.
- What Is Eval-to-Production Exposure? — the companion guide this page builds on, published November 7, 2026.
- The free EvalEgress scan — the declared-file scan this guide's checks are performed with.
Frequently asked questions
If the key is rotated, does history still matter?
As hygiene, yes; as exposure, no. Dead values in history trip scanners, mislead reviewers and invite reactivation mistakes, so purge them — on hygiene's schedule, not incident's.
Can't we just delete the repository?
Deletion of the remote still leaves clones, forks and caches. It can be part of a retire-and-restart approach with collaborator re-clones and restricted archiving of the original — as one option among the purge methods, not as a magic word.
How do I find secrets in history if the current tree is clean?
Search the history for the credential shapes — your own access, your own repo — guided by the scan's class patterns. The classes are published shapes; the same patterns that scan a tree scan a log.
Does the scanner check history for me?
No — EvalEgress scans declared file content, the current tree you paste. History is your git tooling's domain; the scanner's role is to keep the current tree from re-seeding it.
We open-sourced an eval repo with a secret in history. What now?
Rotate immediately and treat the value as public from its first public commit — then purge as hygiene. The response order does not change; the exposure-window review gets wider, because the audience was everyone.