Skip to content
Myr

Harden against prototype pollution (#1223)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sindre Sorhus · committed by GitHub · parent 6ad1a6e · Browse files · 4 files+27 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

4 files+27 added−8 removed

  • other:+27 added−8 removed

4 files+27 added−8 removed

modified:lib/arguments/options.js+6 added-2 removed
modified:lib/methods/bind.js+5 added-3 removed
modified:lib/methods/node.js+14 added-2 removed
modified:lib/methods/parameters.js+2 added-1 removed
25 unmodified lines
26 if (!isPlainObject(options)) {27 throw new TypeError(`Last argument must be an options object: ${options}`);28 }2930 // Prevent prototype pollution by copying only own properties to a null-prototype object30 return [filePath, normalizedArguments, options];31 return [filePath, normalizedArguments, {__proto__: null, ...options}];32};