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

Suggestion: FS, network, etc isolation #686

Open
NoelJacob opened this issue Nov 17, 2024 · 2 comments
Open

Suggestion: FS, network, etc isolation #686

NoelJacob opened this issue Nov 17, 2024 · 2 comments

Comments

@NoelJacob
Copy link
Contributor

NoelJacob commented Nov 17, 2024

Can we have a feature flag like fs-isolation and net-isolation for complete isolation of runtime from system? Net-isolation as it is set by environment variables can be used when used as binary and net-isolation as a feature can also be added. Fs modules and require from file system features need be enabled only if fs-isolation is not present. I could try a draft pull request for fs-isolation if you could give me some starting pointers.

Here's a link to Node permissions API: https://nodejs.org/api/permissions.html

Also would rquickjs require any changes to implement fs-isolation?

@richarddavison
Copy link
Contributor

This is a great suggestion which doesn't require any changes in rquickjs as these APIs are all exposed by LLRT.

@richarddavison
Copy link
Contributor

@NoelJacob I would suggest adding some isolation checks in the fs modules. Best actually would be to refactor permissions model and add to userdata. That way we can remove the globals.
https://docs.rs/rquickjs/latest/rquickjs/struct.Ctx.html#method.store_userdata
Example how to use userdata:
https://github.com/awslabs/llrt/blob/main/libs/llrt_utils/src/primordials.rs#L40-L58

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

2 participants