Keys and incidents

The Railway breach: rotate your keys, then cap what a stolen key can spend

If your app ran on Railway before 21 October 2026, rotate every secret you stored there, starting with AI provider keys, because Railway says that is what the attacker was hunting for. Then put a spend limit on every AI key, so the next stolen key, from any host, has a ceiling.

TL;DR

  • Railway says an attacker decrypted stored environment variables for at most 1.85% of workspaces (about 100,000) between 20 and 22 October 2026.
  • The attacker searched for AI provider key names; workspaces with many variables or many AI keys were the targets.
  • Rotate in this order: AI keys, payment keys, database credentials, GitHub and cloud tokens. A “your key was revoked” email still means you must issue a new one.
  • Set a spend limit on each AI provider account and give each app its own key, so a stolen key can only burn so much.

This guide is for founders whose app, or whose AI agent’s deploy, keeps secrets in Railway’s environment variables. Every fact about the incident below comes from Railway’s preliminary report (22 October, updated 26 October). We have no inside information. Press reports have put dollar figures on the AI spend; we haven’t found those in a primary source, so they aren’t repeated here.

What Railway says happened

QuestionRailway’s answer
WhenFrom 20 October 13:58 UTC until the attacker was confirmed out on 22 October 03:32 UTC.
What was takenEncrypted environment variables. Using credentials taken from Railway’s CI environment, the attacker decrypted a subset.
How manyAt most 1.85% of workspaces, about 100,000, had some variables potentially exposed. Railway can’t tell which individual variables were decrypted.
What they wantedAI and platform API keys. The attacker’s payload searched for specific AI key names, and workspaces with many variables or many AI keys were the high-risk group.
AccountsRailway says user accounts were not logged into. It has not yet ruled out access to source code.
Who must actRailway recommends that everyone who signed up before 21 October rotate the keys they stored on Railway.

The lesson goes wider than one host. Wherever your secrets are stored, at your host, in CI, in an agent’s config or in your repo, that place can leak. You can’t control your host’s security. You can control how many copies of a key exist and how much damage one stolen key can do.

Rotate, in this order

  1. AI provider keys (OpenAI, Anthropic, OpenRouter, Gemini and similar). They were the target, and a working key turns straight into spend on your bill.
  2. Payment keys. Roll the Stripe secret or restricted key. Stripe lets you set when the old one expires, so deploy the new one first.
  3. Database credentials. Change the database password or connection string, and a Supabase service role or secret key. These give full access to your data. Railway also advises removing public network access to databases you host there.
  4. GitHub, GitLab, registry and cloud tokens. Issue new ones with the narrowest scope that works. Check your GitHub audit log and installed apps, and your registry’s activity log (for example Docker Hub), as Railway suggests.

Railway sent keys to GitHub, GitLab, Anthropic, OpenAI, OpenRouter, Stripe and other providers to revoke, in some cases every key it held. If you got a revocation email, your app may already be failing, and you still need to create a new key and put it back in your variables. The email alone doesn’t mean your key was among those decrypted. Where to rotate each kind of key.

Cap what a stolen key can spend

Rotation fixes this incident. A spend limit caps the next one, whoever leaks the key.

  • Anthropic: set an organisation spend limit on the Console’s Billing page. Give each app its own workspace with its own spend limit (the default workspace can’t take one), and its own key inside it. Requests stop when the limit is reached.
  • Other providers: look in billing settings for a monthly budget, a usage limit or usage alerts, and use per-project keys where the provider has them. Some budgets only send an alert, so check whether yours actually stops requests.
  • One key per app and per environment. When one key leaks, you rotate it without taking everything else down, and its usage graph shows exactly when the abuse started.

Keep fewer copies of each key

A key kept in your host’s variables and also committed to your repo, or bundled into your frontend, can leak from either place. Founders who build with AI tools often have both without knowing it: a .env committed early on, or a VITE_ variable that copies a secret into the browser. Check your own code (findings PL-009, PL-010 and PL-011):

terminal
# Secret-shaped strings in the current code
grep -rnE "sk-proj-|sk-ant-|sk-or-|sk_live_|rk_live_" --exclude-dir=node_modules --exclude-dir=.git .
# The same in every past commit (a deleted key still lives in history)
git log -p --all | grep -nE "sk-proj-|sk-ant-|sk-or-|sk_live_|rk_live_" | head

Or paste the files into the free key check, which runs in your browser.

Check for spend you didn’t make

Open each AI provider’s usage page and look from 20 October onwards for models, volumes or hours that don’t match your app. Railway says it can’t refund spend made with stolen keys. It asks you to go to the AI provider first, then file a request at station.railway.com with timestamps, prompts and other proof, so Railway can escalate it for you. Keep a dated note of what you found and what you rotated (see the first hour after a leak).

Sources

The checks behind this guide, each with example code, a self-check and the fix.

Free check

Are any of these keys also in your code?

Paste code, a .env or your built JavaScript bundle into the free key check. It runs in your browser: no request is sent and nothing is stored. It flags secret keys (AI providers, Stripe, AWS, GitHub, database URLs), tells a Supabase anon key from a service role key, and links to where to rotate each one.

Open the free key check

Free, no sign-upNothing leaves your browserSee a sample result

Written by Manraj Singh Dhillon. Last checked 11 Nov 2026. Code samples are synthetic and run against your own project; nothing here names a real app. Spotted a mistake? Tell us.