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

JS should be sandboxed #6

Open
eternaleclipse opened this issue Jun 13, 2023 · 3 comments
Open

JS should be sandboxed #6

eternaleclipse opened this issue Jun 13, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@eternaleclipse
Copy link
Collaborator

Currently every file is being executed with node.
This is dangerous and essentially gives any input file easy code execution.

One possible solution is to use a JS sandbox, such as:
https://github.com/Bromeon/js-sandbox

Keep in mind this issue will keep coming up as we introduce additional external parsers that are not rust-native.
We may need to solve this using a generic sandboxing approach.

@eternaleclipse
Copy link
Collaborator Author

eternaleclipse commented Jun 13, 2023

Solving this may also solve the TODOs mentioned in the file:

@eternaleclipse eternaleclipse added the bug Something isn't working label Jun 13, 2023
@eternaleclipse
Copy link
Collaborator Author

I've just noted the -c flag.
It's OK, but there is probably a safer way to do this from within rust (?)

@eternaleclipse eternaleclipse changed the title JS execution should be sandboxed - Dangerous JS should be sandboxed Jun 13, 2023
@yael333
Copy link
Owner

yael333 commented Jun 13, 2023

I fully agree yea - I don't know much about it at the moment but I assume there's a better way that would encapsulate and isolate all future code checking (not limited to JS as well).

Although for now we'd only have to check the validity of programs (although checking the output would be pretty sweet), here are some rust solutions that might be better:

Javascript specific:
https://crates.io/crates/rquickjs
https://crates.io/crates/boa_engine

Sandboxing in Rust:
https://crates.io/crates/pandora_box
https://crates.io/crates/rusty-sandbox

@yael333 yael333 self-assigned this Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants