The function below performs a deep merge of two objects, but it is vulnerable to prototype pollution — one of the most dangerous Node.js security issues.
The bug: an attacker can pass { "__proto__": { "admin": true } } as the source, and the admin property gets injected onto every object in the process — including ones that should not have it.
Your task: fix solve(target, source) so that:
__proto__, constructor, and prototype are silently skipped.solve({ a: 1 }, { b: 2 })
// → { a: 1, b: 2 } ✅
solve({}, { "__proto__": { "admin": true } })
// → {} ✅ (prototype NOT polluted — {}.admin stays undefined)Sample tests