-
Notifications
You must be signed in to change notification settings - Fork 19
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
Protecting prototype accross the sandbox #55
Comments
@Jack-Works I believe what you're asking here is a use-cases solved by https://github.com/caridy/secure-javascript-environment, which is an abstraction on top of realms-shim. In the examples, you there are two explicit example show casing how expandos are handled, and how polyfilling (changing the protochain of a provided DOM api), without affecting the outer realm. Now, the ambiguity of your example comes from the first line (
|
In our use case, the outer realm is untrusted and code run in the sandbox is trusted. We need it to run in the sandbox to avoid secret information leak out to the dangerous outer realm. |
So execution order of our code is: -> Webview onCommitted. The JS environment is just created. No code has run. -> Now both outside code and inside code are ready. Expected outside code cannot access |
In my use case (web extension polyfill), codes run in the sandbox need to access to the "clean DOM" that means any changes outside of the sandbox can not affect the inner side of the sandbox.
Currently, I'm making a copy of the global object and provide it to the realms.
And this cause problem on the prototype:
For example:
After these two files run, both a and b are accessable from the outside world and the inside world.
Ideally it should only accessable from where it get changed. (a in the main frame and b in the realms shim)
I have some idea about how to protect the prototype (by replacing prototype with a Proxy) but not clear if realms shim will give some help.
The text was updated successfully, but these errors were encountered: