Guides · ← All guides · Published November 14, 2026 · Reviewed November 14, 2026 · Ingenious AI team · 7 min read

GitHub Token in an Eval Repo: Revoke It Before You Clean Up

A GitHub token in an eval folder is a key to the code itself — often to every repo its owner could touch. Revoke first; tidy second.

The short answer: revoke the token in GitHub settings before you edit a single file. A token matching the ghp_, gho_, ghu_, ghs_, ghr_ or ghp_-family patterns in a declared eval file is EvalEgress's github_token class (HIGH, weight 15), reported as presence, file and line with the value redacted. The token authenticates as its owner with whatever scopes it was granted, and eval folders are copied, committed and shared more casually than the repos the token unlocks. Revoke it, replace it with a short-lived credential or a secrets-manager entry if the eval genuinely needs repository access, purge it from history, and re-check the folder with the free scan.

What is a GitHub token?

A GitHub token is a credential string GitHub issues for API and git operations — personal access tokens begin ghp_, OAuth tokens gho_, and server-to-server and refresh tokens use the ghs_ and ghr_ prefixes, among others. It acts with the scopes chosen at creation, which for a developer's everyday token often means read and write across every repository they can access. EvalEgress matches these token shapes as class github_token, HIGH severity.

Why do eval folders collect GitHub tokens?

Because evals eat repositories. The harness clones the codebase under test, fetches a dataset repo, or pushes results to a branch — and the quickest way to make that work on a laptop is to paste the developer's own token into the harness config or a setup script. The token then sits in the one folder that gets zipped, shared with a collaborator, committed to the eval-results repo, or pasted into a scanning tool for review. Each of those is a normal eval workflow; that ordinariness is the risk.

Scope is the multiplier. A fine-grained token limited to one dataset repo is a modest finding. A classic personal token with repo scope, minted for convenience in 2023 and pasted ever since, is a master key to the organisation's code — including, often, the ability to read the secrets other teams committed and to modify the code the eval was meant to be testing. The class is HIGH at 15 points regardless; your own knowledge of the token's scopes tells you where in HIGH it sits.

Why revoke before cleaning the repository?

Cleaning assumes the only copies are the ones you can see. A token in an eval repo has usually been cloned with the repo, forked with it, and cached by every machine and CI runner that touched it. Revocation in GitHub settings is the single action that reaches all of those copies at once, by making the string worthless wherever it survives. It takes a minute and breaks things loudly — which is a feature: whatever was quietly depending on a pasted personal token should be forced to identify itself.

Cleanup still matters, second. The token string in history will keep tripping scanners and, worse, training the team to ignore credential findings as 'that old revoked one'. Purge it after revocation, and replace the workflow that needed it: a GitHub App installation token, a short-lived workflow credential, or a read-only fine-grained token stored in the secrets manager and scoped to the single repo the eval reads. If the eval only reads public or same-owner code, ask whether it needs a token at all — unauthenticated local clones of a checked-out repo need none.

What should you check in the account after revoking?

A token that sat in a shared folder may have been used by more than its owner. After revocation, review the token owner's recent activity for repository accesses and key changes they do not recognise, and check whether the same token was pasted into CI variables or other repos — a five-minute search for its prefix across your own systems, using your own access, not the token. Other credential classes in the same scan report, particularly generic_secret_assignment, often mark the files where a second pasted credential lives.

Then close the loop in the eval process itself. The durable fix is a rule with a mechanical check behind it: eval harness configs contain no token-shaped strings, and the scan — which matches exactly those shapes — runs over the declared files before the eval does. The rule is one line in the runbook; the scan makes it self-enforcing, which is the pattern behind stopping evals from reaching production secrets in general.

Worked example: Fernwick Learning, scored end to end

Example. Fernwick Learning, a fictional tutoring platform, evaluated a quiz-generation model. The harness cloned its dataset repo using a developer's classic personal token pasted into the setup script, and the results viewer it started was bound to all interfaces with debug mode on. The scan of the declared files returned:

FindingClassSeverityWeight
GitHub token in the harness setup scriptgithub_tokenHIGH15
Service bound to 0.0.0.0 in the viewer configopen_bindingMEDIUM8
Debug mode enabled in the viewer settingsdebug_mode_enabledMEDIUM8

The arithmetic: 15 + 8 + 8 = 31 points of exposure, so the score is 100 − 31 = 69/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.

Fernwick revoked the token within the hour — it carried repo scope across the organisation, which turned a housekeeping task into the week's priority — and replaced the clone step with a fine-grained, read-only token for the dataset repo alone, stored in the secrets manager. The viewer was rebound to localhost and debug turned off. The re-scan reported zero findings, and the setup script now contains a comment instead of a credential: where the token comes from, and what to do when it expires.

Close a github_token finding: the five actions

Revoke, replace, purge, review, prevent:

  1. Revoke the token in GitHub settings first. Revocation reaches every clone, fork and cache at once; file cleanup reaches only the copies you know about.
  2. Identify what the token could reach. Note its type and scopes — a classic repo-scope token is a different incident from a fine-grained read-only one, and the review depth should match.
  3. Replace with the narrowest working credential. A fine-grained token for the one repo, a GitHub App token, or no token at all if the eval reads a local checkout — stored in the secrets manager, never pasted.
  4. Purge the string from files and history. A revoked token left in history still trains the team to ignore credential findings; remove it once it is dead.
  5. Review the owner's activity and re-scan. Check for use you do not recognise, search your own systems for the same token, and confirm the class is absent from the re-scanned declared set.

Tokens in eval repos are a workflow smell: the eval needed code access, and a personal master key was the nearest tool. The fix is a narrower tool, kept in the secrets store — the same pattern as every credential class in eval-to-production exposure.

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, API key declared in an eval configuration, secret assignments in eval configuration files, JWT token declared in an eval environment. EvalEgress is one of the Ingenious AI platforms.

Sources

Frequently asked questions

The token is mine and only I use this eval folder. Is it still a finding?
Yes. Eval folders get committed, zipped and pasted into tools as part of normal work; the folder's audience is never just you for long. The class flags the declaration, and the remediation — revoke, narrow, store properly — is the same.

What is the difference between ghp_ and the other prefixes?
They mark token types: personal access, OAuth, user-to-server, server-to-server and refresh tokens. The scanner matches the family of shapes as one class, github_token, because all of them authenticate to GitHub with their granted scopes.

Can I just rotate the token instead of revoking it?
For GitHub tokens, revoking and issuing a replacement is the rotation. Issue the narrower replacement, switch the harness, and revoke the old token — do not leave both alive.

Will revoking break other people's work?
It breaks anything using that token, loudly and immediately — which is how you discover what depended on a pasted personal credential. That discovery is part of the fix, and it is why revocation comes first.

Does the report show the token so I can identify which one it was?
No — values are redacted; the report shows file and line. Open the file at that line yourself to identify the token, then revoke it in GitHub settings.