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 —

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.

Original post →

More from coding & agent

coding & agent channel →