-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Closed
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.
Description
Version
v18.12.0
Platform
No response
Subsystem
No response
What steps will reproduce the bug?
Protect from prototype pollution inspired by https://github.com/snyk-labs/nopp/blob/main/index.js
reproduce.mjs
import globals from "globals";
for (const k of [...new Set(Object.values(globals).map(x => Object.keys(x)).flat())]) {
if (k in globalThis) {
const v = globalThis[k]
try { Object.freeze(v) } catch { }
try { Object.freeze(v.prototype) } catch { }
}
}How often does it reproduce? Is there a required condition?
No response
What is the expected behavior?
No error.
What do you see instead?
$ node
Welcome to Node.js v18.12.0.
> void await import('./reproduce.mjs')
Uncaught TypeError: Cannot delete property 'crypto' of #<Object>
> crypto
Uncaught TypeError: Cannot delete property 'crypto' of #<Object>
at get (node:internal/modules/cjs/helpers:181:23)
> globalThis.crypto
Uncaught TypeError: Cannot delete property 'crypto' of #<Object>
at get (node:internal/modules/cjs/helpers:181:23)
Additional information
No response
Metadata
Metadata
Assignees
Labels
confirmed-bugIssues with confirmed bugs.Issues with confirmed bugs.