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 @@ -385,4 +385,15 @@ const regularFile = __filename;
385
385
permission : 'FileSystemRead' ,
386
386
resource : path . toNamespacedPath ( blockedFile ) ,
387
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
+ } ) ) ;
388
399
}
You can’t perform that action at this time.
0 commit comments