-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Provide option to delete Deno namespace in worker #2717
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
Conversation
98d0b91
to
093a6ec
Compare
093a6ec
to
715aab4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable. It’s a little annoying to lay all this pipe for just this one boolean. It makes me wonder if we should future proof this but having an options object of some sort... but I think it’s not much code so probably better to just add the boolean as you did.
I could imagine wanting to do something where you restrict permissions in the child worker - say limit network access...
Yeah sounds reasonable, though I do feel the sandboxing provided by this change is quite similar to the browser environment. Anyways we might experiment with that in another PR. Also just added a basic integration test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add something to the manual or JSDOC describing this behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Add an option to
Worker
creation such that worker could be sandboxed (no access towindow.Deno
namespace)The condition is propagated (e.g. if a sandboxed worker tries to create another worker, it will always also be sandboxed)
This is achieved by adding a condition to per worker/isolate
State
and callingdenoMain()
with param whether to preserve or deletewindow.Deno
(The locations where things are attached/bounded to
Deno
orDeno.core
is growing more nebulous. Maybe we need better comments for it)Tests needed. Will try to add them after first-round review (to ensure no leaking of the namespace through other channels)Added