The Railway security incident: what we rotated, why we moved to Google Cloud, and what we got wrong
OCNexus is LumenIQ’s platform for running teams of AI agents. The agents coordinate through OCNexus MCP. They pick up tasks, hand work to each other over a message bus, run coding jobs and reviews, and get woken on a schedule. Our agents run on different model families and platforms, including Claude, Codex and Grok Bot, which have no native way to talk to each other. The bus is the shared channel where any of them can hand off a task, a blocker or a result, so we can pick the right model for each job and fail over between families without a human copying messages around.
That design is why this breach weighed on us. Every agent and service holds keys of its own. Most of our stack, including our control plane, the OCNexus API and the scheduler that wakes the agents, ran on Railway.
In October 2026, Railway, the platform where we built and hosted most of our services, was breached. An attacker got into Railway’s internal systems, read stored environment variables, and decrypted some of them. Environment variables are where we kept API keys, database passwords and tokens.
This was Railway’s breach, not ours. We have no evidence that anyone stole or misused one of our credentials. But Railway could not tell us whether our values were among the decrypted ones, so we treated every secret we had ever stored there as exposed.
Below are the timeline, our rotation order, why we moved to Google Cloud Run, our mistakes, and what our AI agents did versus what a human had to do. No secret values appear. Every snippet uses placeholders.
The short version
- Railway detected abnormal activity on Oct 20 and told customers to rotate everything on the evening of Oct 21.
- We did three things at once. We rotated secrets, moved Mission Control (our control plane) and the OCNexus API to Google Cloud Run, and removed the live Railway copies of those services. Some remaining Railway projects were later queued for deletion.
- Our worst self-inflicted problem was a scheduler gap of about 23.5 hours with no scheduled jobs.
- Providers disabled some of our keys as a precaution, including fresh replacements. We rotated some keys twice.
- All database passwords, live payment keys and remaining AI keys have been rotated. As of Nov 19, 2026, we have found no sign of misuse of our credentials.
Timeline
Built from Railway’s preliminary report, Railway’s Nov 10 incident report, the notices we received, our pull requests and our own logs. Times are Eastern (America/New_York).
| When (ET) | What happened |
|---|---|
| Oct 20, 9:58 AM | Railway’s monitoring pages its on-call team about abnormal activity. Railway dates the attack from here. |
| Oct 20, 11:52 AM | We approve a new Railway service for a worker test. Railway is still our plan at this point. |
| Oct 20, 1:03 PM | Railway declares an incident. Builds are halted. |
| Oct 21, 12:24 AM to 5:18 AM | Railway’s preliminary report says the attacker pulls secrets in encrypted form, reaches Railway’s CI credentials, and a subset of variables is decrypted. |
| Oct 21, 3:17 AM | We merge a small sign-in fix for OCNexus. Railway builds were also failing that morning, so the fix cannot ship. |
| Oct 21, 5:25 AM | Railway asks AI and other providers to revoke keys. |
| Oct 21, 7:51 AM | In response to the breach, our founder approves a spec to move from Railway to Cloud Run. |
| Oct 21, 10:22 AM | The cutover runbook is merged. At 10:38 AM all phases get a “go”. At 10:40 AM the warm standby period is cut to 3 days. |
| Oct 21, 7:15 PM | Railway’s “rotate everything” email reaches us. |
| Oct 21, 11:58 PM | An AI provider emails that it disabled one of our keys as possibly exposed. |
| Oct 22, morning | Rotation starts with new per-app AI keys, unused payment keys expired, Mission Control on Cloud Run restarted on new keys at 8:20 AM, OCNexus API on Cloud Run on a new key at 9:47 AM. |
| Oct 22, 12:22 PM | Our wiki publishing starts failing with a 401. GitHub had auto-expired our classic tokens after the exposure. We replace them with a fine-grained token. |
| Oct 22, 3:08 PM | The Railway copy of the OCNexus API is removed. The Cloud Run copy becomes the live one. |
| Oct 22, 7:10 PM | The last logged rotation of the day covers GitHub, secrets-manager tokens, and the AI keys for Mission Control and OCNexus. |
| Oct 23, 12:19 PM | Railway tells us our workspace looked like a target, because it held many variables. |
| Oct 23, 4:09 PM | Our payment processor deactivates an exposed key. |
| Oct 23, 5:40 PM | No rotations were logged all day. Work is waiting on approvals. Database passwords are still not rotated. |
| Oct 23 to 24 | Railway hands AI providers a batch of key hashes. Its status page later says the batch inadvertently included newer keys. |
| Oct 24, 9:36 AM | Railway is back up. Our engineering lead agent warns not to redeploy paused Railway services, because they still hold old secrets. |
| Oct 24, 10:17 AM | The Railway copy of Mission Control is removed. Its scheduler stops. |
| Oct 24, 10:33 AM to 2:06 PM | Nine deletions on Railway, covering 2 storage volumes and 7 projects, including 5 test projects. |
| Oct 25, 3:20 AM | Our founder approves switching the scheduler on in Cloud Run. |
| Oct 25, 9:48 AM | A config-only Cloud Run revision takes scheduler duty. 77 jobs are registered by 10:14 AM. |
| Oct 27, 7:03 PM | Our DNS and edge provider warns that some of our tokens were exposed and will be invalidated. It does not name Railway. |
| Oct 28, 7:00 PM | Those tokens are invalidated. Three live services are checked healthy on the replacement credentials. |
| Oct 28 to 29 | Seven more Railway projects are queued for deletion. On Oct 30 our founder confirms that all seven should go. |
| Oct 29 | Our misuse check finds no sign of misuse. A code change stops our secrets manager from restarting retired Railway workers. |
| Nov 10 | Railway publishes its fuller incident report. |
| Nov 19 | All database passwords, live payment keys and remaining AI keys are rotated. We have found no sign of misuse of our credentials. |
What happened at Railway
Railway’s preliminary report describes a chain. The attacker found a way to escalate privileges in Railway’s build systems. From there they reached internal systems, then Railway’s CI credentials, then the store of encrypted environment variables. A subset was decrypted. Railway believes the attacker was after AI provider keys. Railway said at most 1.85% of workspaces had variables potentially compromised. It asked providers to revoke far more keys than that, to be safe.
Railway also paused builds and deploys and invalidated its own API tokens. Running apps stayed up. Nobody could ship. On Nov 10, Railway published a fuller incident report. It said a specialist forensics firm’s investigation is still underway. As of Nov 19, Railway had not published a final report from that investigation.
Why it hurt us
Railway’s breach was the cause. These things on our side made it bigger or slower.
Too many powerful secrets on one host. Our rotation log included admin keys for AI providers, live payment keys, database passwords and service keys, GitHub App private keys, secrets-manager service tokens, an internal service key and signing secrets. Railway flagged our workspace exactly because it held so many.
Shared keys. One AI key served many apps, so every app had to change at once.
We could not see Railway while it was locked. With Railway’s API tokens invalid, we could not compare Railway’s variables with our secrets manager. When we last compared them, in June, Railway had 136 and our secrets manager had 114.
Secrets lived in more places than our list. When we moved the OCNexus API, we copied its 105 secrets once into Google Secret Manager. That copy is not a live sync. Every later rotation had to be done in two places.
The rotation order we actually used, and why
The textbook order starts with credentials that can create other credentials, then databases and service keys, then app keys. Our engineering lead agent gave us that advice later. Our real order was set by three pressures.
1. Whatever providers had already disabled. A disabled key is an outage, not a risk. The first went on the night of Oct 21. On the morning of Oct 22 we replaced the shared AI key with one key per app and restarted Mission Control and the OCNexus API on Cloud Run with the new keys.
2. Keys that let someone mint more keys. Next were the secrets-manager service tokens, the GitHub App private keys and the old classic GitHub tokens. These were done by 7:10 PM on Oct 22. If an attacker holds a token that can read your secrets manager, rotating anything else is pointless until that token is dead.
3. Things that would break a running Railway app. Railway was locked, so rotating a key a Railway app still used would break that app until deploys came back. Moving a service to Cloud Run freed its keys for rotation. That is why rotation and the move were tied together.
What we held back, and why:
- Database passwords. These were planned for a fixed window with a human at the keyboard. Rotating the Mission Control database password had a second job. It would fence the old Railway copy off the database, so only one copy could run jobs. They were not done by the evening of Oct 23. All database passwords have since been rotated.
- The internal service key our agents’ messaging uses. We kept the current value on purpose, to keep messaging up. The plan was one coordinated rotation, with code that accepts both the old and new key during an overlap window.
- Live payment keys and the remaining AI keys. These were listed as “later” on Oct 23. All of them have since been rotated.
Here is the overlap pattern we planned for that internal service key. This is an illustrative sketch, not our exact code:
// Accept the new key and the old key during a short overlap window.
// After every caller is on the new key, remove OLD.
import { createHash, timingSafeEqual } from 'node:crypto';
// timingSafeEqual throws if the two Buffers differ in length.
// SHA-256 digests are always 32 bytes, so compare digests, not raw keys.
const digest = (v: string): Buffer => createHash('sha256').update(v).digest();
const accepted: Buffer[] = [process.env.SERVICE_KEY_NEW, process.env.SERVICE_KEY_OLD]
.filter((k): k is string => Boolean(k))
.map(digest);
function isAuthorized(presented: string): boolean {
const presentedDigest = digest(presented);
return accepted.some((k) => timingSafeEqual(presentedDigest, k));
}
And here is the rule we wrote into the handoff for every rotation, names only:
For each secret NAME:
1. A human rolls the value in the vendor console.
2. Set the new value in the secrets manager (project/config: example-project/prd)
3. Set the same NAME in Google Secret Manager (example-project-<NAME>)
4. Redeploy the service that reads <NAME> by name.
5. Run one harmless read to prove it works.
Never print, paste or log the value. Refer to it by NAME only.
Why we moved to Google Cloud, and what it cost us
We moved because of the breach. On Oct 20 we were still adding services on Railway. On the morning of Oct 21, with Railway locked and our secrets assumed exposed, our founder approved the move to Cloud Run. That was hours before Railway’s “rotate everything” email arrived.
Why Cloud Run specifically:
- We were not starting from zero. Our OCNexus MCP server, the part agents connect to, was already running on Cloud Run.
- A clean start. A new platform meant new secrets, read by name, on infrastructure we were not worried about.
- It unblocked rotation. Every service that left Railway could have its keys rotated without being broken by Railway’s deploy freeze.
The tradeoffs:
- Speed over soak time. We cut the warm standby period to 3 days, leaving less time to catch problems.
- Two stores of the same secret. The one-time copy into Google Secret Manager gives every rotation two homes.
- An idle standby that still costs money. After the move, a standby tick service stayed up with one always-on instance. Its boot log said it would not schedule anything:
<ROLE_SETTING>=standby cannot own background scheduling
dispatcher_inactive_instance ... skipping all background schedulers
- The “never two owners” rule. This is the one that bit us. See the next section.
The scheduler gap
Our runbook had a sound rule. Scheduler ownership is never on in two places. Two copies running the same jobs means double billing runs, double messages and double writes. So Railway goes off before Cloud Run goes on. The problem was the time between “off” and “on”.
The Cloud Run copy of Mission Control ran with its scheduler off. The plan from Oct 22 was to switch it on once the database password rotation fenced Railway off. On Oct 24 at 10:17 AM, the Railway copy was removed and its scheduler stopped. Nobody had scheduled the Cloud Run switch for that moment.
The new scheduler came on at 9:48 AM on Oct 25. In those roughly 23.5 hours:
- No scheduled jobs ran at all.
- 91 internal messages for our engineering lead agent sat queued with zero delivery attempts.
The fix itself was tiny. It was a config-only revision on the same image. Here is the sanitized boot log from a later revision that holds the scheduler:
tick_jobs_registered
process_role=combined
scheduler_owner=true ("<SCHEDULER_SETTING> explicitly enables background scheduling")
deployment_role=primary
<OWNERSHIP_SETTING>=false
scheduler_build_registered build_id=<SERVICE>-<REVISION>
Every recurring job is wrapped in a lease, so a second copy would mostly fail to get the lock. The real shape from our code:
cron.schedule('* * * * *', leasedTick('lane_runner', runLaneRunner));
// leasedTick -> runWithSchedulerLease: fail-closed, plus a stale-build fence
// so older builds of the same service cannot take the lease.
A read-only review on Oct 26 found two more things:
- One job was not leased. A webhook retry worker ran one unleased tick at boot. A duplicate process would run that tick twice.
- A flag could split the scheduler. Our job-ownership manifest assigned two jobs to one role and a third to another. With the ownership flag off, one process ran all three. Turning it on would split them across two processes. The fix is to put related jobs under one owner, so “one scheduler” is structural, not a flag staying off.
# Illustrative: keep related jobs under one owner so a flag flip cannot split them.
jobs:
monitor_loop: { owner: scheduler-primary }
webhook_retry_worker: { owner: scheduler-primary }
lane_runner: { owner: scheduler-primary } # was assigned to a different role
Our liveness summary could not have warned us. It was already permanently red, because it still checked a job we had retired in mid-October, so a new failure looked the same as the old one.
Other mistakes, in detail
Rotation waited on approvals. On Oct 23 our executive assistant agent reported that rotation was still on hold, waiting for our founder. No rotations were logged that day. The vendor-console steps sat with a busy human.
A stale key could silently win. One app checked an app-specific key name first and a generic name second. If the app-specific variable held an old value, it won without any error. Illustrative:
// Before: two names, the first one found wins. A stale value never errors.
const key = process.env.APP_SPECIFIC_AI_KEY ?? process.env.GENERIC_AI_KEY;
// After: each app reads exactly one name, and fails loudly if it is missing.
const key = requireEnv('APP_SPECIFIC_AI_KEY');
The next step is planned but not finished. Each app will be pinned to its own key, read by exactly one name.
We rotated some keys twice. Around Oct 23 to 24, Railway gave AI providers a batch of key hashes that, in Railway’s words, “inadvertently included newer keys”. Some brand-new replacement keys were revoked, and on Oct 25 one AI key showed “unauthorized”. Rotating twice was annoying, but it was the right call.
A paused service still held a dead key. A paused Railway deploy for one product still carried a disabled AI key. An old sync from our secrets manager could restart retired Railway workers. On Oct 29 we merged a change that stops our secrets manager from pushing to or restarting those workers.
Our own tokens expired under us. GitHub auto-expired our classic tokens after the exposure. We found out when wiki publishing failed with a 401. GitHub was right to do it. We had not planned for it.
Our agents were blind to Railway. Every Railway read from our tools failed with “Not Authorized”. That covered the service list, the status check, the variable comparison and our own every-30-minutes sync job. A human had to check the Railway dashboard to see whether leftover services were stopped.
Cleaning up Railway
Our founder set the rule on Oct 23. List the test resources, and delete nothing until he has seen the list. On Oct 24 we used read-only Railway access, limited to that list, before the 9 deletions. Railway keeps deleted projects and volumes for 48 hours, and we relied on that window for the later batch.
A paused service is not a dead service. If it holds variables, it holds secrets, and something can start it again.
Agents versus humans
We run AI agents from more than one model family. Here is who did what.
What the agents did
- Built and kept the rotation log. By Oct 22 at 7:10 PM it had 41 items, with 22 done and 19 open.
- Wrote the cutover runbook and shipped the Cloud Run deploy workflow and config tooling on Oct 21.
- Flipped the scheduler on in Cloud Run on Oct 25, after our founder said “Fix the bug yourself”.
- Wrote a read-only review of the scheduler and secret sync on Oct 26, which found the unleased tick and the split risk.
- Ran the Oct 29 misuse check by comparing AI spend before and after the incident.
- Handed the remaining key work to a different model family on Oct 24, when one family’s coding agents were paused. The handoff listed every item by name, with no values, and who does each step.
Where a human had to step in
- Every vendor-console action. Only our founder rolls or revokes keys in a vendor dashboard. That guardrail held.
- Database password resets and deploy approvals.
- Every deletion.
- Things only the account owner can see. Per-key usage in provider consoles, and whether a new sign-in alert was his own.
- Checking Railway by eye, because our agents’ Railway access was broken.
- The refund request. We asked Railway for a refund. Railway said claims for model misuse go to the model providers, and offered no credit for anything else.
What we changed as a result
- Every handoff carries the same guardrails. It uses names only, never values. A human rolls keys. Deploys and data changes stay on a human’s approval card.
- A planned change pins each app to its own key, read by exactly one name.
- Read-only access, scoped to a written list, for any cleanup.
- Inventory first, delete second.
- An agent can be told directly to fix a bug. “Fix the bug yourself” ended the scheduler gap.
The weak spot was the handoff between them. The agents had prepared the work, but the human steps queued behind other work, and on Oct 23 nothing moved. The fix is a pre-agreed emergency rule.
What we’d do differently
- Pre-approve emergency rotation. When a provider says “rotate everything”, a standing rule should say which agent prepares what and which human window is booked, without a fresh yes.
- Schedule the handover as one window. New scheduler on in the same short window the old one goes off. Watch a heartbeat tied to live jobs. Build catch-up tools before removing the old copy.
- Rotate flagged keys right away, and plan to rotate again if the provider’s list changes. Waiting for a final list would have saved us one rotation, but it would have left possibly exposed keys live.
- Keep powerful secrets off the host. Admin keys, database passwords and signing keys do not belong in app environment variables.
- Make the second copy of a secret a sync, not a copy. Or have only one.
- Give the agents working read access to every platform we host on, so they are not blind on the one day it matters.
Checklist
This week
- List every secret by name, what uses it, and every place a copy lives.
- Give each app its own keys, read by one name only.
- Move admin keys, database passwords and signing keys out of app environment variables.
- Write down your rotation order. Start with key-minting credentials, then databases and service keys, then app keys.
- Decide who can approve an emergency rotation, in advance.
- Set per-key spending caps and alerts where providers allow it.
- Search for secrets in screenshots, front-end bundles and commit history.
Before you move a scheduler or any single-owner job
- Make “one owner” structural, not a flag.
- Lease every recurring job, including the first run at boot.
- Schedule “old off” and “new on” as one window, with a live heartbeat and tested catch-up tooling.
During cleanup
- Inventory first. Get the list reviewed. Then delete.
- Use the provider’s grace period.
- Delete paused services and their variables, and stop any sync that could restart them.