Guides · ← All guides · Published November 14, 2026 · Reviewed November 14, 2026 · Ingenious AI team · 7 min read
JWT Token Declared in an Eval Environment File: Risks and Fixes
A JWT is a signed statement that carries its own permissions. Pasted into an eval environment file, it keeps making that statement until it expires.
The short answer: a JSON Web Token pasted into a declared eval file is flagged by EvalEgress as jwt_token (MEDIUM, weight 8), reported as presence, file and line with the token redacted. A JWT is a bearer credential: whoever presents it is believed, and its payload states its own permissions and expiry in readable form. If the token is real, revoke or rotate it where it is issued, shorten its lifetime, and never store tokens in declared files again — the eval should obtain its token at runtime, the way the application does. Check the rest of the environment file with the free scan, since pasted tokens rarely travel alone.
What is a JSON Web Token (JWT)?
A JSON Web Token is a signed, self-describing credential: three base64url segments separated by dots, the middle one a readable JSON payload carrying claims such as the subject, the issuer and the expiry. Services trust the signature and act on the claims without a database lookup. EvalEgress matches the three-segment shape as class jwt_token, MEDIUM severity — the token may be short-lived, which lowers the weight, but while it lives it is a complete, presentable credential.
Why is a token in an eval file different from a token in a browser?
In normal operation a JWT is transient: issued at sign-in, held in memory or a protected store, expired within hours. A token in an eval environment file has been frozen out of that lifecycle. Someone copied it — usually from a browser session or a test script — to make the eval authenticate without implementing the sign-in flow, and the file preserves it beyond the session it belonged to, in a folder whose entire purpose is to be shared and re-run. The token's claims outlive the intention.
The payload is also a briefing document. Anyone who finds the string can decode the middle segment without any key and read the subject, the roles and the expiry. Even an expired token teaches an attacker the account's shape: which user the eval ran as, what that user could claim, and what a fresh token for the same purpose would look like. That is why the class fires on the shape regardless of whether the particular token still validates — the scanner cannot check liveness, and is designed not to try: it touches no live systems.
Why does the remediation talk about lifetime, not just rotation?
Because with JWTs, lifetime is the exposure window by design. A password is valid until changed; a JWT is valid until it expires, and revocation is often not even implemented by the issuing service — many verifiers trust the signature and the expiry claim alone. Rotating the signing key invalidates every outstanding token at once, which is sometimes the right hammer after a real exposure, but it logs out the world. The surgical fix for an eval-pasted token is usually: let the specific token expire, shorten the lifetime for eval-issued tokens to the length of a run, and stop freezing tokens into files.
For the eval itself, obtain tokens the honest way: a dedicated eval service account that signs in at start-up, receives a short-lived token, and lets it die with the run. That pattern also fixes the hidden problem with pasted tokens — they belong to a human's session, so the eval's actions are attributed to a person and inherit that person's full claim set, rather than the narrow claims an eval account should carry. Narrow claims are the token-world version of least-privilege IAM, covered for policies in the exposure guide.
When is a jwt_token finding not a live credential?
Test fixtures are the honest exception: suites carry obviously synthetic tokens — unsigned, or signed with a published test key, or with claims naming fictional users — and the scanner's shape-match fires on them the same as on real ones, because shape is all a declared-surface scanner may judge. The professional handling is to make the fixture unmistakably synthetic (a claims payload that says so) and to record the decision in the run notes, rather than to argue with the finding.
What should never be waved through is a token whose payload names a real user, a real issuer and a future expiry. That combination in a declared file is a working credential with a printed map of its own permissions, and its MEDIUM weight — 8 points — reflects the typical case, not the worst one. Treat the worst case you can see in the payload as the case you have.
Worked example: Willow Creek Clinics, scored end to end
Example. Willow Creek Clinics, a fictional outpatient group, evaluated a triage-note classifier. A developer had pasted their own session token into the eval environment file so the harness could call the staging API, and the file also bound the results viewer to all interfaces. The scan returned:
| Finding | Class | Severity | Weight |
|---|---|---|---|
| JWT token pasted into the eval environment file | jwt_token | MEDIUM | 8 |
| Service bound to 0.0.0.0 in the viewer config | open_binding | MEDIUM | 8 |
| Debug route string declared in the viewer config | debug_route | LOW | 3 |
The arithmetic: 8 + 8 + 3 = 19 points of exposure, so the score is 100 − 19 = 81/100, grade B. 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 developer's token carried their own clinician-admin claims — the payload said so, once anyone looked — which reframed the finding from housekeeping to priority. The team created an eval service account whose tokens live for one hour and carry a single eval role, taught the harness to sign in at start-up, rebound the viewer to localhost and removed the debug route. The pasted token expired within its original window and was never renewed into a file again. The re-scan reported zero findings.
Close a jwt_token finding: the five actions
Read the payload, then fix the lifecycle:
- Decode the payload yourself and read the claims. The report gives file and line; the payload tells you whose token it is, what it can claim and when it dies — that sets the urgency.
- Revoke or rotate at the issuer if the token is live and broadly claimed. Where per-token revocation does not exist, rotating the signing key is the hammer; use it when the claims justify it.
- Give the eval its own service account. Short-lived tokens with eval-only claims, obtained at start-up — never a human's session token frozen into a file.
- Shorten lifetimes for eval-issued tokens. A token that lives for the length of a run can leak only for the length of a run.
- Remove the token from files and history, then re-scan. Confirm jwt_token is absent from the declared set, and mark genuine test fixtures as synthetic so the class stays meaningful.
JWTs fail quietly: nothing looks broken, the token just keeps working wherever it was pasted. The lifecycle fix — own account, short life, runtime issue — is the durable one, and it rhymes with the credential handling in the secrets guide.
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, wildcard IAM action in an eval role policy, service-wide IAM wildcard in an eval policy, AdministratorAccess on an eval role. 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.
- RFC 7519 — JSON Web Token (JWT) — the IETF specification (2015) defining the token format this guide's findings are read against.
Frequently asked questions
Why is jwt_token only MEDIUM if it is a working credential?
Because many JWTs are short-lived, and the weight prices the typical case. The payload's own expiry and claims tell you your case: a long-lived, broadly-claimed token deserves CRITICAL-level urgency whatever the band says.
Can EvalEgress tell whether the token is still valid?
No, and by design: checking validity means calling a live system, which a declared-surface scanner never does. It reports the declaration; you read the expiry claim in the file.
Is it safe to paste a JWT into the scan to check it?
The scan redacts token values in every output and stores no values, and it processes pasted content in memory. The finding will report the token's presence, file and line — never the token itself.
What lifetime should an eval token have?
About the length of the run that uses it. An hour is a common working choice; a week is a credential, not a session.
Should test fixtures with JWTs be removed?
Make them unmistakably synthetic — fictional claims, a published test signing key — and record the decision. Do not leave realistic-looking tokens in fixtures; the habit of waving at the shape is the risk.