Skip to main content
Intelligence Simplified
Hands fitting a new lock cylinder into a door while the old lock and keys lie on the floor.

October 22, 2026

Rotate API Keys: A Plan for When Your Host Is Breached

Railway disclosed that environment variables were accessed and urged users to roll every key. Here is how to rotate API keys quickly.

Covers week of October 19, 2026.

On October 21, Railway published a security disclosure saying an unauthorized third party may have accessed encrypted customer environment variables and, for some, obtained the decrypted contents. Railway recommended that all users immediately roll every environment variable stored there, including API keys and private registry credentials, and review logs for unusual activity. Deployments were paused during the investigation. The next day, Railway’s preliminary report said early investigation suggested the attack aimed to obtain AI provider API keys to perform distillation attacks, which is why those keys were the prize, and placed the attack window from October 20 at 13:58 UTC to October 22 at 03:32 UTC. Its investigation was still ongoing. Whatever host you use, this is a good week to make sure you can rotate API keys quickly.

Why AI keys are a target

AI provider keys are valuable. Attackers wanted them for distillation, which is why they were the prize. Someone holding yours can also run expensive workloads on your bill. Many AI-built apps store keys for several providers, plus database credentials, payment keys and email service keys, all as environment variables on one hosting platform. That’s convenient and normal. It also means one breach can expose many keys at once.

If you host on Railway

Follow Railway’s guidance: roll all environment variables and API keys stored there, including private registry credentials, and review the logs of the services those keys access. Check the incident updates for current status and any further recommendations.

How to rotate API keys without breaking your app

1. List every secret

Write down each key and credential, which service issued it, where it’s stored and which parts of your app use it. Most people find a few they’d forgotten.

2. Prioritize

Rotate first what could cost money or expose data: AI provider keys, payment keys, database credentials, cloud keys and email service keys.

3. Create the new key first

For each service, create a new key, update it in your host and any other place it’s used, redeploy and confirm the app works. Then revoke the old key. This order avoids downtime.

4. Check usage and logs

Look at each provider’s usage dashboard and logs for activity you don’t recognize, especially around the attack window. Unexpected spikes in AI usage are a clear sign.

5. Set limits

Set spending limits and alerts with AI providers. If a key is stolen in future, a limit caps the damage.

Make the next rotation easier

  • Keep a secrets inventory and update it whenever you add a key.
  • Use separate keys per environment and per app, so one exposure doesn’t affect everything.
  • Give each key the narrowest permissions the provider allows.
  • Don’t keep long-lived broad tokens on your laptop. That lesson came up earlier this year in what happened when an AI agent deleted a production database.
  • Practice once. Rotate one low-risk key end to end so you know the steps.

Plan for deployment pauses

Railway paused deployments while it investigated. That’s a reasonable security step, and it’s also a reminder that your host can become unavailable for a while. Know how you’d ship an urgent fix if your platform were paused, even if the answer is simply to wait. I wrote about this in deployment resilience.

Part of finishing an app

When I help people finish AI-built apps, secrets are one of the first things we check: where they live, who can see them, and whether any ended up in the code. A clear inventory and a tested rotation process turn an incident like this from a scramble into an afternoon of routine work.

If you’ve built an app with AI tools and want help organizing secrets, deployment and recovery before something goes wrong, here’s how I approach Prototype to Production.

Sources

Russ Frisch

• Founder and software engineer

We take fixed-price work on data, AI workflows, and finishing apps. You work with the Intelligence Simplified team.

Expertise:

Data migration AI workflows Workflow automation Prototype to Production