Railway says an attacker decrypted customer environment variables in October, searched for AI provider keys first, and ran up about $740,000 in unauthorized AI charges. If your iOS app's backend ran on Railway between October 18 and October 22, treat every secret there as exposed. List all variables in every service and environment, then rotate in a safe order: create the new key, deploy it, confirm it works, and only then revoke the old one. Start with AI and payment keys. Put a spend cap on every AI key, and keep provider keys out of the app bundle.
On November 10, Railway published the full report on the October break-in at its platform. An attacker escaped a build machine, worked through Railway's internal systems, and used a decryption credential to read customer environment variables. The queries looked for AI provider keys first. Railway estimates about $740,000 in unauthorized AI charges ran up on those keys, and it says up to 1.85% of workspaces, about 100,000, could have had environment variables decrypted.
A lot of small iOS apps keep their backend on platforms like Railway: a Node or Python service that holds the OpenAI or Claude key, sends push notifications, talks to Stripe or RevenueCat, and maybe runs a database. If that describes your app, this post walks through what Railway says happened, how to tell whether you are exposed, and the order to rotate things in so you don't break the app in the middle of fixing it. The last part covers how to set up your AI keys so the next leak, on any host, costs you a capped amount instead of an open-ended bill.
What Railway says happened
Railway's incident report has a minute-by-minute timeline in UTC. These are the parts that matter for an app developer.
- October 18: the attacker starts creating throwaway accounts.
- October 20, 07:28: an unknown vulnerability lets the attacker partly escape file isolation on a build VM and take a build credential.
- October 20, 13:50 to 15:30: with that credential, the attacker reads the stored histories of 353 builds through an internal Temporal instance. Railway says those histories included build variables, sealed variables among them.
- October 21, 03:26: a misconfigured OIDC binding hands the attacker short-lived cloud credentials.
- October 21, 04:07 to 05:21: the attacker queries the encrypted variables database, going after AI provider keys first.
- October 21, 04:42 to 07:15: the attacker decrypts some variables using a long-lived key found on an orchestration machine.
- October 21, 07:14: Railway disables cloud credentials and key decryption. By 09:25 it confirms the attacker's access has ended, and AI providers start receiving lists of keys that may be exposed.
- October 22, 22:49: builds are restored for all plans.
Railway also says the attacker took GitHub OAuth tokens and bring-your-own-key agent keys for 1,852 users, all of which it reset, and that it saw no logins using stolen credentials. It says customer databases were not accessed. Some of the attacker's queries also matched cloud, database and payment credential names, which is why the advice below covers more than your AI keys.
Railway calls the decryption step credential abuse rather than broken encryption. For you the difference is small. Your secrets were encrypted at rest, and someone who reached the right machine could still ask the system to decrypt them.
Why sealed variables didn't save anyone
Railway has a feature called sealed variables. According to Railway's docs, a sealed value is passed to builds and deployments but is never shown in the dashboard and can't be read back through the API or the CLI. It is a good feature for stopping a teammate or a leaked dashboard session from reading a key.
It doesn't protect against the platform itself being compromised, and the incident report says so in plain terms: the build histories the attacker read included sealed variables. Your service has to receive the real value at runtime, so somewhere inside the host the value exists in a form the host can produce. The same is true on every hosting platform. Treat any secret stored on a host as something that host can leak, and plan for what happens when it does.
Step 1: Work out whether you're in scope
Railway says it emailed the customers it considered high risk and notified every user whose linked-account tokens were affected. Search your inbox, including spam and any shared team address, for mail from Railway since October 21.
No email doesn't mean you're clear. The 1.85% figure is an upper bound on environments, and Railway says broad notification was held back while it checked impact. If your app's backend ran on Railway between October 18 and October 22 and any service had provider keys in its variables, assume they are exposed and rotate them. Rotating a key you didn't need to rotate costs you twenty minutes. Leaving a stolen key live can cost you the next month's revenue. Backdoored Claude Code Extension in Cursor: Check Your Mac, Then Rotate These iOS Keys has a rotation list for the keys that live on your own machine.
Also check whether you linked a GitHub account or added your own model key to a Railway agent feature. Railway reset those tokens, so you may have already seen broken deploys or a prompt to reconnect GitHub.
Step 2: Inventory every secret before you touch anything
The common mistake in a rotation is fixing the key you remember and missing the two you forgot. Before you rotate anything, write down every variable in every service and every environment of the project. That includes staging and preview environments, which tend to hold a copy of the production key "just for testing."
The Railway CLI can list variables for a linked project. Its docs list railway variable list, plus global -s, --service and -e, --environment options. Run railway variable --help first to confirm what your CLI version supports, then loop over services and environments:
#!/usr/bin/env bash
# list-railway-vars.sh: print variable NAMES per service and environment.
# Values are not printed. Sealed variables are not returned by the CLI,
# so add those to the list by hand from the dashboard.
set -euo pipefail
SERVICES=("api" "worker" "cron") # edit to match your project
ENVIRONMENTS=("production" "staging") # include preview/PR environments
for env in "${ENVIRONMENTS[@]}"; do
for svc in "${SERVICES[@]}"; do
echo "== $env / $svc =="
railway variable list -s "$svc" -e "$env" --json 2>/dev/null \
| python3 -c 'import json,sys; d=json.load(sys.stdin); print("\n".join(sorted(d)))' \
|| echo "(could not list; check flags with: railway variable --help)"
done
done
Because sealed values don't come back through the CLI, open each service's Variables tab in the dashboard and add any sealed names to your list by hand.
Then put the list in a table with four columns: the variable name, which provider issued it, what breaks if it stops working, and whether the iOS app depends on it directly. For a typical AI-powered iOS app the list usually looks something like this:
- AI provider keys: OpenAI, Anthropic, Google Gemini, OpenRouter, or a Bedrock access key.
- Payments: a Stripe secret key, RevenueCat secret API key, or App Store Server API key used to check subscriptions.
- Apple keys: the APNs auth key (.p8) for push, a Sign in with Apple private key, an App Store Connect API key used by CI.
- Database URLs and passwords, including any external database the service connects to.
- Webhook signing secrets, JWT signing keys, and session secrets.
- Third-party tokens: email sending, analytics write keys, S3 or R2 access keys, GitHub tokens used by deploy scripts.
If you also keep a local .env or a CI secrets store, compare names against it. A quick search over a repo for key-shaped names helps catch the ones nobody wrote down:
grep -rEn --exclude-dir={.git,node_modules,Pods,DerivedData} \
'(OPENAI|ANTHROPIC|GEMINI|OPENROUTER|STRIPE|REVENUECAT|APNS|AWS|R2|SUPABASE|DATABASE_URL|JWT|WEBHOOK)[A-Z_]*' .
Pay attention to any hit inside the Xcode project itself, such as a Swift file, an Info.plist or an .xcconfig. That's a separate problem, covered in Step 6.
Step 3: Rotate in an order that keeps the app running
If you revoke the old key first, your backend fails until the new one is deployed, and your iOS users see errors. The safer order for each secret is:
- Create the new key at the provider. Most providers let you keep more than one active key.
- Update the variable in Railway. Railway's docs say variable changes are staged and only apply after you review and deploy them, so deploy the change.
- Confirm the new deployment works: hit a health endpoint, send a test push, make one AI request from a test build.
- Revoke the old key at the provider.
- Note the time you revoked it, so you can match it against usage graphs later.
Start with the secrets that cost money when abused: AI keys and payment keys. Then do database credentials and signing keys, and leave low-value tokens for last.
A few secrets need extra care because the iOS app depends on them directly.
For the APNs auth key, create a new key in your Apple Developer account under Certificates, Identifiers & Profiles, then Keys, with Apple Push Notifications service enabled. Put the new .p8 contents, key ID and team ID into your backend, confirm a push arrives on a real device, then revoke the old key there. The app itself doesn't need an update, because device tokens don't depend on which auth key your server signs with.
For a JWT or session signing secret, swapping it signs everyone out. If your app keeps users signed in with a token your backend issued, either accept that everyone logs in again, which is a reasonable price after a breach, or have the server accept both the old and new secret for a short window while it issues new tokens.
For webhook signing secrets from Stripe or RevenueCat, roll the secret at the provider and update your server in the same sitting, or you'll drop subscription events and users who paid won't get access.
Railway's own follow-up advice also says to redeploy your latest commit, reconnect GitHub, and recreate CLI and CI credentials. Railway project tokens used in GitHub Actions are easy to forget, so add them to your list.
A two-secret window, and when not to use it
Step 3 mentions letting the server accept both the old and the new signing secret for a short time. Here is that idea as code, so you can see how small it is. It signs every new token with the newest secret, accepts a token signed with the previous one, and tells the caller when to hand back a fresh token. It uses only Node's built-in crypto module.
// rotate-secret.mjs: sign with the newest secret, and accept the previous one
// for a short window. HS256 only, Node's built-in crypto, no dependencies.
import { createHmac, timingSafeEqual } from 'node:crypto';
const b64url = (value) => Buffer.from(value).toString('base64url');
const mac = (data, secret) => createHmac('sha256', secret).update(data).digest();
export function sign(payload, secret) {
const head = b64url(JSON.stringify({ alg: 'HS256', typ: 'JWT' }));
const body = b64url(JSON.stringify(payload));
return `${head}.${body}.${mac(`${head}.${body}`, secret).toString('base64url')}`;
}
// secrets: newest first. Returns null, or the payload plus a flag that tells
// the caller to send back a fresh token signed with the newest secret.
export function verify(token, secrets, now = Date.now() / 1000) {
const [head, body, sig] = token.split('.');
if (!head || !body || !sig) return null;
if (JSON.parse(Buffer.from(head, 'base64url')).alg !== 'HS256') return null;
const given = Buffer.from(sig, 'base64url');
for (const [index, secret] of secrets.entries()) {
const expected = mac(`${head}.${body}`, secret);
if (given.length === expected.length && timingSafeEqual(given, expected)) {
const payload = JSON.parse(Buffer.from(body, 'base64url'));
if (typeof payload.exp !== 'number' || payload.exp < now) return null;
return { payload, reissue: index > 0 };
}
}
return null;
}
It was run with Node 22.17.0 and Node's built-in test runner, and seven checks passed. A token signed with the old secret is accepted while both secrets are listed, and it is flagged for reissue. A token signed with the new secret is accepted and not flagged. The old token is rejected once the old secret is removed from the list. A tampered payload, an expired token, a token with no expiry and a token that claims alg: none are all rejected.
Now the part that matters after a breach. This window is for routine rotation, when the old secret is retired on schedule and nobody else has it. If the old secret sat in an environment variable that may have been decrypted, anyone holding it can sign a valid token for any user for as long as your server keeps accepting it. In that case skip the window, deploy with only the new secret and let everyone sign in again. That is the first option in Step 3, and for anything exposed in this incident it is the right one.
If you already use a JWT library, keep it. The part to copy is the loop: try the newest secret first, fall back to the previous one, and reissue.
Step 4: Check what was spent, and file the claim
Open each AI provider's usage page and look at daily spend from October 20 onward. Look for a sudden jump in requests, calls to a model your app doesn't use, or traffic at hours when your users are asleep. If your provider lets you break usage down by API key, look at the key that lived on Railway.
Railway's report lists how each provider is handling refunds:
- AWS Bedrock and Google Gemini: their existing fraud refund policies, started by account teams.
- OpenAI: you open a support case and pass the case ID to Railway, and it is reviewed case by case.
- Anthropic: still in discussion, and Railway covers the cost of breached keys in the meantime.
- OpenRouter: it enforces a no-refund policy, so Railway covers the related costs.
Railway says it will cover token losses where providers won't, and it asks customers to report charges they didn't make through its form. Gather the evidence before you file: screenshots of the usage graph, the key's last four characters, the date range, and the time you revoked it. Contact Railway support at station.railway.com if you're unsure whether you were affected.
Check the non-AI providers too. Look for Stripe API requests you don't recognize, new database users or unexpected connections, and any cloud storage bucket that suddenly has more objects or more egress.
Step 5: Put a ceiling on every AI key
A leaked key with no spending limit can bill until someone notices. Setting a cap now doesn't stop the next leak, but it turns the damage into a known amount.
On the Claude Platform, workspaces are the tool for this. Anthropic's docs say each workspace can have its own members, API keys and limits. You set a monthly spend limit, with alerts at thresholds, from the Workspaces page in the Claude Console by selecting the workspace and clicking Spend limits. Rate limits per model are set under Rate limits in the Console. Two details from the docs matter here: you can't set spend limits on the Default Workspace, and a workspace limit can be lower than the organization's limit but never higher.
A layout that works well for a small iOS team:
- One workspace per app and per environment, for example
myapp-prodandmyapp-staging, each with its own keys. - A spend limit on each set a little above your real monthly spend. If production normally costs $120 a month, a $200 cap with an alert at $150 gives you room for a good month while making abuse obvious.
- A much lower cap on staging, since nobody needs staging to spend production money.
- No production keys in the Default Workspace, because it can't have a spend limit.
Anthropic's docs also say API responses carry an anthropic-workspace-id header, so your backend logs can record which workspace each request billed to. That makes it much faster to tell, during an incident, whether the spike came from your key.
For other providers, look for the equivalent: per-project keys, per-project budgets and usage alerts. Set them up the same way, one project per app and environment, and check what each provider's limits do when you hit them, since some send an alert and keep billing while others block requests.
Step 6: Keep long-lived AI keys off the host and out of the app
A longer-term fix is to keep fewer long-lived keys anywhere. Two Apple-side tools help.
Never put a provider key in the app bundle
If Step 2 turned up an AI key inside your Xcode project, fix that first. Anything in an app binary can be pulled out by anyone who downloads the app, and you can't rotate it without shipping a new build through App Review. A key on a server can be swapped in minutes. A key in a binary stays exposed on every installed copy until users update. AI Agents Took 300+ iOS Signing Certificates From 10 Shops. Audit Your Own .p12 Files covers the same problem for signing files.
Tools that generate apps from a prompt often put the key in a Swift constant to get a demo working, and it survives into the submitted build. Move the call to your backend, or use the attested route below.
Use App Attest so only your real app can call your backend
Apple's App Attest service, part of the DeviceCheck framework, lets your server check that a request came from a genuine copy of your app on a real Apple device. Apple's article "Establishing your app's integrity" describes the flow: check DCAppAttestService.shared.isSupported, create a hardware-backed key with generateKey(completionHandler:), have Apple attest it with attestKey(_:clientDataHash:completionHandler:) using a one-time challenge from your server, then sign sensitive requests with generateAssertion(_:clientDataHash:completionHandler:).
A minimal client sketch, adapted from the calls in Apple's article. It type-checks with Xcode 26.2 against the iOS 26.2 simulator SDK in Swift 5 and Swift 6 modes, but it has not been run against a real server, so treat it as a starting point:
import DeviceCheck
import CryptoKit
final class AttestedClient {
private let service = DCAppAttestService.shared
private let keyIdDefaultsKey = "appAttestKeyId"
func signedHeaders(for body: Data, challenge: Data) async throws -> [String: String] {
guard service.isSupported else { return [:] } // fall back gracefully, per Apple
let keyId = try await existingOrNewAttestedKey()
var clientData = challenge
clientData.append(body)
let hash = Data(SHA256.hash(data: clientData))
let assertion = try await service.generateAssertion(keyId, clientDataHash: hash)
return ["X-Attest-Key-Id": keyId,
"X-Attest-Assertion": assertion.base64EncodedString()]
}
private func existingOrNewAttestedKey() async throws -> String {
if let saved = UserDefaults.standard.string(forKey: keyIdDefaultsKey) { return saved }
let keyId = try await service.generateKey()
let challenge = try await fetchChallengeFromServer() // at least 16 random bytes
let hash = Data(SHA256.hash(data: challenge))
let attestation = try await service.attestKey(keyId, clientDataHash: hash)
try await sendAttestationToServer(keyId: keyId, attestation: attestation)
UserDefaults.standard.set(keyId, forKey: keyIdDefaultsKey) // store only after the server verifies
return keyId
}
private func fetchChallengeFromServer() async throws -> Data { fatalError("implement") }
private func sendAttestationToServer(keyId: String, attestation: Data) async throws { fatalError("implement") }
}
The check only works if your server verifies it. Apple's companion article, "Validating apps that connect to your server," explains how to verify the attestation and each assertion. Apple's guidance includes a few points that are easy to get wrong:
- Not every device supports App Attest, so the app should check
isSupportedand your server has to decide how to treat requests from devices that can't attest. - Most app extension types aren't supported even when
isSupportedreturns true. Apple lists action, extensible SSO and watchOS extensions as the supported ones. - Keys survive app updates but not reinstalls, device migration or restoring from a backup, so expect to attest again in those cases.
- If your app already has millions of daily users, Apple asks you to read its guidance on ramping up before you turn attestation on for everyone.
App Attest doesn't remove the provider key from your server, but it stops anyone who finds your backend URL from using it as a free AI proxy. Pair it with per-user rate limits and the spend caps from Step 5.
For Claude calls, skip the server key entirely
Anthropic now documents an App Attest option for apps that call the Claude API directly from the device. According to the Claude Platform docs, each install proves it is a genuine build through Apple's App Attest, and Anthropic then issues a short-lived token that bills to your workspace. The app ships no API key and you run no proxy. The tokens are scoped to one workspace, expire after an hour, and only authorize Messages API calls.
There are limits to know before you plan around it. It works through Anthropic's Claude for Foundation Models Swift package, which the docs describe as beta and requiring the OS 27 betas, with APIs that might change. It needs a physical device, since the Simulator can't do App Attest, so you use a normal API key while developing. It isn't available through Amazon Bedrock, Google Cloud or Microsoft Foundry. Setup means adding the App Attest capability under Signing & Capabilities in Xcode and creating an app integration in the Claude Console with your Team ID and bundle IDs. If an app is compromised you can revoke the integration, which kills its outstanding tokens; that is permanent, so you'd create a new integration to restore access.
Because those tokens bill to a workspace, put the integration in a workspace with a spend limit. That combines Steps 5 and 6: no long-lived key to steal from a host, and a ceiling if something still goes wrong.
See what your own build gives away
The claim that anything in an app binary can be pulled out is easy to test on your own build. A small Swift program was compiled with optimization on Swift 6.2.3 and then stripped. It held two made-up keys: one as a plain string constant, and one split into three pieces joined with +, a trick sometimes suggested for hiding a key. A third made-up key was placed in a binary Info.plist next to it.
One standard command, strings, printed both keys from the stripped binary in full. The compiler had joined the three pieces back into one string. The script below wraps that check for a whole app bundle. It looks for the prefixes that common providers use and prints only the first 12 characters of each match.
#!/usr/bin/env bash
# scan-app-for-keys.sh: look for provider key prefixes inside a built .app
# or an unzipped .ipa. Usage: ./scan-app-for-keys.sh path/to/MyApp.app
# Prints the file and the first 12 characters of each match, not the whole value.
set -u
APP="$1"
PATTERN='sk-ant-[A-Za-z0-9_-]{8,}|sk-proj-[A-Za-z0-9_-]{8,}|sk-or-[A-Za-z0-9_-]{8,}|AIza[A-Za-z0-9_-]{20,}|sk_live_[A-Za-z0-9]{8,}|rk_live_[A-Za-z0-9]{8,}|AKIA[A-Z0-9]{16}|BEGIN (EC |RSA )?PRIVATE KEY'
found=0
while IFS= read -r -d '' f; do
hits=$(strings -a "$f" 2>/dev/null | grep -oE "$PATTERN" | cut -c1-12 | sort -u)
if [ -n "$hits" ]; then
found=1
printf '%s\n' "$hits" | while IFS= read -r h; do echo "$f: $h..."; done
fi
done < <(find "$APP" -type f -print0)
[ "$found" -eq 0 ] && echo "no known key prefixes found in $APP"
exit "$found"
On the sample bundle it printed:
Demo.app/Demo: sk-ant-api03...
Demo.app/Demo: sk-or-v1-EXA...
Demo.app/Info.plist: sk-proj-EXAM...
On a bundle with no keys it printed "no known key prefixes found" and exited with status 0, so it can run as a step before you upload a build. Point it at the .app inside your archive, or at an unzipped .ipa.
Read the results with two things in mind. A Firebase key from GoogleService-Info.plist starts with AIza and is meant to ship in the app, so that hit is expected. Check the key's restrictions in the Google Cloud console and move on. And a clean result only means none of these prefixes appear as plain text. A key that is encoded or assembled at runtime will not show up here, and someone who runs the app under a debugger can still recover it. The fix is the one in Step 6: keep the key on a server, or use attestation.
A checklist to keep in the repo
Write this down where the next person on the project will find it, such as a SECURITY.md or the README of the backend repo:
- Every secret is listed with its provider, what breaks without it, and the date it was last rotated.
- The rotation order is written down for each one, especially the APNs key and signing secrets.
- Each AI provider key lives in its own project or workspace per app and environment, with a spend cap and an alert.
- No provider keys in the Xcode project,
.xcconfigfiles orInfo.plist. - Backend endpoints that spend money require App Attest assertions or another check that the caller is your app.
- Staging and preview environments use separate keys with low caps.
- Someone owns watching the security emails from your host and providers.
If you use a coding agent on the project, put the same rules in its instructions file so it doesn't paste a key into Swift to make a demo work. The Claude Code + Xcode: The Production iOS Workflow Kit is Jerry PM's copy-ready Claude Code setup for SwiftUI and UIKit projects (6 commands, 10 agents, 8 rules and a runnable Xcode sample, per the product page), and its rules file is a natural place to add a line like "never put provider keys in the app target."
FAQ
Were Railway customer databases read?
Railway's report says customer databases were not accessed. Database credentials stored as environment variables are a different matter: some of the attacker's queries matched database credential names, so rotate those passwords anyway.
My app only uses Railway for a small cron job. Do I still need to rotate?
If that job's variables held any provider key, yes. The attacker searched by key name, not by how important your service looked.
Should I move off Railway?
That's your call, and moving hosts doesn't remove the risk, since any host has to give your service its secrets at runtime. Railway lists changes it has made, including one ephemeral VM per build, central audit logging of encrypt and decrypt operations, and services that can only decrypt their own credentials. Whatever host you use, the caps and attestation above limit the damage.
Does a sealed variable need re-sealing after rotation?
Railway's docs say you edit a sealed variable from its menu, not from the Raw Editor, and that sealing can't be undone. After you rotate, the new value stays sealed when you edit it there.
Can someone really read a key out of my app binary?
Yes. In a test for this post, the strings command printed two made-up keys in full from an optimized, stripped Swift binary, including one that had been split into three pieces in the source. Anything the app needs at runtime is in the bundle or reachable from it.
Keep reading on JR Devhub
- Claude Code's "Don't Ask Again" Can Save Your Passwords. Find Them in Your iOS Repo and Clean Up
- A Ruby Gem Worm Writes CLAUDE.md and AGENTS.md Into Your Repos. What iOS Teams Using Fastlane Should Check
- OpenAI's $1.2M Run Produced 948 Linux Root Exploits. What to Change on Your Servers and CI
- Render Sandboxes Can Run With No Time Limit. 7 Things to Check Before You Leave an Agent Running
Sources
- Railway: Incident report, October security incident (Nov 10, 2026)
- Railway: Preliminary report, October security incident
- Cyber Security News: Railway details data breach (Nov 10, 2026)
- Railway Docs: Variables (sealed, shared and reference variables)
- Railway Docs: CLI reference
- Claude Platform Docs: Workspaces and workspace limits
- Claude Platform Docs: App Attest for iOS and macOS apps
- Apple Developer: Establishing your app's integrity
- Apple Developer: Validating apps that connect to your server

Comments