◐ Shell
clean mode source ↗

[v22.x backport] permission: ignore internalModuleStat on module loading by RafaelGSS · Pull Request #56058 · nodejs/node

@nodejs-github-bot added c++

Issues and PRs that require attention from people who are familiar with C++.

fs

Issues and PRs related to the fs subsystem / file system.

module

Issues and PRs related to the module subsystem.

needs-ci

PRs that need a full CI run.

v22.x

Issues that can be reproduced on v22.x or PRs targeting the v22.x-staging branch.

labels

Nov 28, 2024

@RafaelGSS RafaelGSS added the author ready

PRs that have at least one approval, no pending requests for changes, and a CI started.

label

Dec 6, 2024
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: nodejs#55797
Backport-PR-URL: nodejs#56058
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>

ruyadorno pushed a commit that referenced this pull request

Jan 5, 2025
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: #55797
Backport-PR-URL: #56058
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>