Skip to content

Commit 062d335

Browse files
committed
fixup! src,permission: add --allow-net permission
1 parent da26847 commit 062d335

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

lib/internal/process/pre_execution.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,17 @@ function initializePermission() {
600600
}
601601
}
602602

603+
const experimentalWarnFlags = [
604+
'--allow-net',
605+
];
606+
for (const flag of experimentalWarnFlags) {
607+
if (getOptionValue(flag)) {
608+
process.emitWarning(
609+
`The flag ${flag} is under experimental phase.`,
610+
'ExperimentalWarning');
611+
}
612+
}
613+
603614
ObjectDefineProperty(process, 'permission', {
604615
__proto__: null,
605616
enumerable: true,

src/cares_wrap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ class QueryWrap final : public AsyncWrap {
274274
nullptr);
275275
}
276276

277-
SET_INSUFFICIENT_PERMISSION_ERROR_CALLBACK(permission::PermissionScope::kNet);
277+
SET_INSUFFICIENT_PERMISSION_ERROR_CALLBACK(permission::PermissionScope::kNet)
278278

279279
void ParseError(int status) {
280280
CHECK_NE(status, ARES_SUCCESS);
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Flags: --permission --allow-net --allow-fs-read=*
2+
'use strict';
3+
4+
const common = require('../common');
5+
6+
common.expectWarning('ExperimentalWarning',
7+
'The flag --allow-net is under experimental phase.');

test/parallel/test-permission-net-websocket.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
'use strict';
33

44
const common = require('../common');
5+
if (!common.hasCrypto) {
6+
common.skip('no crypto');
7+
}
8+
59
const wsUrl = 'ws://nodejs.org';
610

711
const ws = new WebSocket(wsUrl);

0 commit comments

Comments
 (0)