Deep dives on API key security, secret management, and developer tooling.
Every developer knows the feeling. You paste an API key into your code "just for testing," it ends up in a git commit, and seconds later it's live on GitHub. Bots scan repos constantly. Your bills spike. You rotate. Repeat next month.
There are two categories of tools that help with API key security:
What's missing is the middle: what if the key leaks, but it's already useless?
Worthless splits your API key into two cryptographic shares. Neither share reveals anything about the original key โ you need both to reconstruct it. Reconstruction happens in memory only, for milliseconds, and only when your app actually needs to make an API call.
$ worthless lock
1 key(s) protected.
$ worthless wrap python app.py
# your code is unchanged
$ worthless unlock
1 key(s) restored.
There's also a budget enforcement layer: if your spending limit is hit, the key simply never forms โ even if your code tries to use it. A hard stop.
"Every secrets tool protects the key until your app uses it. Worthless protects you after it leaks."
pip install worthless
worthless lock
worthless wrap python app.py
When we say "a leaked share is worthless," we mean it in a precise mathematical sense. This post explains why โ without requiring a cryptography background.
Imagine a padlock that requires two keys simultaneously to open. If someone steals one, they can't open the lock. They have something real โ but it's useless without the other half. Secret sharing is the mathematical equivalent.
Reconstruction: S = A XOR B. Simple. Brilliant.
Because A is purely random. An attacker with only A sees that every possible value of S produces a valid B โ the share A is statistically independent of S. It could have come from any secret equally well.
When you run worthless lock: your key is read, Share A is generated randomly, Share B is derived so A XOR B = key. A goes to local encrypted storage; B lives in proxy memory. Your .env is updated to point at the proxy. The full key exists for milliseconds, then memory is zeroed.
API key leaks are more common than people admit. Most companies quietly rotate and move on. Here are five categories of real incidents that show exactly how these leaks happen and what they cost.
A founder adds their OpenAI key to .env while scaffolding a demo, runs git add . before adding .env to .gitignore, and pushes to a public repo. Within 4 minutes, a bot catches it. By the time they rotate, $2,300 in credits is consumed.
With Worthless: the .env would contain only a useless key share.
A popular npm package is compromised via a maintainer account takeover. The malicious version reads process.env and exfiltrates all environment variables. Hundreds of developers lose keys within hours.
With Worthless: the exfiltrated env var would be a key share โ useless without the other half in a separate process.
A developer uses echo $AWS_SECRET_KEY to debug a failing CI step on a public repo. The log is visible to everyone. A scraper catches it in 30 minutes. An EC2 fleet is spun up for crypto mining. Bill: $14,000 in 48 hours.
With Worthless: the exposed env var would be a random-looking share. Logging it leaks only meaningless data.
A contractor keeps a copy of the .env after leaving. Three months later, the company discovers the Stripe API key has been used to pull transaction data. They had access for months before anyone noticed unusual API activity.
With Worthless: the contractor's copy contains a share tied to a local proxy โ which is no longer running. Worthless without the other half.
A developer files a GitHub issue with a terminal screenshot that includes a Sendgrid API key partially visible in the corner. It's on a public issue for 6 days before anyone notices.
With Worthless: the visible string would be a random-looking share. A screenshot exposes nothing usable.
In every case, the attacker got a real, complete API key stored in plaintext. Worthless changes that โ what gets leaked is never the whole key.
pip install worthless
worthless lock
worthless wrap python app.py