Railway security incident: rotate your env vars in the right order
On October 21, 2026, Railway told all users to roll every environment variable. Here is a rotation order by blast radius, what Railway already reset for you, and what to do if your plan can't redeploy yet.
On October 21, 2026, Railway published a security disclosure: an unauthorized party may have accessed encrypted customer environment variables and, for some of them, the decrypted values. Railway says the impact may be limited to a subset of users, but it recommends that all users immediately roll every environment variable stored on Railway, including API keys and private registry credentials, and review their service logs. (TechCrunch coverage.)
If you built your app with Cursor, Claude Code, Lovable or Bolt and deployed the backend to Railway, your Stripe key, database URL and AI keys are probably sitting in those variables. This guide is the order we'd rotate them in. It's based on Railway's posts and its status page as of October 22; check both for updates.
Also worth 30 seconds: paste your live URL into the free Last Mile pre-launch check to make sure no secret is also sitting in your public JavaScript bundle. Matches are masked. No signup, nothing stored.
Scan my URL free →What Railway already did for you
- Storage bucket credentials were reset. The old S3 keys no longer work. New ones are in each bucket's Credentials panel, per environment. Services pick them up on their next deploy.
- GitHub tokens Railway held were reset. You need to reconnect GitHub yourself (Railway's guide).
- All Railway API tokens were invalidated. CI jobs or scripts that call Railway's API need a new token.
- Upstream AI providers were told to revoke keys. Railway says it notified inference providers to revoke keys proactively, so an AI key may already be dead. If your AI feature suddenly errors, that's a likely reason, and it's another reason to rotate now rather than later.
The catch: new values need a redeploy
Containers read variables at startup, so a new value only takes effect after you redeploy. Railway paused builds during the incident and is bringing them back in stages: Enterprise first, then Pro, then Hobby, then Free and Trial. As of the October 22 morning updates, Pro and Enterprise could deploy and the other plans were still waiting. That leaves a real choice for each key:
- Can redeploy: create the new key, set it in Railway, redeploy, confirm the app works, then revoke the old key.
- Can't redeploy yet: revoking the old key now breaks that feature until builds return. For keys that can move money, read customer data or run up a bill, take the downtime and revoke now. For low-risk keys, you can stage the new value in Railway and revoke the old one right after your first successful deploy.
Rotation order, by blast radius
- Payments. Roll your Stripe secret key (and any restricted keys), then roll the webhook signing secret. Look through recent charges, refunds, payouts and new API keys in the Stripe dashboard. Railway has a guide on checking for unexpected Stripe usage.
- Cloud accounts. AWS or GCP access keys can do far more than your app needs. Deactivate and replace them, then check for new users, keys or instances you didn't create (Railway's AWS and GCP guides).
- Databases. For Railway-hosted Postgres, MySQL, MongoDB or Redis, use Regenerate in the Database View instead of editing the password variable by hand. Editing one side leaves the database and the variable out of sync. Then redeploy every service that uses it. Services that reference
${{ Redis.REDIS_URL }}-style variables pick up the new value on redeploy; pasted connection strings and anything external using the public URL need the new value by hand. If public networking is on and nothing outside the project needs it, turn it off. (Redis guide; Railway also published Postgres, MySQL and MongoDB versions.) Hosted elsewhere, like Supabase or Neon? Rotate the database password and any service-role or secret key you stored on Railway. - AI keys. OpenAI, Anthropic, OpenRouter and similar keys are exactly what this attack was after, per Railway. Create new keys, set a spend limit if the provider offers one, and check the usage page for traffic you don't recognise.
- Auth and session secrets. JWT secrets, session secrets and OAuth client secrets. Rotating a session secret logs everyone out. That's fine.
- Everything else. Email, SMS, analytics, private registry credentials, third-party webhooks. Railway's advice is all of them, not just the scary ones.
Make an inventory first
Open each service's Variables tab, in every environment, and list every name. Mark which ones are secrets, where each one is issued, and whether the same key is also used somewhere else, like your laptop's .env, Vercel or a GitHub Actions secret. A key used in three places has to be updated in three places, or the old one can't be revoked without breaking something.
Check for misuse, not just rotate
Rotation stops future use. It doesn't tell you whether a key was already used. For each provider, look at usage and audit logs from October 21 onward: Stripe events and API request logs, cloud audit logs, AI usage dashboards, GitHub's security log and your own service logs for unusual activity, as Railway recommends.
Prompt your agent safely
Don't paste the new keys into an AI chat. A prompt that works: "List every environment variable this app reads, which file reads it, whether it's a secret, and which provider issues it. Don't print any values. Flag any secret that is also exposed to the browser or hardcoded anywhere." Use the list as your rotation checklist, and set the new values yourself in the Railway dashboard.
Afterwards: make the next rotation boring
- Use reference variables instead of pasted connection strings, so a regenerated password reaches every service on redeploy.
- Prefer scoped keys: Stripe restricted keys, least-privilege cloud users, AI keys with spend caps.
- Write a short runbook for "rotate a key" while it's fresh, including where each key is used.
Leaked keys and rotation start with LM-01 (secrets stay on the server) in the free Last Mile Rules, so your coding agent never pastes a key into code or chat again. Run the free check on your live URL, or get all 110 rules, which add the full secrets section and a rotation runbook.
Related guides
- Leaked API keys in your frontend bundle: how to check
If a secret can call a paid API or bypass your database rules, it does not belong in JavaScript the browser downloads. Here is how to find leaks fast and what to do when you find one.
- Stripe webhooks not working in production
Most “Stripe works in test, breaks in prod” reports are the same few mistakes. Fulfillment on the success page, the wrong webhook secret, or a body parser that breaks signature verification.
- How to ship a Cursor or Claude Code app safely
AI coding agents are great at generating working apps and equally good at “fixing” twenty files you did not ask about. Shipping safely is less about never using agents and more about putting them on a leash.
Make your coding agent enforce this
The 10 core Last Mile Rules are free: drop-in AGENTS.md, CLAUDE.md and Cursor rules that stop your agent shipping these mistakes, each with a Verify step.
Get launch notes
$ subscribe --launch-notes # new checks, prompts and shipping tips for vibe coders. No spam.