Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.4',
'v8_embedder_string': '-node.5',

# Enable disassembler for `--print-code` v8 options
'v8_enable_disassembler': 1,

# Don't bake anything extra into the snapshot.
'v8_use_external_startup_data%': 0,

# Disable V8 untrusted code mitigations.
# See https://github.com/v8/v8/wiki/Untrusted-code-mitigations
'v8_untrusted_code_mitigations': 'false',

# Some STL containers (e.g. std::vector) do not preserve ABI compatibility
# between debug and non-debug mode.
'disable_glibcxx_debug': 1,
Expand Down
6 changes: 6 additions & 0 deletions deps/v8/gypfiles/features.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@

# Controls the threshold for on-heap/off-heap Typed Arrays.
'v8_typed_array_max_size_in_heap%': 64,

# Enable mitigations for executing untrusted code.
'v8_untrusted_code_mitigations%': 'true',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this overridden by common.gypi?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It's the 2nd commit in this PR.

},
'target_defaults': {
'conditions': [
Expand Down Expand Up @@ -143,6 +146,9 @@
['v8_enable_concurrent_marking==1', {
'defines': ['V8_CONCURRENT_MARKING',],
}],
['v8_untrusted_code_mitigations=="false"', {
'defines': ['DISABLE_UNTRUSTED_CODE_MITIGATIONS',],
}],
], # conditions
'configurations': {
'DebugBaseCommon': {
Expand Down
18 changes: 18 additions & 0 deletions test/parallel/test-v8-untrusted-code-mitigations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict';

require('../common');
const assert = require('assert');
const { execFileSync } = require('child_process');

// This test checks that untrusted code mitigations in V8 are disabled
// by default.

const v8Options = execFileSync(process.execPath, ['--v8-options']).toString();

const untrustedFlag = v8Options.indexOf('--untrusted-code-mitigations');
assert.notStrictEqual(untrustedFlag, -1);

const nextFlag = v8Options.indexOf('--', untrustedFlag + 2);
const slice = v8Options.substring(untrustedFlag, nextFlag);

assert(slice.match(/type: bool default: false/));