Guides · ← All guides · Published November 13, 2026 · Reviewed November 13, 2026 · Ingenious AI team · 7 min read
How to Stop an AI Evaluation From Reaching Production Secrets
Live keys in eval files, wildcard IAM and open network paths are one copied config away from production. Here is how that path forms, how it scores, and the five actions that close it.
The short answer: The eval does not reach for production secrets on its own; the files it runs with hand them over. an evaluation reaches production secrets through the files it runs with, so stop it in those files: rotate and remove every live credential declared in eval configs, scope IAM to the exact APIs the eval calls — no wildcards, no admin policies — restrict 0.0.0.0/0 ingress, bind eval services to localhost or the private network, keep results storage private, and turn debug off. Then prove it by scanning the declared files: every step maps to one of EvalEgress's 16 exposure classes, so the free scan checks the fix mechanically (reviewed November 2026).
How production secrets end up in eval files
Evaluations need realistic setups, so teams copy the application's real configuration into the eval folder: environment files, cloud credentials, service keys, infra definitions. The copy is meant to be trimmed later. Until it is, whatever it declares is what the eval agent runs with — and eval agents execute tools, read files and follow instructions found in eval data, so a credential in the folder is a credential in reach.
EvalEgress flags the credential declarations directly. A private key block is private_key_block (CRITICAL, weight 25). AWS access key IDs and secret keys are aws_access_key_id and aws_secret_access_key (HIGH, 15 each), alongside GitHub tokens (github_token), generic API keys (generic_api_key) and secret-looking assignments such as passwords and client secrets (generic_secret_assignment), all HIGH. JWT material pasted into a config is jwt_token (MEDIUM, 8). For every one of these the report shows presence, file and line only — the value itself is redacted and never stored or displayed.
The fix is the same for all of them: a key that has sat in an eval file is treated as exposed. Rotate it, remove it from the file and from version-control history, and load the replacement from a secrets manager or environment variable at runtime.
IAM decides what a reached secret can do
A credential by itself is only half of the path. The other half is the permission set attached to the identity the eval runs as. An eval-scoped key on a tightly scoped role can do eval-scoped damage; the same key on a permissive role can reach across the account.
The scanner reads those declarations too. An admin-level managed policy — AdministratorAccess or PowerUserAccess — is admin_managed_policy (CRITICAL, 25), and a policy principal of * is wildcard_principal (CRITICAL, 25): combined with an Allow effect, that can expose the resource to anyone. One step down, "Action": "*" is wildcard_iam_action and a service-wide wildcard such as "s3:*" is wildcard_iam_service (both HIGH, 15). Scoping means naming the exact APIs the eval calls and the exact resources it touches — nothing with a star in it survives the review.
Network declarations decide who can reach the eval
The third side of the path is reachability. An eval harness is a running service with prompts, responses and tool access flowing through it, and ordinary copied config quietly makes it a public one.
An ingress rule open to 0.0.0.0/0 is open_ingress (HIGH, 15) — restrict the CIDR to the networks that actually run evals. A public-read ACL on results storage is public_bucket_acl (HIGH, 15): eval outputs become a readable archive of prompts, responses and whatever data they carried, so results buckets stay private and exports are shared deliberately. A harness or results viewer bound to 0.0.0.0 — all interfaces — is open_binding (MEDIUM, 8); bind to localhost or a specific private interface unless external access is genuinely required. The network side of the boundary is covered in depth in what is egress in AI evaluation?
The debug surface widens the opening
Debug tooling is the quiet fourth side. Debug mode left enabled in a declared config is debug_mode_enabled (MEDIUM, 8) — debug endpoints and verbose errors leak internals to whoever can reach the service. A declared debug or admin route string — /debug, /console, adminer, phpmyadmin — is debug_route (LOW, 3): low weight, but it tells an attacker exactly where the interesting doors are. Turn debug off in anything reachable beyond localhost, and remove or gate debug tooling behind authentication.
Worked example: one staging eval, scored end to end
Example. A fictional team copies its payment service's staging configuration into an eval folder before a production-connected run. The declared config contains three exposures: one live payment key (a generic_api_key match), one wildcard IAM policy ("Action": "*"), and one ingress rule open to 0.0.0.0/0. Scored with EvalEgress's published weights — CRITICAL 25, HIGH 15, MEDIUM 8, LOW 3 — the scanner reports four findings:
| Finding | Class | Severity | Weight |
|---|---|---|---|
| Live payment key declared in the eval config | generic_api_key | HIGH | 15 |
Wildcard IAM action ("Action": "*") | wildcard_iam_action | HIGH | 15 |
| Ingress open to 0.0.0.0/0 | open_ingress | HIGH | 15 |
| The 0.0.0.0 in that same line also matches the all-interface pattern | open_binding | MEDIUM | 8 |
The arithmetic: 15 + 15 + 15 + 8 = 53 points of exposure, so the score is 100 − 53 = 47/100, grade D. One line earns two findings because the scanner flags the open ingress rule and the all-interface address it is written with — both are in the report, so both are in the score.
Now the same team applies the fixes: the payment key is rotated and loaded from a secrets manager at runtime, so no key is declared in the file at all; the wildcard action is replaced with the single API the eval actually calls, on the staging results bucket only; and the ingress rule is restricted to the one address that runs the evals. A re-scan of the fixed config reports zero findings — 100 − 0 = 100/100, grade A. Nothing about the eval itself changed; only what its files declare.
Stop it: the five actions
- Rotate and remove every live credential in the declared eval files. Private keys, cloud keys, tokens and secret assignments are treated as exposed the moment they sit in an eval file: rotate them, purge them from the files and their history, and load replacements from a secrets manager or environment variable at runtime.
- Scope IAM to the exact APIs the eval calls. Replace
"Action": "*"and service-wide wildcards with named actions, remove AdministratorAccess and PowerUserAccess from the eval path, and restrict policy principals to the exact ARNs that need access. - Close the network paths. Restrict 0.0.0.0/0 ingress to the networks that run evals, bind the harness and results viewers to localhost or the private network, and keep results storage private — no public-read ACLs.
- Turn the debug surface off. Disable debug mode in the eval configuration, and remove debug or admin routes or gate them behind authentication before anything production-connected runs.
- Scan the declared files before the run, and again on every config change. Paste the files the eval runs with into the free exposure scan, fix CRITICAL and HIGH findings first, and keep the report with the eval run's records — exposure returns as copied files, so the re-scan is what catches the copy.
A clean scan is a statement about the declared files, not a guarantee about the whole system: the scanner reads declared surfaces only, finds exposure, and never proves exploitability — it cannot see private infrastructure. What a clean scan does prove is that the files the eval runs with no longer hand it the keys, the permissions and the network path at the same time. For the full picture, read what is eval-to-production exposure? and run the pre-deployment eval safety checklist before the first production-connected run. The scoring behind every class is documented on /docs. 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
Can an AI evaluation really reach production secrets?
Yes — through the files it runs with. If a declared eval config contains a live credential, a wildcard policy and an open network path, the eval agent runs holding all three, and so does anything that steers or compromises it. The exposure is in the declarations; you do not need to prove anyone would use it for it to be worth removing.
What should I remove first?
Live credentials, starting with the CRITICAL class: a private key block. Then the other secret-like patterns — cloud keys, tokens and secret assignments — rotating each one as it comes out, because a key that sat in an eval file is treated as exposed. After credentials, scope the IAM wildcards and admin policies that decide what a reached key can do.
Is a staging or test key safe to leave in an eval file?
No. The scanner flags secret-like patterns by presence, and staging configs are exactly where production-reachable credentials turn up — copied from the real setup and trimmed later, or never. Rotate any live key found in a declared file and load it from a secrets store instead; even a genuinely eval-scoped key belongs there, not in the repo.
Are the secret values in my files stored or shown?
Never. Secret-like findings report presence, file, line and pattern class only; the values are redacted in every output and are never stored or displayed.
Does EvalEgress connect to my production systems or prove an eval can be exploited?
No. You paste declared files or config text and the scanner reads only what you declare — no live systems are touched. It finds exposure in those declarations; it never proves exploitability and cannot see private infrastructure, and the report states that scope on its face.