node icon indicating copy to clipboard operation
node copied to clipboard

[v20.x] permission: ignore internalModuleStat on module loading

Open RafaelGSS opened this issue 7 months ago • 1 comments

This improves Permission Model usage when allowing read access to specifi modules. To achieve that, the permission model check on internalModuleStat has been removed meaning that on module loading, uv_fs_stat is performed on files and folders even when the permission model is enabled. Although a uv_fs_stat is performed, reading/executing the module will still pass by the permission model check.

Without this PR when an app tries to --allow-fs-read=./a.js --allow-fs-read=./b.js where a attempt to load b, it will fails as it reads $pwd and no permission has been given to this path.

PR-URL: https://github.com/nodejs/node/pull/55797 Backport-PR-URL: https://github.com/nodejs/node/pull/58185 Reviewed-By: Yagiz Nizipli [email protected] Reviewed-By: Ulises Gascón [email protected]

RafaelGSS avatar May 05 '25 19:05 RafaelGSS

Review requested:

  • [ ] @nodejs/loaders
  • [ ] @nodejs/security-wg

nodejs-github-bot avatar May 05 '25 19:05 nodejs-github-bot

Failed to start CI
   ⚠  Commits were pushed since the last approving review:
   ⚠  - permission: ignore internalModuleStat on module loading
   ✘  Refusing to run CI on potentially unsafe PR
https://github.com/nodejs/node/actions/runs/16306740577

github-actions[bot] avatar Jul 15 '25 23:07 github-actions[bot]

CI: https://ci.nodejs.org/job/node-test-pull-request/68083/

nodejs-github-bot avatar Jul 21 '25 20:07 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/68173/

nodejs-github-bot avatar Jul 24 '25 14:07 nodejs-github-bot

Landed in 7f8d1b2681a8

marco-ippolito avatar Aug 14 '25 10:08 marco-ippolito