Guides · ← All guides · Published November 14, 2026 · Reviewed November 14, 2026 · Ingenious AI team · 7 min read
API Key (sk-) Declared in an Eval Configuration: What to Do
Eval harnesses call model APIs, so provider keys live one paste away from the dataset. When one lands in a declared file, here is the full close-out.
The short answer: rotate the key at the provider, then take it out of the file for good. A string with the sk- shape in a declared eval file is EvalEgress's generic_api_key class (HIGH, weight 15): a service API key of the kind model providers issue. It bills and authenticates as your account, and eval configs are shared, committed and archived with results. Rotate it in the provider's console, load the replacement from a secrets manager or environment variable at runtime, purge the old value from history, and confirm with the free scan that the declared set no longer contains a key-shaped string.
What is a service API key?
A service API key is a bearer credential a platform issues so programs can call its API as your account — model-provider keys with the sk- prefix are the common case in eval work. Possession is authorisation: whoever presents the key spends your quota and acts with your account's permissions on that service. EvalEgress matches the sk- shape as class generic_api_key, HIGH severity, and reports presence, file and line with the value redacted.
How do provider keys end up declared in eval files?
The eval harness is the one program whose whole job is calling the model API, so the key is typed into its config on day one — often by the person in the biggest hurry, often the organisation's main key rather than an eval-dedicated one, because that is the key they had. From there the config does what eval configs do: it is committed with the harness, copied to a second machine, attached to a bug report when a run fails strangely, and archived beside the results it produced.
Two properties make this class worse than it looks. The key usually has no expiry, so time does not heal it. And its usage is metered in money: a leaked provider key is typically discovered through the bill, after it has been spent by whoever found it. An eval folder, whose audience grows with every collaborator and every shared archive, is a poor vault for an unexpiring billing credential.
What does rotating actually involve for a provider key?
Create the replacement first, scoped if the provider allows it — many now offer per-key project limits and spend caps, and an eval key is the ideal candidate for both, because its legitimate spend is predictable run by run. Move the harness to load the new key from the secrets manager or environment at start-up, run one small eval to prove the path, then revoke the exposed key in the provider console. Revocation is the step that matters; the file edit without it is decoration.
Then purge. The old value sits in the config's history and in any archive of the folder; rewrite the history or retire the copies, and note the exposure window — from the commit that introduced the key to the revocation timestamp — in your records. Check the provider's usage logs for that window if the console offers them: unfamiliar usage is the difference between a hygiene fix and an incident, and you cannot know which you have until you look.
How should eval keys be handled so this stops recurring?
Give evals their own key, never the production application's key. The eval key gets its own spend cap, its own line in the usage dashboard, and its own owner; when an eval experiment misbehaves, the cap is the backstop, and when a finding like this one lands, revoking the eval key interrupts an experiment rather than a product. Keep the key in the secrets manager and inject it at runtime — the harness config should name where the key comes from, not contain it.
Finally, let the scan do the remembering. The generic_api_key pattern is mechanical — a key-shaped string in a declared file — so a pre-run scan catches a re-pasted key the same day it happens, while the fix is still one rotation. That is the general bargain of declared-surface scanning: the classes are simple shapes, checked the same way every time, which is what the egress guide means by seeing both sides of the boundary in one report.
Worked example: Alder & Vine Studio, scored end to end
Example. Alder & Vine, a fictional brand studio, evaluated headline-generation models using the studio's main provider key, pasted into the harness config and committed with it. The config also enabled debug mode for a results viewer, and a staging secret assignment sat in the same folder. The scan returned:
| Finding | Class | Severity | Weight |
|---|---|---|---|
| Service API key (sk-) in the harness config | generic_api_key | HIGH | 15 |
| Secret-looking assignment in the staging config | generic_secret_assignment | HIGH | 15 |
| Debug mode enabled in the viewer settings | debug_mode_enabled | MEDIUM | 8 |
The arithmetic: 15 + 15 + 8 = 38 points of exposure, so the score is 100 − 38 = 62/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 created a dedicated eval key with a monthly spend cap, moved it into the secrets manager, and pointed the harness at the manager. Only then did they revoke the main key that had sat in the repo — and found, in the provider's usage view, no unfamiliar calls during the exposure window, which they recorded with the report. Debug went off, the staging assignment was rotated out, and the re-scan reported zero findings. The cap stayed: the team decided an eval key should be able to embarrass them a little, never a lot.
Close a generic_api_key finding: the five actions
Replace, cap, revoke, purge, verify:
- Create a dedicated eval key with a spend cap. Never rotate back into the shared production key; the eval gets its own credential, its own limits and its own usage line.
- Move loading to runtime injection. Secrets manager or environment variable at start-up — the harness config names the source and contains no key-shaped string.
- Revoke the exposed key at the provider. After the new path is proven with a small run. Revocation, not the file edit, is what ends the exposure.
- Purge the old value and review the window. Clean the history and archives, then check provider usage for the period the key sat in the folder and record what you find.
- Re-scan the declared set. Confirm generic_api_key is absent, and keep the scan in the pre-run routine so a re-pasted key is a same-day fix.
A provider key in an eval config is a billing credential in a shared folder. The remedy pattern — rotate, inject, purge, verify — is the same one that closes every credential class; see stopping evals from reaching production secrets.
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, secret assignments in eval configuration files, JWT token declared in an eval environment, wildcard IAM action in an eval role policy. 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
Is an sk- key in a private repo actually exposed?
It is declared in a file that gets copied, archived and pasted into tools as part of eval work, and the key does not expire. The scanner flags the declaration so you can rotate on your schedule instead of the bill's.
Why not just delete the key line and move on?
Because the value remains valid and remains in history. Deletion without revocation leaves a working, billing credential in every earlier commit and copy.
Should the eval use the same key as the production app?
No. A dedicated eval key with its own spend cap limits both the blast radius of a leak and the cost of a runaway experiment, and makes revocation an interruption to an experiment rather than to the product.
What if the key in the file is a fake test value?
The scanner matches shape, not authenticity — deliberately, since it never reads values out. If the string is a documented placeholder, note it in the run records; if there is any doubt, rotate: the cost is minutes.
Does EvalEgress keep the key it matched?
No. The finding reports presence, file, line and class; the value is redacted in every output and never stored.