File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,8 @@ static void Chdir(const FunctionCallbackInfo<Value>& args) {
83
83
CHECK_EQ (args.Length (), 1 );
84
84
CHECK (args[0 ]->IsString ());
85
85
Utf8Value path (env->isolate (), args[0 ]);
86
+ THROW_IF_INSUFFICIENT_PERMISSIONS (
87
+ env, permission::PermissionScope::kFileSystemRead , path.ToStringView ());
86
88
int err = uv_chdir (*path);
87
89
if (err) {
88
90
// Also include the original working directory, since that will usually
Original file line number Diff line number Diff line change @@ -361,3 +361,14 @@ const regularFile = __filename;
361
361
resource : path . toNamespacedPath ( blockedFile ) ,
362
362
} ) ) ;
363
363
}
364
+
365
+ // process.chdir
366
+ {
367
+ assert . throws ( ( ) => {
368
+ process . chdir ( blockedFolder ) ;
369
+ } , common . expectsError ( {
370
+ code : 'ERR_ACCESS_DENIED' ,
371
+ permission : 'FileSystemRead' ,
372
+ resource : path . toNamespacedPath ( blockedFolder ) ,
373
+ } ) ) ;
374
+ }
You can’t perform that action at this time.
0 commit comments