mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
PR-URL: https://github.com/nodejs-private/node-private/pull/820 Refs: https://hackerone.com/reports/3559715 Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> CVE-ID: CVE-2026-21711
50 lines
1.1 KiB
JavaScript
50 lines
1.1 KiB
JavaScript
// Flags: --permission --allow-fs-read=*
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto) { common.skip('missing crypto'); };
|
|
|
|
if (common.isWindows) {
|
|
common.skip('This test only works on unix');
|
|
}
|
|
|
|
const assert = require('assert');
|
|
const net = require('net');
|
|
const tls = require('tls');
|
|
|
|
{
|
|
const client = net.connect({ path: '/tmp/perm.sock' });
|
|
client.on('error', common.mustCall((err) => {
|
|
assert.strictEqual(err.code, 'ERR_ACCESS_DENIED');
|
|
}));
|
|
|
|
client.on('connect', common.mustNotCall('TCP connection should be blocked'));
|
|
}
|
|
|
|
{
|
|
const client = tls.connect({ path: '/tmp/perm.sock' });
|
|
client.on('error', common.mustCall((err) => {
|
|
assert.strictEqual(err.code, 'ERR_ACCESS_DENIED');
|
|
}));
|
|
|
|
client.on('connect', common.mustNotCall('TCP connection should be blocked'));
|
|
}
|
|
|
|
{
|
|
assert.throws(() => {
|
|
net.createServer().listen('/tmp/perm-server.sock');
|
|
}, {
|
|
code: 'ERR_ACCESS_DENIED',
|
|
permission: 'Net',
|
|
});
|
|
}
|
|
|
|
{
|
|
assert.throws(() => {
|
|
tls.createServer().listen('/tmp/perm-tls-server.sock');
|
|
}, {
|
|
code: 'ERR_ACCESS_DENIED',
|
|
permission: 'Net',
|
|
});
|
|
}
|