-
Notifications
You must be signed in to change notification settings - Fork 74
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
Allow correlation of scopeProxy to compartment, as workaround for scopeProxy leakage #622
Comments
|
mmmm, |
The proposed behavior would parallel JS's actual behavior for the real first global, the global of the start compartment. The function foo() { "use strict"; return this; }
// This is the global behavior we wish to emulate.
foo(); // undefined
const x = {};
// Curiously, this emulates it, which does suggest a technique which would work in theory
// but is too dangerous. Hmm I might try it on a branch just to see what it looks like.
with(x) { foo(); } // undefined
x.foo = foo;
// Given our current technique, whose hazards we have been living with and presumably
// understand and have made safe enough, this is the outcome we seem to be stuck with
// according to #31
with(x) { foo() } // x
valueOf() // throws TypeError "Cannot convert undefined or null to object" So, using your |
I updated the code above to insert the relevant comments. The key is the first one. The behavior we will spec, and which therefore we'd ideally like to emulate, is that |
update
i realized this proposal is unnecessary, but thread may be informational
LavaMoat issue summary
LavaMoat needs to be able to support arbitrary platform apis that are this-value specific. eg:
currently it looks like this.
it explodes because abc's this-value is scopeProxy
I'm not sure what non-shim SES's behavior is, but i would expect the this-value to be the
compartment.globalThis
copyEndowmentsToCompartment
already wraps functions and getters in order to "unwrap" (membrane-like) the this-value fromcompartment.globalThis
totrueGlobalThis
in order to satisfy thetrueGlobalThis.abc
implementation requirements above and similar requirements found in the wild, especially in chrome (window.document
,window.setTimeout
)we could similarly unwrap the this-value from
scopeProxy
tocompartment.globalThis
if we knew how to verify thescopeProxy
came from the compartment.proposal
as a workaround for scopeProxy leakage #31,
something like this
The text was updated successfully, but these errors were encountered: