GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src,permission: handle process.chdir on pm · nodejs/node@ef1c0d7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node_process_methods.cc
  • test/fixtures/permission
    • fs-read.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node_process_methods.cc‎

Copy file name to clipboardExpand all lines: src/node_process_methods.cc
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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
Collapse file

‎test/fixtures/permission/fs-read.js‎

Copy file name to clipboardExpand all lines: test/fixtures/permission/fs-read.js
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff 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(() => {

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.