40 lines of zero-dependency Node: AES-256-GCM encrypt env vars before your PaaS leaks them

DavidWells · x · 2026-11-20

David Wells shares a "dumb-sounding trick that works": encrypt env var values before pasting them into Vercel or Railway, hardcode the decryption key in your source, decrypt at runtime. If the provider's control plane is popped (like Vercel's April and Railway's October env var breaches this year), attackers only get ciphertext.

Implementation is 40 lines of Node, zero dependencies, AES-256-GCM—the key lives in your code, the ciphertext on the host; neither is useful alone.

Original post →

More from coding & agent

coding & agent channel →