One write to Object.prototype changes every object
Property lookup checks the object's own keys, then walks [[Prototype]] until it reaches null
Before the merge
session
user: "eve".isAdmin → undefinedconfig
port: 8080.isAdmin → undefined{}
(no keys).isAdmin → undefinedtoString, hasOwnProperty, …After merge({}, JSON.parse(body))
session
user: "eve".isAdmin → trueconfig
port: 8080.isAdmin → true{}
(no keys).isAdmin → truetoString, hasOwnProperty, …isAdmin: trueNone of the three objects was touched. The request body only had to reach a merge that walked into __proto__.
