Provider Keys: Keep the Root, Issue the Rest
A coding agent leaves provider keys in your home directory, and a hosted console keeps them for a whole workspace. In October 2026 an infostealer went after the first and a breach took the second. The fix is custody: the root key in one place you run and patch, and a derived key for every person, agent, repository and CI job.
Open your home directory. Whichever coding agent you installed in 2026 left files there: .claude.json, the Codex config.toml and the .env beside it, Cursor's local state database, and a token apiece for GitHub Copilot, Google Gemini, Kiro or the JetBrains AI Assistant. Symantec's Threat Hunter Team wrote on 15 October that new variants of the Aoki infostealer read that list, plus Cursor's tokens, Claude desktop and ChatGPT cookies and your AWS credentials. The tokens, the report says, let an attacker “carry out activity under a legitimate user's identity and API quota” and reach the repositories, cloud services and CI pipelines linked to the account. Two days later OpenCode emailed users of its hosted Console under a subject line dev.to reproduced as “Action Required: Potential provider key breach”.
A laptop in one case, a hosted service in the other, and the thing taken is the same: a provider key that works from anywhere until somebody revokes it. Who holds that key, and what each copy of it may do, decides how much a theft costs.
The key leaves by a file, a history or a console
Aoki is not new. Symantec says it was first seen earlier in 2026 and that older samples ignored AI tooling; the variants Symantec described on 15 October added the agent files to a long list of browser, wallet and messaging targets, and the report names no delivery vector. The list is the point. Secret scanning knows what an AWS key looks like and has had less practice with the JSON config and token files an agent writes to a home directory, or with a local state database that Symantec says can cache chat context and code snippets. GitHub moved on 13 October: its changelog adds anthropic_service_api_key and anthropic_user_api_key to push protection by default, and a commit carrying either is now blocked wherever secret scanning is on.
Git history is the second door. Socket's 9 October write-up of the GhostAction wave lists 13 patterns the payload greps for across the full history of a checkout, sk-ant-, sk-proj- and sk-or- among them; the CI secrets guide covers that campaign.
The third door is a console. OpenCode Console is a hosted service from the OpenCode project, separate from the coding agent. Its documentation describes the arrangement this page recommends: the Console “stores the credential and serves each provider through its gateway”, and members use the models “without ever seeing the provider key”. On 17 October the email went out. As dev.to quoted it, OpenCode had “identified unauthorized access to a legacy system that we were in the process of decommissioning”, and “third party provider keys (eg OpenAI, Anthropic) saved in your workspace may have been exposed”. OpenCode put the affected share at 1.4% of Console users with linked providers, published no denominator, said it was working with Anthropic, OpenAI and Google, and said, in posts relayed by dev.to and Cyera, that the breach was related to a large scale distillation attack. The Hacker News thread passed 950 points; commenters disputed that label as unevidenced and asked for a root cause analysis, and as of 19 October none had been published. Co-founder Dax Raad said, in relayed posts, that the incident involved the Console and that keys used by the local agent never reach the company.
Noma's 17 October note adds the detail that carries over to any hosted tool: removing a key in the Console UI does not invalidate the secret, and only the provider can. The place a key is stored tends to outlive the reason it was put there.
Wherever the root key sits is the target
It is tempting to read the two stories as opposites: the stealer says keys do not belong on laptops, the Console says they do not belong in hosted gateways either. Together they say one thing. A provider key is going to sit somewhere, in a file, a database or a vendor's legacy system, and that somewhere is what gets robbed. Google's Threat Intelligence Group put it bluntly on 1 October, two weeks before either incident, calling enterprise AI gateways “a catastrophic dual-threat vector” because a compromised one gives up third party API keys and becomes a foothold in the cloud behind it.
The argument is about custody, then, rather than about proxies. The root key, the one the provider issued to your organisation, lives in one place you control, run and patch. Nothing else ever sees it: no laptop, repository, plugin or hosted console. Every person, agent, repository and CI job gets a key derived from it, and each derived key says what it is for and stops working on its own. Revocation becomes killing one derived key, which no other client notices, instead of rotating the root and chasing every copy.
Jared Siegel's post of 18 October, over 200 points on Hacker News, makes the same case from the visibility side: run the proxy “somewhere you control”, and “use virtual api keys to stop littering your single main key over your work, agents, and harnesses”. He names no software. A hosted gateway can still be a reasonable choice, provided you know you have handed that vendor your root and that its decommissioning schedule is now your exposure window.
A derived key says what it is for and when it dies
Of the three gateways compared here, LiteLLM is the one whose documentation shows all four controls on a single call. POST /key/generate, authenticated with the proxy's master key, takes a models allowlist, a max_budget in dollars with a budget_duration that resets it, and a duration after which the key expires (the docs show "30min" and "30d"). A key_alias, a team_id and free form metadata ride along for the spend log to read back. The script below issues one key for one CI job.
#!/usr/bin/env bash
# ./issue-key.sh ci-deploy 8h 5
# ROOT: runs on the gateway host only
set -euo pipefail
GW=http://127.0.0.1:4000
MK=${LITELLM_MASTER_KEY:?}
NAME=$1; TTL=${2:-8h}; CAP=${3:-5}
# DERIVED: one key, one job, one name
# SCOPE models, CAP budget per day,
# TTL duration: dies with the job
curl -sS "$GW/key/generate" \
-H "Authorization: Bearer $MK" \
--json @- <<EOF
{
"key_alias": "$NAME",
"team_id": "platform",
"models": ["claude-sonnet-5"],
"max_budget": $CAP,
"budget_duration": "1d",
"duration": "$TTL",
"rpm_limit": 60,
"metadata": {"repo": "acme/web"}
}
EOF
Where it runs matters more than what it sends. The master key must start with sk- and is the proxy's root, which is why the script runs on the gateway host or an administrator's machine and not inside the job it issues a key for. The job receives the returned sk- key at run time and holds nothing else. Set upperbound_key_generate_params in the proxy config too: a request above a bound is rejected with a 400 rather than clamped, and the bounds double as defaults for fields a caller leaves out. One key per team is the compromise you will be offered, and it costs you the per job revoke.
The other two products, by their current documentation:
- Portkey. Its docs say “Virtual Keys have been migrated to Model Catalog”, where budgets, rate limits and model allowlists are set per provider integration and cascade to the providers made from it. Budget and rate limits on individual API keys are a separate control, available on the Enterprise plan and to select Pro customers. Its admin API also lets each API key carry an
expires_atdatetime, which “must not exceed the org/workspace maximum TTL if configured”. - Kong AI Gateway. AI Consumer Groups scope model access and token or cost budgets by team or tier, AI Rate Limiting Advanced enforces spend limits against each request's cost, and AI Model Provider holds upstream credentials in one place to be rotated without touching every team's configuration. Expiry sits a layer down, on the key-auth credential a client presents: its
ttlis “the number of seconds the key is going to be valid”, and Kong does not support it in DB-less or hybrid mode.
Watch one key leak
Pick the client the stealer hits, then press Leak a key below. Four clients call the same provider: Claude Code on a laptop, Cursor, the ci-deploy job and a hosted console. Under Raw key all four share the provider's key, one leak is four, the spend climbs with no ceiling, and the only cure revokes the CI job along with the thief. Under Derived keys the leaked key stops at its $5 cap or its 8 hour TTL, and Revoke kills that one key while the other three keep answering.
Spend figures are illustrative. The model, the $5 cap, the 8h TTL and the 60 rpm limit are the ones issue-key.sh sets.
The gateway is attack surface too
Concentrating root keys in one place makes that place worth attacking, and 2026 showed how. CVE-2026-42271, a command injection in LiteLLM's MCP server preview endpoints (POST /mcp-rest/test/connection and /mcp-rest/test/tools/list), affected versions 1.74.2 through 1.83.6 and was fixed in 1.83.7, with Starlette 1.0.1 closing the chained Host header bypass CVE-2026-48710. CISA added it to the Known Exploited Vulnerabilities catalogue on 8 June 2026, and Google's 1 October report lists it as exploited in the wild, “resulting in host takeover and API credential theft”. The Cloud Security Alliance's June note has the detail that matters here: “Standing alone, CVE-2026-42271 requires a valid API key”, which it says limits the first move to insiders and to anyone already holding a proxy credential. Any holder of a derived key, which is to say any laptop, agent or job you had issued one to, could take over the gateway and read every root key it held.
Run the gateway like the key store it is. No listener without authentication, including the admin UI and preview endpoints you are not using. A network policy that lets only your clients reach it and lets it reach only the providers. A patch cadence measured in days. An audit log shipped off the box. And a break glass path to the root key that does not go through the gateway, for the day the gateway is what failed.
That last point is the strongest objection in Siegel's thread, where the top comment called a proxy “a single point of failure direct in the line of your productivity” and said “the OTEL traces will have exactly what you need”. The visibility half is right: traces exported by the agent tell you what it called and how long it took, with nothing in the path. They do not change who holds the key, cap what it can spend, or let you kill one client's access while the others keep working. A trace cannot issue a key, and if availability is the worry, two gateways behind a load balancer answer it.
Log by key, then rehearse revoking one key
Siegel's summary of the log is the right shape: “logs of which key called what model with what client at what time and its status”. LiteLLM exposes it through /spend/logs/v2, filtered by api_key, team_id, model, status_filter and a date range, and through /key/info, which returns a key's spend. The alias and metadata set at issue time turn a row into a sentence: this job, in this repository, on this model, at this hour. Alert per key on spend rate and on calls outside the hours that key ever works. A provider's usage page cannot separate your CI job from your laptop unless they were different keys to begin with.
Then rehearse the revocation, because the order of the steps has started to matter.
Revoking first can cost you the machine
StepSecurity's 8 October analysis of the tensorlake@0.5.144 worm found a service it installs, gh-token-monitor, that checks the stolen GitHub token every 60 seconds for up to 24 hours and runs rm -rf ~/ if GitHub rejects it. Revoking the token is the obvious first move and the one that sets it off. On a machine you suspect, find and remove the monitor before you rotate anything.
- Kill the derived key at the gateway. Confirm the client is refused (LiteLLM answers 401 for a key it no longer knows), read that key's last hours in the spend log, and leave everything else running.
- If a root key was exposed, rotate it at the provider. Confirm the old one is refused, reissue the derived keys, update the CI secrets that carried them, and read the provider's usage for the exposure window; for the Console case, Cyera's guidance was to start that window on 16 October.
- Restart whatever inherited the old environment. The Codex issue that reached Hacker News on 12 October describes a detached
codex app-server --managed-daemon, on by default in CLI 0.157.0, that outlives every closed window and keeps the first session's proxy variables. - Audit what reads the home directory. The same worm wrote
.claude/settings.jsonand.vscode/tasks.jsoninto repositories it could reach, under a commit titled “chore: update dependencies”, and opening the project ran it again. Plugins, MCP servers and hooks that read your environment get an allowlist and a derived key of their own.
Anthropic's 12 October post on distillation defences describes campaigns run through networks of fraudulent accounts, one of them more than 20,000 at once, and reports tens of thousands banned. Whether or not that is what the Console keys were used for, which nobody has shown, the point for custody holds: a provider's abuse controls act on accounts, and a stolen key spends under yours until you kill it. The sandbox egress guide applies the same principle one layer down.
Takeaways
- Symantec's 15 October Aoki report makes the files a coding agent leaves behind a secret class of their own;
.claude.json, the Codexconfig.tomland.env, Cursor's state database and the agent tokens belong in secret scanning and endpoint watchlists. - OpenCode Console stored provider keys and routed requests so members never saw them, and the breach took the stored keys anyway: a hosted gateway means that vendor holds your root.
- All three gateways document a key expiry: LiteLLM's
duration, Portkey'sexpires_aton API keys and Kong's key-authttl; check what each one hangs off before you design around a TTL. - CVE-2026-42271 let any holder of a valid proxy key take over LiteLLM 1.74.2 through 1.83.6 and read every provider key it held; patch the gateway as the key store it is.
- Look for a monitor that punishes revocation before you rotate a token on a suspect machine; StepSecurity found one in the Tensorlake worm that deletes the home directory when GitHub rejects the stolen token.
Where do your provider keys live right now?
We put the root keys in one gateway you run and patch, issue a scoped, capped, short lived key to every person, agent, repository and CI job, log every call by key, and rehearse the revocation drill with your team.
Take custody of your keys