GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — cli: whitelist new V8 flag in NODE_OPTIONS · nodejs/node@f3196db

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc
    • api
      • cli.md
    • node.1
  • src
    • node_options.cc
  • test/parallel
    • test-cli-node-options.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/cli.md‎

Copy file name to clipboardExpand all lines: doc/api/cli.md
+10Lines changed: 10 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,15 @@ added: v12.0.0
127127
128128
Specify the file name of the CPU profile generated by `--cpu-prof`.
129129

130+
### `--disallow-code-generation-from-strings`
131+
<!-- YAML
132+
added: v9.8.0
133+
-->
134+
135+
Make built-in language features like `eval` and `new Function` that generate
136+
code from strings throw an exception instead. This does not affect the Node.js
137+
`vm` module.
138+
130139
### `--enable-fips`
131140
<!-- YAML
132141
added: v6.0.0
@@ -1134,6 +1143,7 @@ Node.js options that are allowed are:
11341143
V8 options that are allowed are:
11351144
<!-- node-options-v8 start -->
11361145
* `--abort-on-uncaught-exception`
1146+
* `--disallow-code-generation-from-strings`
11371147
* `--interpreted-frames-native-stack`
11381148
* `--max-old-space-size`
11391149
* `--perf-basic-prof-only-functions`
Collapse file

‎doc/node.1‎

Copy file name to clipboardExpand all lines: doc/node.1
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@ The default is
100100
File name of the V8 CPU profile generated with
101101
.Fl -cpu-prof
102102
.
103+
.It Fl -disallow-code-generation-from-strings
104+
Make built-in language features like `eval` and `new Function` that generate
105+
code from strings throw an exception instead. This does not affect the Node.js
106+
`vm` module.
107+
.
103108
.It Fl -enable-fips
104109
Enable FIPS-compliant crypto at startup.
105110
Requires Node.js to be built with
Collapse file

‎src/node_options.cc‎

Copy file name to clipboardExpand all lines: src/node_options.cc
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,10 @@ PerIsolateOptionsParser::PerIsolateOptionsParser(
611611
V8Option{},
612612
kAllowedInEnvironment);
613613
AddOption("--stack-trace-limit", "", V8Option{}, kAllowedInEnvironment);
614+
AddOption("--disallow-code-generation-from-strings",
615+
"disallow eval and friends",
616+
V8Option{},
617+
kAllowedInEnvironment);
614618

615619
#ifdef NODE_REPORT
616620
AddOption("--report-uncaught-exception",
Collapse file

‎test/parallel/test-cli-node-options.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-cli-node-options.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ if (common.hasCrypto) {
6060

6161
// V8 options
6262
expect('--abort_on-uncaught_exception', 'B\n');
63+
expect('--disallow-code-generation-from-strings', 'B\n');
6364
expect('--max-old-space-size=0', 'B\n');
6465
expect('--stack-trace-limit=100',
6566
/(\s*at f \(\[eval\]:1:\d*\)\r?\n){100}/,

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.