mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
child_process: propagate config-file permission flags to children
Signed-off-by: RafaelGSS <rafael.nunu@hotmail.com> PR-URL: https://github.com/nodejs/node/pull/66559 Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
This commit is contained in:
1 parent
fc3b067be7
commit
5fd03e6fdf
4 files changed
+38
No files matched your search
@@ -574,9 +574,11 @@ function copyPermissionModelFlagsToEnv(env, key, args) {
|
||||
}
|
||||
|
||||
const flagsToCopy = getPermissionModelFlagsToCopy();
|
||||
const copiedFlags = new SafeSet();
|
||||
for (const arg of process.execArgv) {
|
||||
for (const flag of flagsToCopy) {
|
||||
if (arg.startsWith(flag)) {
|
||||
copiedFlags.add(flag);
|
||||
env[key] = `${env[key] ? env[key] + ' ' + arg : arg}`;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
const { spawnSync } = require('child_process');
|
||||
const { status, stdout, stderr } = spawnSync(process.execPath, [
|
||||
'-p',
|
||||
`JSON.stringify([
|
||||
typeof process.permission,
|
||||
process.permission.has("fs.read"),
|
||||
process.permission.has("fs.write"),
|
||||
process.permission.has("child"),
|
||||
process.permission.has("worker"),
|
||||
])`,
|
||||
]);
|
||||
console.log(JSON.stringify({
|
||||
status,
|
||||
stdout: stdout.toString().trim(),
|
||||
stderr: stderr.toString(),
|
||||
}));
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"permission": {
|
||||
"allow-child-process": true,
|
||||
"allow-worker": true,
|
||||
"allow-fs-read": [
|
||||
"*"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"permission": {
|
||||
"permission": true,
|
||||
"allow-child-process": true,
|
||||
"allow-worker": true,
|
||||
"allow-fs-read": [
|
||||
"*",
|
||||
"/nonexistent/dir with \"quotes\" and \\backslash"
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user