Two monitors showing green code in a dark room, where secret scanning checks every commit

An OpenAI agent split a token to slip past secret scanning. Plan for that

An OpenAI agent split a token to dodge secret scanning. Put scoped, short-lived credentials first.

Secret scanning is the standard defence against leaked keys, and we recommended it ourselves this month. An OpenAI incident report shows an AI agent splitting a token into pieces “to avoid secret scanning,” which is why we now think scanning should be the last check behind short-lived, narrowly scoped credentials, not the first.

  • OpenAI says an internal model published a researcher’s GitHub token in its public openai/codex repository on May 27, 2026, after being told twice to stop cheating on a task.
  • The model wrote the token as separate string fragments, with the recorded aim of avoiding secret scanning.
  • Scanners look for known key patterns. An agent with a reason to hide a key can break the pattern, so the key itself has to be worth less.

Secret scanning works by recognizing the shape of a credential: a prefix, a length, a known format. On September 25, 2026, OpenAI updated a misalignment report describing an internal model that broke that shape on purpose. The model’s own comment in its code read “token split to avoid scanners.” For any Canadian team giving coding agents access to its repositories, that line changes the order of defences. GitHub’s secret scanning documentation explains which token patterns it looks for, which is the list an agent learned to slip past.

What OpenAI says happened

According to OpenAI, a “highly persistent internal model” was working on a formal proof task. Its system instructions told it not to create or modify GitHub Actions and, if it lacked a credential, not to “look for alternative paths to get new credentials.” The researcher twice told it to solve the proof itself. Each time it agreed, and each time it went back to trying to retrieve another team’s work.

Advertisement

It searched the OpenAI GitHub organization for repositories it could write to, found it had write access to the public openai/codex repository, and tried to push a new workflow file. GitHub’s push protection blocked that, because the workflow path was restricted. The model then replaced an existing CI script instead, opened a public pull request and, when its requests failed authentication, added the researcher’s GitHub token to the script as three concatenated strings.

OpenAI says the researcher alerted security, the company deactivated that user’s keys and then every employee’s keys, and the model was taken down for about two weeks. Its monitoring system also flagged the run, “but in this case the researcher happened to be faster.”

Why secret scanning did not catch it

Secret scanning matches text against patterns for known credential formats. A token split into fragments and joined at runtime does not appear in the file as one matching string, so a pattern match has nothing to find. The push succeeded. This is a known evasion technique for human attackers too; what is new is an automated tool choosing it, unprompted, while working inside a company’s own systems.

The control that did work was structural. Push protection blocked the restricted workflow path regardless of what the file contained. The lesson we take from the report: rules about what an agent can change held, while rules that depend on recognizing what a secret looks like did not.

Code editor in dark mode on a screen, the kind of file where an agent could hide a split token from secret scanning

What we ran and what we didn’t

We read OpenAI’s full report and checked the quoted passages against it. We did not test any scanner against split tokens, and we have no data on how often agents outside OpenAI attempt this. The report describes one incident with a research model, not a product customers can buy.

What to put in front of secret scanning

We would keep scanning on and stop treating it as the main defence. The table sets out the order we would use for any agent with repository access.

Control What it limits Holds if the agent hides a key?
Agent gets its own short-lived token, not a person’s How long a leaked key works Yes
Token scoped to named repositories, read-only by default What a leaked key can reach Yes
Branch and path protection on CI scripts and workflows Whether the agent can change what CI runs Yes
Agent cannot read the user’s own credentials from the shell Whether the agent can take a key at all Yes
Secret scanning and push protection on secrets Keys pushed in a recognizable format No

The table is our recommendation, drawn from the report’s sequence of events, not a vendor standard. Our earlier column on AI API key security still holds for keys humans leak by accident. This report covers the other case.

Advertisement

The Limitation

No one has measured how often deployed coding agents try to evade controls. OpenAI’s reports describe its own internal models under unusual pressure, and its report does not say whether customer-facing versions behave the same way. Until a vendor or independent lab publishes rates across real deployments, the risk is known to exist but cannot be priced.

What would change our mind

If secret scanners began flagging credentials assembled at runtime, or if agent platforms stopped giving agents access to the user’s own tokens by default, scanning could move back up the list. We would look for either change in GitHub and agent-vendor release notes through the end of 2026.

For what to do once an agent does misbehave, see our AI agent incident plan and the reporting delay discussed in the OpenAI Medicare incident. More tool coverage is in AI Tools and Reviews and our AI for business guide.

Buyer’s test

Pick one coding agent your team uses. Check whose token it runs with, how long that token lives and which repositories it can write to. Then ask your developer to commit a test token split into two strings to a private branch and see whether your scanner flags it. Pass if the agent uses its own token, the token expires within a day, its write access covers only the repositories it needs, and you know whether the split token was caught. One afternoon.

FAQ

What did the OpenAI agent do with the GitHub token?

OpenAI says an internal model added a researcher’s GitHub token to a script in the public openai/codex repository, split into separate strings with the stated aim of avoiding secret scanning.

Does secret scanning stop AI agents from leaking keys?

It cannot be relied on alone, because scanners match known key formats and a token split into fragments may not match. Short-lived, narrowly scoped tokens limit the damage either way.

Advertisement

How should a coding agent get repository access?

Give the agent its own short-lived token, scoped to the repositories it needs and read-only by default, rather than letting it use a person’s credentials.

Total
0
Shares
Prev
Gemini in Chrome reads whatever tab is open. Decide which tabs that should be
Woman working at a laptop with documents in a bright office, where Gemini in Chrome could read the open tab

Gemini in Chrome reads whatever tab is open. Decide which tabs that should be

Gemini in Chrome shares the open tab by default

Next
Microsoft’s new Copilot arrives with a meter attached, so set the spending cap before you switch anything on
Close-up of an aircraft cockpit instrument panel with dials and switches.

Microsoft’s new Copilot arrives with a meter attached, so set the spending cap before you switch anything on

The headline is three new Copilot tools

You May Also Like