Cloning Proxy-wrapped objects with _.cloneDeep in Lodash 4.x: expected behavior vs observed outcome
0 reputation · 13 Mar 2020, 13:42 UTC
Determine whether Lodash 4.x's _.cloneDeep produces a truly detached copy when the source value includes Proxy‑wrapped objects, functions, DOM nodes, or WeakMap entries.
Because the algorithm treats uncloneable values as plain objects and does not invoke Proxy traps, it is unclear whether the resulting clone retains any behavioral link to the original handler, and whether treating the output as a security boundary for capability‑bearing data such as expired credentials is safe.
Does _.cloneDeep replace a Proxy with an empty plain object or preserve its target? Does the clone retain any internal reference to the original Proxy's handler? Should teams consider the cloned output a safe data boundary for security‑sensitive payloads, or must they rebuild Proxy‑wrapped objects manually?