Plenty of Node apps have a small deep-merge helper somewhere in utils/ . It takes a user's settings JSON, merges it over the defaults, and returns the result. It's ten lines long, it looks harmless, and with the right payload it can add a property to every object in the process.
That's prototype pollution. This post is the developer side of it: what the bug is, where it hides, how to fix it so the fix holds, and a small test suite that proves the fix instead of hoping. Everything below runs on your own machine with stand-in data. Only test systems you own or are authorized to test.
What prototype pollution is
Almost every JavaScript object inherits from Object.prototype . When you read a property an object doesn't have, the runtime walks up the prototype chain and checks there.…