ses@2.0.0
Major Changes
-
#3153
e619205Thanks @erights! - # Plug NaN Side-channelThe JavaScript language can leak the bit encoding of a NaN via shared TypedArray views of an common ArrayBuffer. Although the JavaScript language has only one NaN value, the underlying IEEE 754 double-precision floating-point representation has many different bit patterns that represent NaN. This can be exploited as a side-channel to leak information. This actually happens on some platforms such as v8.
@ChALkeR explains at tc39/ecma262#758 (comment) that the behavior of this side-channel on v8. At https://junk.rray.org/poc/nani.html he demonstrates it, and it indeed even worse than I expected.
To plug this side-channel, we make two coordinated changes.
- We stop listing the
Float*Arrayconstructors as universal globals. This prevents them from being implicitly endowed to created compartments, because they are not harmless. However, we still keep them on the start compartment (the original global), consider them intrinsics, and still repair and harden them onlockdown(). Thus, they can be explicitly endowed to child compartments at the price of enabling code in that compartment to read the side-channel. - On
lockdown(), we repair theDataView.prototype.setFloat*methods so that they only write canonical NaNs into the underlying ArrayBuffer.
The
@endo.marshalpackage'sencodePassableencodings need to obtain the bit representation of floating point values. It had usedFloat64Arrayfor that. However, sometimes the@endo/marshalpackage is evaluated in a created compartment that would now lack that constructor. (This reevaluation typically occurs when bundling bundles in that package.) So instead,encodePassablenow uses theDataViewmethods which are now safe. - We stop listing the
Minor Changes
-
#3129
a675d8eThanks @erights! -overrideTaming: 'moderate'includesoverrideTaming: 'min'.Previously
overrideTaming: 'min'correctly enabledIterator.prototype.constructorto be overridden by assignment, but due to an oversight,overrideTaming: 'moderate'did not. Now it does.To make such mistakes less likely, this PR also adopts a style where all records within larger enablements triple-dot the corresponding record from a smaller enablement, if present.