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) {
8383 CHECK_EQ (args.Length (), 1 );
8484 CHECK (args[0 ]->IsString ());
8585 Utf8Value path (env->isolate (), args[0 ]);
86+ THROW_IF_INSUFFICIENT_PERMISSIONS (
87+ env, permission::PermissionScope::kFileSystemRead , path.ToStringView ());
8688 int err = uv_chdir (*path);
8789 if (err) {
8890 // Also include the original working directory, since that will usually
Original file line number Diff line number Diff line change @@ -387,6 +387,17 @@ const regularFile = __filename;
387387 } ) ) ;
388388}
389389
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+ }
400+
390401// fs.lstat
391402{
392403 assert . throws ( ( ) => {
You can’t perform that action at this time.
0 commit comments