endo icon indicating copy to clipboard operation
endo copied to clipboard

Revisit behavior of `has` proxy trap in safe evaluator’s terminal scope

Open kriskowal opened this issue 3 years ago • 5 comments

The has trap in the safe evaluator’s terminal scope proxy (before and after #1293) leaks the presence or absence of properties on the realm’s intrinsic global object. The current behavior might be the optimal compromise, but we should revisit the possibility of making has always return true to fully blot out the parent scope. @kumavis’s preliminary investigation suggests that this would break too much existing usage. We should isolate the cases that this change would break and evaluate next steps.

kriskowal avatar Sep 29 '22 21:09 kriskowal

we also noted that "scuttling the realm global" could change the behavior of code running inside a compartment due to this info leak

kumavis avatar Oct 05 '22 18:10 kumavis

Added the security label because of the information leak.

erights avatar Oct 07 '22 04:10 erights

Since we last discussed this, Scuttling the realm global has become a normal practice for MetaMask. @kumavis Did that shift make patching the leak more viable?

kriskowal avatar Jan 08 '24 22:01 kriskowal

@weizman did we see any change in behavior / bugs introduced to lavamoat confined code under scuttling?

"making has always return true" does seem like the safest behavior

typeof xyz will not throw, will be "undefined" and Reflect.has(globalThis, 'xyz') will be false bc it is now a normal object. this seems like the best situation.

the following code will break: code relying on utterance of non-existing global variables to throw an error. seems rare. if you find some ill buy you a chocolate bar :chocolate_bar:

my recommendation: lets make the change in SES! especially when we're lined up for a breaking change

kumavis avatar Jan 19 '24 21:01 kumavis

No, none

weizman avatar Jan 19 '24 22:01 weizman