Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[grace-hopper-day] Update Permission Model documentation to include resource field #1111

Closed
RafaelGSS opened this issue Sep 16, 2023 · 0 comments

Comments

@RafaelGSS
Copy link
Member

Currently the documentation shows

When starting Node.js with --experimental-permission, the ability to access the file system through the fs module, spawn processes, use node:worker_threads and enable the runtime inspector will be restricted.

$ node --experimental-permission index.js
node:internal/modules/cjs/loader:171
  const result = internalModuleStat(filename);
                 ^

Error: Access to this API has been restricted
    at stat (node:internal/modules/cjs/loader:171:18)
    at Module._findPath (node:internal/modules/cjs/loader:627:16)
    at resolveMainPath (node:internal/modules/run_main:19:25)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:24)
    at node:internal/main/run_main_module:23:47 {
  code: 'ERR_ACCESS_DENIED',
  permission: 'FileSystemRead'
} 

However, we've added the resource as one of the parameters sent whenever an ERR_ACCESS_DENIED is thrown. Example:

Error: Access to this API has been restricted
    at stat (node:internal/modules/cjs/loader:178:18)
    at Module._findPath (node:internal/modules/cjs/loader:629:16)
    at resolveMainPath (node:internal/modules/run_main:15:25)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:24)
    at node:internal/main/run_main_module:23:47 {
  code: 'ERR_ACCESS_DENIED',
  permission: 'FileSystemRead',
  resource: '/Users/rafaelgss/repos/os/node/index.js'
}

We should update the Node.js permissions documentation (https://github.com/nodejs/node/blob/e9ff81016dfcf183f4fcc2640497cb8b3365fdd7/doc/api/permissions.md?plain=1#L501) to include the resource field. We can use a generic path such as /home/user/index.js.

@RafaelGSS RafaelGSS changed the title [grace-hopper-day] Update Permission Model including resource parameter [grace-hopper-day] Update Permission Model documentation to include resource field Sep 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant