Can workers be secure enough for an untrusted code

百般思念 提交于 2019-11-30 23:07:00

Is separate origin policy applied to the worker code in this case?

No, from the current editor's draft of the File API specification:

The origin of a Blob URL must be the same as the effective script origin specified by the incumbent settings object at the time the method that created it -- either URL.createObjectURL or URL.createFor -- was called.


additional reasons, why a worker is (by default) less restricted comparing to the sandboxed iframe

Sandboxed iframes can specify some permissions on things other than cross-origin communication. For example, you can prevent the sandboxed content from opening popups. Although web workers currently don't have APIs to do many of these things.


is there any chance to set-up a worker somehow so that it would be restricted enough

There just isn't any security mechanism for web workers. There are other tools in the web platform for isolating untrusted code, like a sandboxed iframe as you point out. You could have a sandboxed iframe create a web worker, if that's any better.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!