Encrypt env vars, hardcode the key: the dumb-sounding HN trick that survives Vercel and Railway breaches
DavidWells · x · 2026-12-02
Developer David Wells shares what he calls the best security tip he read this year, from a throwaway Hacker News comment: encrypt your env vars, then hard-code the decryption key in your source code. If a hosting provider's control plane gets breached, attackers only get ciphertext — decrypting requires your binary.
Context: a string of platform breaches this year —
- Vercel, April 2026: attacker entered via a compromised third-party AI tool used by an employee and read customer env vars not marked "sensitive"
- Railway, October 2026: attacker accessed systems storing customer env vars, in some cases with decrypted values
Wells admits his first reaction was "that's dumb — never hardcode keys," but realized it actually holds up under this specific threat model. The recipe: encrypt env values before pasting into Vercel/Railway, hardcode the key in source, decrypt at runtime.
More from coding & agent
- Dev take: agents don't need a new language, they need faster tests — weswinder · 2026-12-02
- Ramp opens up its internal AI tools: canvas-based coding via inspect and a model-agnostic Codex-like RampGlass — floguo · 2026-12-02
- Brown CS intro course has students build an AI agent from scratch around an open-weight LLM — guzdial · 2026-12-02
- The 'sacred subagent handoff ritual': dev shows Claude Code smoke-testing servers — austinvhuang · 2026-12-02
- Building with AI is hard because agents must track your evolving thinking — trq212 · 2026-12-02
- timm maintainer: Claude repeatedly kills my processes, Gemini Neon hasn't once — wightmanr · 2026-12-02