You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can I use --experimental-permission in new worker_threads.Worder's execArgv? #1043
The doc said that's "process-based permission". But it's actually based on execArgv, does it mean that, it can also be used for create worker by design (and "process-based" is a only provisional loose wording used to emphasize the difference from "module-based")?
What do you mean by execArgv? If you want to create a worker when using the permission model, you should ensure to pass --experimental-permission + all the permissions the worker needs. We don't do it by default, it's up to the developer.
Well, if you pass the correct arguments to the new Worker you should be fine, right? Unless you need to use the --experimental-permission in the main thread, in that case, you need to pass --allow-worker and make sure to load code that wouldn't bypass it (in the main-thread).
Activity
RafaelGSS commentedon Jul 6, 2023
What do you mean by execArgv? If you want to create a worker when using the permission model, you should ensure to pass
--experimental-permission+ all the permissions the worker needs. We don't do it by default, it's up to the developer.LongTengDao commentedon Jul 9, 2023
So actually
--experimental-permissionis not a "process-based permission", but "thread-based permission"?RafaelGSS commentedon Jul 10, 2023
You can call main thread-based permission, yeah.
RafaelGSS commentedon Jul 10, 2023
What's your use case?
LongTengDao commentedon Jul 11, 2023
What about other threads?
Thank you for your attentive.
I'm making a sandbox util to run code and keep them away from disk.
There are many codes to run, so if I can use
new worker_threads.Worker100 times instead ofchild_process.fork100 times, the cost will be less.Currently, my code looks like sample 1 because the docs said it's "process-based permission":
And if actually it's "thread-based permission", I want to make it looking like sample 2:
RafaelGSS commentedon Jul 11, 2023
Well, if you pass the correct arguments to the
new Workeryou should be fine, right? Unless you need to use the--experimental-permissionin the main thread, in that case, you need to pass--allow-workerand make sure to load code that wouldn't bypass it (in the main-thread).