Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.4k
Open
Description
Doc: https://nodejs.org/docs/latest/api/cli.html#--disallow-code-generation-from-strings
It is advertised to cover built-in language features, but it doesn't cover data imports
No Node.js modules are directly imported here
// run with node and node --disallow-code-generation-from-stringsconstpayload='console.log("evaluated code from string")'try{eval(payload)}catch(e){console.log(e.message)}try{newFunction(payload)()}catch(e){console.log(e.message)}try{awaitimport('data:text/javascript,'+payload)}catch(e){console.log(e.message)}Output:
% node --disallow-code-generation-from-strings 1.jsCode generation from strings disallowed for this contextCode generation from strings disallowed for this contextevaluated code from stringMetadata
Metadata
Assignees
Labels
No labels