ses@2.3.0
Minor Changes
-
#3308
4da9a99Thanks @kriskowal! - Drop the immutable-ArrayBuffer pseudo-prototype.Emulated immutable
ArrayBuffers produced by@endo/immutable-arraybuffernow inherit directly fromArrayBuffer.prototyperather than from an intermediate prototype.Object.getPrototypeOf(immuAB) === ArrayBuffer.prototypefor both emulated immutable and genuine buffers; the brand check is the newimmutableaccessor onArrayBuffer.prototypeinstalled by the shim.The
[Symbol.toStringTag]slot is preserved as an own property on each emulated immutable buffer (not on the shared prototype), soObject.prototype.toString.call(immuAB)continues to return'[object ImmutableArrayBuffer]'(as in master) while genuine ArrayBuffers continue to read as'[object ArrayBuffer]'. This keepsconcordance(and any other downstream consumer that sniffs the toStringTag to decide whether the value is a genuine exotic) from misrouting an emulated immutable through Node'sBuffer.from, which throws because the emulated immutable is not an exotic object.@endo/immutable-arraybufferis now a side-effect-only package: its sole public export is./shim.js. Theindex.jsand the package's.entry are removed; the previously exported names (isBufferImmutable,sliceBufferToImmutable,optTransferBufferToImmutable) are no longer reachable from outside the package. Callers detect immutability via theArrayBuffer.prototype.immutableaccessor (orObject.prototype.toString.call(buffer) === '[object ImmutableArrayBuffer]'when the shim has not been loaded) and convert viabuffer.sliceToImmutable(...)andbuffer.transferToImmutable(...)on the prototype. The break is a major bump for the@endo/immutable-arraybufferpackage.@endo/bytes'sto-immutable.jsimports@endo/immutable-arraybuffer/shim.js(triggering the shim install) and callsbuffer.sliceToImmutable(...)onArrayBuffer.prototypeinstead of the previously exportedsliceBufferToImmutablefree function.The shim's install policy is now detect-then-skip rather than warn-and-overwrite: the Immutable ArrayBuffer proposal has reached stage 3, so any prior installation (native or previously loaded shim) wins. If
'sliceToImmutable' in ArrayBuffer.prototypeis already true when the shim loads, the shim does nothing.sesdrops the%ImmutableArrayBufferPrototype%permits entry, which no longer has a referent. The three permits lines inside%ArrayBufferPrototype%that declare the shim-installed methods (transferToImmutable,sliceToImmutable,immutable) stay as-is.@endo/pass-style'sbyteArraybrand check no longer routes through an intermediate prototype; it consults theimmutableaccessor onArrayBuffer.prototypedirectly. The check also tolerates the[Symbol.toStringTag]own-property on emulated immutable buffers and verifies that its value is a non-enumerable data property with a string value. -
#3322
eeefaa0Thanks @kriskowal! - PermitTextEncoderandTextDecoderas universal intrinsics.TextEncoderandTextDecoderare pure transformations betweenstringandUint8Arraywith no static side channels, so they are now permitted on every compartment (start compartment and every compartment created after lockdown, identity-equal). Their prototypes are frozen alongside the other tamed primordials. On hosts that do not provide them (XS), lockdown proceeds without them and compartments observe their absence as before.Code that monkey-patches
TextEncoder.prototypeorTextDecoder.prototypeafterlockdown()will now throw, because the prototypes are frozen. Such mutations must happen before lockdown, the same rule that already applies to every other intrinsic. -
#3220
d47d74fThanks @boneskull! - Exposes__noNamespaceBox__getter onCompartment. -
#3316
71cbdb9Thanks @boneskull! -makeError()now allows acode?: stringoption, which sets acodeproperty on the resultingError, if so desired.
Patch Changes
-
#3306
a85b212Thanks @gibson042! - -consoleTaming: 'safe'prevents Node.js console logging from invoking custom inspect methods -
#3307
c69eb03Thanks @gibson042! - The console format specifier%cis for consuming a CSS style string and applying that style to the rendering of the remaining arguments. Node.js and browsers both parse%cthe same way and have it consume one argument.- Browsers actually make use of the CSS, leading to security problems (e.g., https://issues.chromium.org/40056332 ).
- Node.js ignores the
%cand its corresponding argument, which is allowed by the WHATWG Console specification.
To avoid the CSS security problems on all platforms, under the defaut
consoleTaming: 'safe', we now sanitize out the%cand corresponding argument, emulating the allowed current Node.js behavior on all platforms. This fixes this CSS vulnerability while maintaining compatibility with the specification. We also treat unknown specifiers in a future-proof manner. -
#3309
bfa149bThanks @boneskull! -makeErrornow narrows type of return instance whenerrConstructorprovided. -
Updated dependencies [
4da9a99]:- @endo/immutable-arraybuffer@2.0.0