mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
src,permission: handle process.chdir on pm
PR-URL: https://github.com/nodejs/node/pull/53175 Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
This commit is contained in:
1 parent
90b632ee02
commit
ef1c0d7def
2 files changed
+13
No files matched your search
@@ -83,6 +83,8 @@ static void Chdir(const FunctionCallbackInfo<Value>& args) {
|
||||
CHECK_EQ(args.Length(), 1);
|
||||
CHECK(args[0]->IsString());
|
||||
Utf8Value path(env->isolate(), args[0]);
|
||||
THROW_IF_INSUFFICIENT_PERMISSIONS(
|
||||
env, permission::PermissionScope::kFileSystemRead, path.ToStringView());
|
||||
int err = uv_chdir(*path);
|
||||
if (err) {
|
||||
// Also include the original working directory, since that will usually
|
||||
|
||||
Vendored
+11
@@ -387,6 +387,17 @@ const regularFile = __filename;
|
||||
}));
|
||||
}
|
||||
|
||||
// process.chdir
|
||||
{
|
||||
assert.throws(() => {
|
||||
process.chdir(blockedFolder);
|
||||
}, common.expectsError({
|
||||
code: 'ERR_ACCESS_DENIED',
|
||||
permission: 'FileSystemRead',
|
||||
resource: blockedFolder,
|
||||
}));
|
||||
}
|
||||
|
||||
// fs.lstat
|
||||
{
|
||||
assert.throws(() => {
|
||||
|
||||
Reference in new issue
Block a user