Skip to content

fix(ext/node): only require read permission for node:wasi preopens - #37266

Open
thebrownhuman wants to merge 1 commit into
denoland:mainfrom
thebrownhuman:node-wasi-preopen-read
Open

thebrownhuman wants to merge 1 commit into
denoland:mainfrom
thebrownhuman:node-wasi-preopen-read

Conversation

@thebrownhuman

Copy link
Copy Markdown

Fixes #37263

The WASI constructor checked read and write permission on every preopen, so a read only program needed --allow-write too. It now checks read only. Writes are still gated because every mutating op (path_open with write rights or O_CREAT/O_TRUNC, mkdir, rmdir, unlink, rename, symlink, link, set times) checks write permission on the resolved path when it runs.

Added a unit_node test that runs with read permission only, constructs WASI with a preopen, reads through it, and checks that path_create_directory still returns EACCES. It fails before this change and passes after.

AI disclosure: Claude Code helped write this change.

Constructing WASI no longer needs write access to each preopened directory. Operations that change the filesystem still check write permission on the resolved path when they run.

Fixes denoland#37263

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

node:wasi constructor requires write permission for every preopen

1 participant