CS Fundamentals Trainer · JavaScript · Security
Which of these reduce the risk of prototype pollution when handling user-controlled keys?
- Storing the data in objects created with `Object.create(null)`
- Wrapping the merge function in `try...catch`
- Using a `Map` instead of a plain object for the lookup table
- Skipping the keys `__proto__`, `constructor` and `prototype` in merge or set-by-path helpers
- Parsing the request body with `JSON.parse` instead of `eval`
Difficulty: medium