December 19, 2025
When "__proto__" hits the fan
Property-Based Testing Caught a Security Bug I Never Would Have Found
Random test hits a weird word; internet fights: real risk or nothing-burger
TLDR: Random testing flagged a "__proto__" glitch in AI-written storage code—no active hack, but a real edge-case trap. Commenters are split between calling it a nothing-burger and praising it as a cautionary tale: don’t trust AI blindly, and always test the weird stuff.
An AI-assisted dev used property-based testing—random inputs to stress-test code—and on run #75, a bizarre provider name, "proto", blew up a simple save-and-read flow in a chat app’s storage. The post says it’s not a live exploit, but a real "gotcha" that could cause subtle errors later. Cue the crowd: one camp is cackling that this is a classic JavaScript landmine, the kind you only find when you poke the edges. Another camp is rolling its eyes at the drama. As commenter mananaysiempre snarked, "obj[key] with user-controlled key == 'proto' is the gift that keeps on giving"—then joked the tool both writes the bug and writes the test to catch it. Mhitza chimed in that, yes, the test did its job, but questioned whether the "random" strings secretly include known troublemakers, and whether calling it a vulnerability is a stretch. Sublinear went full "so what?" saying there’s no actual hack here and web devs already know this trap. Meanwhile, philipwhiuk side-eyed the claim that devs assume AI handles edge cases with a simple: "Do we?" The memes flew: "proto-pocalypse," "round-trip to nowhere," and "75 tries to meet your villain." Whether you think it’s a scare or a savior, the takeaway is simple: test weird inputs, especially if AI wrote your code, because the internet definitely will find them.
Key Points
- •A storage service for a chat app saved API keys to browser localStorage using provider names as keys.
- •A round-trip correctness property required that a saved key be retrieved unchanged for any provider/key strings.
- •Property-based testing with fast-check in TypeScript failed on the 75th run when the provider string was “__proto__.”
- •The failure revealed mishandling of JavaScript prototypes, indicating a security-relevant edge case.
- •The article details the specification, flawed implementation, how PBT found the issue, and the fix to address it.