Guides · ← All guides · Published November 14, 2026 · Reviewed November 14, 2026 · Ingenious AI team · 7 min read
How to Rotate an AWS Secret Access Key Found in Eval Files
Deleting the line is the smallest part of this fix. Rotation, history and the replacement's home are what make the finding stay closed.
The short answer: rotate the key in IAM before you finish editing the file. An AWS secret access key assignment in a declared eval file is EvalEgress's aws_secret_access_key class (HIGH, weight 15): the value matched is the working half of a credential pair, so assume it is known. Create the replacement credential, deactivate and delete the exposed one, purge the assignment from the file and its version-control history, and store the replacement in a secrets manager — injected at runtime, never written back into a declared file. Verify with the free scan that neither this class nor aws_access_key_id appears in the re-scanned set.
What is an AWS secret access key?
An AWS secret access key is the confidential half of an IAM credential pair: a 40-character secret used to sign API requests made with the matching access key ID. Unlike the ID, it is meant to be shown once at creation and never displayed again. EvalEgress matches a secret-key assignment carrying a long encoded value as class aws_secret_access_key, HIGH severity, and redacts the value in every output — the report proves the assignment exists without reproducing it.
Why is rotation a sequence, not a single action?
Because three different audiences hold the old secret. The first is anyone who copied the eval folder while the assignment sat in it — rotation is the only step that reaches them, by making their copy worthless. The second is your own history: the committed versions of the file, which keep the value retrievable long after the current version is cleaned, until the history itself is purged or the repository retired. The third is your future eval runs, which will happily re-import the same config next month unless the replacement lives somewhere other than a file.
Teams that do only the visible step — delete the line, commit, move on — have addressed none of the three. The finding closes on the re-scan and the exposure does not. This is why the scanner's remediation for the class is written as a sequence: rotate the key immediately, purge it from version control history, and inject it via a secrets manager at runtime.
What order do the rotation steps run in?
Create before you destroy, but destroy before you tidy. Issue the replacement credential first and deploy it to the secrets manager, so the workloads using the pair keep working. Update the eval harness to load from the manager. Then deactivate the exposed key in IAM — deactivation is reversible for a short window if something breaks, deletion follows once the new path is proven. Only with the old key dead do you purge files and history, because purging first spends your safest hours on the step that protects you least.
One eval-specific caution: check what else used that pair. A secret copied into an eval folder was usually copied from somewhere — a developer workstation config, a CI variable, a staging server. The rotation must cover the pair everywhere it was the same credential, or the eval folder was merely the place you noticed it. The neighbouring classes in the same report, especially generic_secret_assignment, are the map of where else to look.
How do you stop the replacement becoming next quarter's finding?
The durable change is where eval credentials live. An eval harness should hold no long-term secret at rest: it assumes a role, or it fetches a short-lived value from the secrets manager at start-up, using an identity the platform gives it. Declared files then contain a reference — a role name, a secret path — which matches no credential pattern because it is not a credential.
Make the re-scan part of the run, not an annual event. Configs drift back toward convenience: someone re-adds the assignment to debug a failing run at midnight. A scan wired into the eval folder's review catches the drift while it is one line. The habit is the fifth action of the pre-deployment eval safety checklist, and it is the difference between a rotation and a recurring appointment.
Worked example: Casa Loma Health, scored end to end
Example. Casa Loma Health, a fictional clinic-software firm, evaluated a summarisation model on synthetic discharge notes. The eval harness authenticated to its staging store with a copied credentials block. The scan of the 9 declared files returned:
| Finding | Class | Severity | Weight |
|---|---|---|---|
| AWS secret access key assignment in the harness config | aws_secret_access_key | HIGH | 15 |
| AWS access key ID in the same config block | aws_access_key_id | HIGH | 15 |
| JWT token pasted into the eval environment file | jwt_token | MEDIUM | 8 |
| Debug route string declared in the viewer config | debug_route | LOW | 3 |
The arithmetic: 15 + 15 + 8 + 3 = 41 points of exposure, so the score is 100 − 41 = 59/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 team issued a replacement pair into the secrets manager, switched the harness to fetch it at start-up, then deactivated and deleted the exposed pair in IAM. The pasted JWT was revoked and reissued with a short lifetime, the debug route was removed from the viewer config, and the repository history for the eval folder was rewritten to purge the credentials block. The re-scan reported zero findings — and, more to the point, the folder no longer contained anything worth purging, because the harness now holds a secret path rather than a secret.
Rotate an exposed AWS secret key: the five actions
Create, switch, kill, purge, prevent:
- Issue the replacement into a secrets manager first. The new credential is created and stored before the old one dies, so no workload is stranded mid-rotation.
- Switch the eval harness to runtime loading. The harness fetches the secret at start-up or assumes a role; declared files keep only a reference, never a value.
- Deactivate, then delete, the exposed key in IAM. Deactivation is the step that protects you from existing copies; deletion follows once the new path is proven.
- Purge the assignment from files and history. Current versions, old commits and exported copies of the eval folder all get cleaned — after the key is already dead.
- Re-scan and schedule the drift check. Confirm both AWS classes are absent from the declared set, and add the scan to the eval folder's review so a re-added assignment is caught as one line.
Rotation done in this order takes an afternoon. Rotation done as a file edit takes an afternoon every quarter. The companion class is covered in the guide to the AWS access key ID in eval files.
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, GitHub token in an eval repo, API key declared in an eval configuration, secret assignments in eval configuration files. 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.
- AWS IAM User Guide — IAM JSON policy elements reference — AWS's reference for the Action, Principal and Resource elements these findings are read from, current edition.
Frequently asked questions
I deleted the secret from the file. Why is that not enough?
Copies and history. Anyone who took the folder earlier holds a working secret until it is deactivated in IAM, and the committed history keeps the value retrievable until purged. Deletion is step four of five, not the whole fix.
Should the replacement be a new long-term key?
Prefer a role the eval assumes, or a secrets-manager entry fetched at runtime. A new long-term key written back into a file is the same finding waiting for its next scan.
Does rotating break the evals that used the old key?
Not if you create and deploy the replacement first. The sequence — issue, switch the harness, then deactivate — exists precisely so the workload never depends on the exposed credential again.
How long was the key exposed? Can the scan tell me?
The scan reports where the assignment sits now — file and line. The exposure window comes from your version-control history: when the line entered the repo is when the window opened, and deactivation is when it closed.
What about the JWT that was in the same report?
Same doctrine, smaller blast radius: revoke it, reissue with a short lifetime, and stop storing tokens in declared files. It is the jwt_token class, MEDIUM, and it closes the same way.