We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 75e5612 commit e26166fCopy full SHA for e26166f
2 files changed
src/node_process_methods.cc
@@ -83,6 +83,8 @@ static void Chdir(const FunctionCallbackInfo<Value>& args) {
83
CHECK_EQ(args.Length(), 1);
84
CHECK(args[0]->IsString());
85
Utf8Value path(env->isolate(), args[0]);
86
+ THROW_IF_INSUFFICIENT_PERMISSIONS(
87
+ env, permission::PermissionScope::kFileSystemRead, path.ToStringView());
88
int err = uv_chdir(*path);
89
if (err) {
90
// Also include the original working directory, since that will usually
test/fixtures/permission/fs-read.js
@@ -385,4 +385,15 @@ const regularFile = __filename;
385
permission: 'FileSystemRead',
386
resource: path.toNamespacedPath(blockedFile),
387
}));
388
+}
389
+
390
+// process.chdir
391
+{
392
+ assert.throws(() => {
393
+ process.chdir(blockedFolder);
394
+ }, common.expectsError({
395
+ code: 'ERR_ACCESS_DENIED',
396
+ permission: 'FileSystemRead',
397
+ resource: blockedFolder,
398
+ }));
399
}
0 commit comments