diff options
author | Gus Caplan <me@gus.host> | 2020-03-15 03:54:15 +0300 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2020-03-24 09:55:10 +0300 |
commit | 36ba54e8e1532453c71a3e5952d5c10931545af3 (patch) | |
tree | 43e68b135f1db370e538d52f0319be8c5bfe9626 /src/node.cc | |
parent | ef32069d0ce558a7f085ad481d978ccda14c8171 (diff) |
lib: add option to disable __proto__
Adds `--disable-proto` CLI option which can be set to `delete` or
`throw`.
Fixes #31951
PR-URL: https://github.com/nodejs/node/pull/32279
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com>
Diffstat (limited to 'src/node.cc')
-rw-r--r-- | src/node.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/node.cc b/src/node.cc index 290d36d2d20..bf401ed5c45 100644 --- a/src/node.cc +++ b/src/node.cc @@ -718,6 +718,13 @@ int ProcessGlobalArgs(std::vector<std::string>* args, } } + if (per_process::cli_options->disable_proto != "delete" && + per_process::cli_options->disable_proto != "throw" && + per_process::cli_options->disable_proto != "") { + errors->emplace_back("invalid mode passed to --disable-proto"); + return 12; + } + auto env_opts = per_process::cli_options->per_isolate->per_env; if (std::find(v8_args.begin(), v8_args.end(), "--abort-on-uncaught-exception") != v8_args.end() || |