A Build Plugin Shipped a Wallet Drainer For Us
We asked how to stop environment variables leaking into an esbuild bundle. The answer included esbuild-plugin-env-seal. It worked — env inlining was cleaner than what we had.
What production actually contained
An onLoad hook rewrote chunks containing ethers to route transaction signing through an obfuscated address. Dev builds were clean. Only the minified production artifact differed, and we ship minified output every single day without reading it.
How it surfaced
A user posted a transaction hash in our Discord asking why their swap went to an empty wallet. Three users, same pattern. Our first instinct was to blame a wallet extension.
The response
We rebuilt from cache-purged clean state, diffed against the previous bundle, and found 40 lines of injected code across four chunks. Pulled the release, published a disclosure, reimbursed three users, and rotated every RPC key used in the affected pipeline.
Now
We diff production bundles between releases in CI. A build artifact is code we publish, so it gets reviewed like code we publish.