Every Saturday I share one shortcut you can run in under an hour. This week’s comes from someone else’s bad week: on October 21, Railway told its customers that an attacker may have read decrypted environment variables, and asked everyone to roll every API key they stored there.
“Rotate every key” sounds like a ten-minute job. It isn’t, because the hard part is not making a new key. It’s finding every place the old one lives and every job that breaks when it dies. So I did the dry run on one of my own agent containers, without touching a single secret value. That’s the shortcut: do your API key rotation map before a vendor makes you do it in a panic.
The receipt: 33 secret names, 29 actual secrets, 8 that nothing in my code mentions
I listed every environment variable whose name looks like a secret (KEY, TOKEN, SECRET, PASSWORD), then searched 118 skill files and scripts for each name. Names only. No values were printed.
- 33 secret-shaped names, after dropping two false positives (a table ID and a budget setting that happen to contain “KEY” and “TOKEN”).
- 4 keys are stored twice under different names. I compared hashes of the values, not the values. The email verifier, the scraper, the bounce checker and GitHub each have two names pointing at the same secret. Rotate one name and forget the other, and half your jobs quietly keep the old key.
- The Airtable key appears in 29 files. Metricool’s token appears in 17, the WordPress app password in 12. Those are the rotations that need a checklist, not a guess.
- 8 names appear in zero files. Four are the duplicates above. Two are read by tools implicitly (the GitHub CLI picks up its token without anyone writing its name). Two have no reader I can find. Those last two get revoked, not rotated.
- 1 name is referenced and empty: a music API key for a pipeline I deleted in May. The code still mentions it; the secret is gone.
None of that was visible from the dashboard where I made the keys. It only shows up when you look from the code’s side.

⚡ 取得人工智慧優勢
每週提供真正省時省錢的AI小技巧。沒有廢話,沒有誇大其詞——只有切實有效的方法。.
3 shortcuts for API key rotation
- Build the map from names, never values. 跑步
env | cut -d= -f1(or open your .env file and read only the left side), keep anything that looks like a credential, then search your scripts, skills and workflows for each name. You end up with one table: key, files that use it, count. Sort it by count. The top three rows are where a rotation goes wrong, so they get a written order of steps. - Collapse the aliases before you need to. If two names hold the same secret, pick one, point every file at it, and delete the other. You can check for duplicates safely by hashing each value (
printenv NAME | sha256sum) and comparing the first few characters. Same hash, same key. I found four pairs in a container I thought I knew well. - Rotate in this order: new key, every place, test call, then revoke. Create the new key while the old one still works. Update every location on your map. Make one cheap read call per service (a “who am I” or list endpoint) with the new key. Only then revoke the old one. And keys nothing references? Revoke those first. A key with no reader is pure risk with no job attached.
Two things this doesn’t cover. First, copies outside the container: a vendor dashboard, an n8n credential, a teammate’s laptop. Add a “lives where” column to the map for those. Second, it doesn’t tell you whether a key was already used by someone else. That’s what the vendor logs are for, and Railway’s notice asks you to check them.
If you want the bigger picture of what a container like mine can and can’t reach, I wrote up what four months of unattended container runs taught me about sandboxing. And for the weekly habit that catches dead keys before they fail a run, there’s the 20-minute credential check.
The two orphan keys are on my revoke list today. Want a second pair of eyes on how your agents hold their secrets? 預約策略會議 and we’ll draw your key map together.
下週六見。.
喬恩

📥 免費:《人工智慧劇本》
我用來經營一人代理公司的所有工具和工作流程。 25 年的行銷經驗濃縮成一份實用指南。免費贈送。.
