ses 0.15.10 → 0.15.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,46 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ### [0.15.13](https://github.com/endojs/endo/compare/ses@0.15.12...ses@0.15.13) (2022-04-13)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Revert dud release ([c8a7101](https://github.com/endojs/endo/commit/c8a71017d8d7af10a97909c9da9c5c7e59aed939))
12
+ * **ses:** Prevent hypothetical stack bumping to get unsafe eval ([3c64cde](https://github.com/endojs/endo/commit/3c64cdea5b410a053520dc29de04c43350a38e1a)), closes [#956](https://github.com/endojs/endo/issues/956)
13
+
14
+
15
+
16
+ ### [0.15.12](https://github.com/endojs/endo/compare/ses@0.15.11...ses@0.15.12) (2022-04-12)
17
+
18
+
19
+ ### Features
20
+
21
+ * add Array#at close [#1139](https://github.com/endojs/endo/issues/1139) ([#1146](https://github.com/endojs/endo/issues/1146)) ([43494c8](https://github.com/endojs/endo/commit/43494c8d0c50cba205050fcf472fda4aed03d6ca))
22
+ * **compartment-mapper:** proper default export implementation for cjs with import and require compatibility ([30cbaa8](https://github.com/endojs/endo/commit/30cbaa8cb79b906742a9f5c1854b22fe506b0575))
23
+ * **init:** Handle symbols installed on Promise by Node's `async_hooks` ([#1115](https://github.com/endojs/endo/issues/1115)) ([06827b9](https://github.com/endojs/endo/commit/06827b982c0450bae53b5ff0c410745678168c88))
24
+
25
+
26
+ ### Bug Fixes
27
+
28
+ * **ses:** avoid cache corruption when execute() throws ([1d9c17b](https://github.com/endojs/endo/commit/1d9c17b4c4a5ed1450cddd996bd948dd59c80bf6))
29
+ * some tests sensitive to errorTaming ([#1135](https://github.com/endojs/endo/issues/1135)) ([0c22364](https://github.com/endojs/endo/commit/0c22364104fb8b2528cd5437accda09a045a6ff0))
30
+ * **endo:** Ensure conditions include default, import, and endo ([1361abd](https://github.com/endojs/endo/commit/1361abd8c732596d192ecef6a039eda98b4ee563))
31
+ * **ses:** Do not bundle modules for use as modules ([7d27020](https://github.com/endojs/endo/commit/7d2702037295211d8d3f08431a4d4de0a4e3ffd7))
32
+ * **ses:** Do not get confused by well-known look-alikes ([5139dad](https://github.com/endojs/endo/commit/5139dad7719d7a32360e2daf8a37b9ab3f2cd94a))
33
+ * **ses:** Ignore Array unscopable findLast{,Index} ([#1129](https://github.com/endojs/endo/issues/1129)) ([bbf7e7d](https://github.com/endojs/endo/commit/bbf7e7dd0ba19349120d4913016c62b9f8dc4995))
34
+ * **ses:** make import * and default from cjs wire up correctly ([33cbd27](https://github.com/endojs/endo/commit/33cbd2776f9d47e6e8438650565155e4185d9373))
35
+
36
+
37
+
38
+ ### [0.15.11](https://github.com/endojs/endo/compare/ses@0.15.10...ses@0.15.11) (2022-03-07)
39
+
40
+ **Note:** Version bump only for package ses
41
+
42
+
43
+
44
+
45
+
6
46
  ### [0.15.10](https://github.com/endojs/endo/compare/ses@0.15.9...ses@0.15.10) (2022-03-02)
7
47
 
8
48
 
package/dist/lockdown.cjs CHANGED
@@ -75,8 +75,10 @@ const {
75
75
  species: speciesSymbol,
76
76
  toStringTag: toStringTagSymbol,
77
77
  iterator: iteratorSymbol,
78
- matchAll: matchAllSymbol}=
79
- Symbol;$h‍_once.speciesSymbol(speciesSymbol);$h‍_once.toStringTagSymbol(toStringTagSymbol);$h‍_once.iteratorSymbol(iteratorSymbol);$h‍_once.matchAllSymbol(matchAllSymbol);
78
+ matchAll: matchAllSymbol,
79
+ keyFor: symbolKeyFor,
80
+ for: symbolFor}=
81
+ Symbol;$h‍_once.speciesSymbol(speciesSymbol);$h‍_once.toStringTagSymbol(toStringTagSymbol);$h‍_once.iteratorSymbol(iteratorSymbol);$h‍_once.matchAllSymbol(matchAllSymbol);$h‍_once.symbolKeyFor(symbolKeyFor);$h‍_once.symbolFor(symbolFor);
80
82
 
81
83
  const { isInteger}= Number;$h‍_once.isInteger(isInteger);
82
84
 
@@ -1601,7 +1603,8 @@ const getScopeConstants= (globalObject, localObject= {})=> {
1601
1603
  })
1602
1604
  ,
1603
1605
  // === functors[7] ===
1604
- (({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, }) => { let FERAL_EVAL,Proxy,String,TypeError,create,freeze,getOwnPropertyDescriptor,getOwnPropertyDescriptors,globalThis,immutableObject,objectHasOwnProperty,reflectGet,reflectSet,assert;$h‍_imports([["./commons.js", [["FERAL_EVAL", [$h‍_a => (FERAL_EVAL = $h‍_a)]],["Proxy", [$h‍_a => (Proxy = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["immutableObject", [$h‍_a => (immutableObject = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["reflectGet", [$h‍_a => (reflectGet = $h‍_a)]],["reflectSet", [$h‍_a => (reflectSet = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]);
1606
+ (({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, }) => { let FERAL_EVAL,Proxy,String,TypeError,create,freeze,getOwnPropertyDescriptor,getOwnPropertyDescriptors,globalThis,immutableObject,objectHasOwnProperty,reflectGet,reflectSet,seal,assert;$h‍_imports([["./commons.js", [["FERAL_EVAL", [$h‍_a => (FERAL_EVAL = $h‍_a)]],["Proxy", [$h‍_a => (Proxy = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getOwnPropertyDescriptors", [$h‍_a => (getOwnPropertyDescriptors = $h‍_a)]],["globalThis", [$h‍_a => (globalThis = $h‍_a)]],["immutableObject", [$h‍_a => (immutableObject = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["reflectGet", [$h‍_a => (reflectGet = $h‍_a)]],["reflectSet", [$h‍_a => (reflectSet = $h‍_a)]],["seal", [$h‍_a => (seal = $h‍_a)]]]],["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]]]);
1607
+
1605
1608
 
1606
1609
 
1607
1610
 
@@ -1656,23 +1659,21 @@ const alwaysThrowHandler= new Proxy(
1656
1659
  */
1657
1660
  const createScopeHandler= (
1658
1661
  globalObject,
1659
- localObject= {},
1662
+ globalLexicals= {},
1660
1663
  { sloppyGlobalsMode= false}= {})=>
1661
1664
  {
1662
1665
  // This flag allow us to determine if the eval() call is an done by the
1663
1666
  // compartment's code or if it is user-land invocation, so we can react
1664
1667
  // differently.
1665
- let allowNextEvalToBeUnsafe= false;
1666
-
1667
- const admitOneUnsafeEvalNext= ()=> {
1668
- allowNextEvalToBeUnsafe= true;
1669
- };
1668
+ // Using a flag on an object with a single mutable property allows a safe
1669
+ // evaluator to signal to the scope proxy without consuming a stack frame.
1670
+ // Consuming a stack frame could possibly allow an attacker to control the
1671
+ // stack depth before calling `evaluate` to cause a RangeError before this
1672
+ // flag can be reset, leaving the unsafe evaluator available.
1673
+ const scopeController= {
1674
+ allowNextEvalToBeUnsafe: false};
1670
1675
 
1671
- const resetOneUnsafeEvalNext= ()=> {
1672
- const wasSet= allowNextEvalToBeUnsafe;
1673
- allowNextEvalToBeUnsafe= false;
1674
- return wasSet;
1675
- };
1676
+ seal(scopeController);
1676
1677
 
1677
1678
  const scopeProxyHandlerProperties= {
1678
1679
  get(_shadow, prop) {
@@ -1685,20 +1686,20 @@ const createScopeHandler= (
1685
1686
  // the 'with' context.
1686
1687
  if( prop=== 'eval') {
1687
1688
  // test that it is true rather than merely truthy
1688
- if( allowNextEvalToBeUnsafe=== true) {
1689
+ if( scopeController.allowNextEvalToBeUnsafe=== true) {
1689
1690
  // revoke before use
1690
- allowNextEvalToBeUnsafe= false;
1691
+ scopeController.allowNextEvalToBeUnsafe= false;
1691
1692
  return FERAL_EVAL;
1692
1693
  }
1693
1694
  // fall through
1694
1695
  }
1695
1696
 
1696
- // Properties of the localObject.
1697
- if( prop in localObject) {
1697
+ // Properties of the globalLexicals.
1698
+ if( prop in globalLexicals) {
1698
1699
  // Use reflect to defeat accessors that could be present on the
1699
- // localObject object itself as `this`.
1700
+ // globalLexicals object itself as `this`.
1700
1701
  // This is done out of an overabundance of caution, as the SES shim
1701
- // only use the localObject carry globalLexicals and live binding
1702
+ // only use the globalLexicals carry globalLexicals and live binding
1702
1703
  // traps.
1703
1704
  // The globalLexicals are captured as a snapshot of what's passed to
1704
1705
  // the Compartment constructor, wherein all accessors and setters are
@@ -1707,7 +1708,7 @@ const createScopeHandler= (
1707
1708
  // make use of their receiver.
1708
1709
  // Live binding traps provide no avenue for user code to observe the
1709
1710
  // receiver.
1710
- return reflectGet(localObject, prop, globalObject);
1711
+ return reflectGet(globalLexicals, prop, globalObject);
1711
1712
  }
1712
1713
 
1713
1714
  // Properties of the global.
@@ -1715,17 +1716,17 @@ const createScopeHandler= (
1715
1716
  },
1716
1717
 
1717
1718
  set(_shadow, prop, value) {
1718
- // Properties of the localObject.
1719
- if( prop in localObject) {
1720
- const desc= getOwnPropertyDescriptor(localObject, prop);
1719
+ // Properties of the globalLexicals.
1720
+ if( prop in globalLexicals) {
1721
+ const desc= getOwnPropertyDescriptor(globalLexicals, prop);
1721
1722
  if( objectHasOwnProperty(desc, 'value')) {
1722
1723
  // Work around a peculiar behavior in the specs, where
1723
1724
  // value properties are defined on the receiver.
1724
- return reflectSet(localObject, prop, value);
1725
+ return reflectSet(globalLexicals, prop, value);
1725
1726
  }
1726
1727
  // Ensure that the 'this' value on setters resolves
1727
- // to the safeGlobal, not to the localObject object.
1728
- return reflectSet(localObject, prop, value, globalObject);
1728
+ // to the safeGlobal, not to the globalLexicals object.
1729
+ return reflectSet(globalLexicals, prop, value, globalObject);
1729
1730
  }
1730
1731
 
1731
1732
  // Properties of the global.
@@ -1768,8 +1769,8 @@ const createScopeHandler= (
1768
1769
  // !!!!! WARNING: DANGER ZONE !!!!!!
1769
1770
  return(
1770
1771
  sloppyGlobalsMode||
1771
- allowNextEvalToBeUnsafe&& prop=== 'eval'||
1772
- prop in localObject||
1772
+ scopeController.allowNextEvalToBeUnsafe&& prop=== 'eval'||
1773
+ prop in globalLexicals||
1773
1774
  prop in globalObject||
1774
1775
  prop in globalThis);
1775
1776
 
@@ -1809,8 +1810,7 @@ const createScopeHandler= (
1809
1810
 
1810
1811
 
1811
1812
  return {
1812
- admitOneUnsafeEvalNext,
1813
- resetOneUnsafeEvalNext,
1813
+ scopeController,
1814
1814
  scopeHandler};
1815
1815
 
1816
1816
  };$h‍_once.createScopeHandler(createScopeHandler);
@@ -2139,8 +2139,6 @@ const applyTransforms= (source, transforms)=> {
2139
2139
 
2140
2140
  const { details: d}= assert;
2141
2141
 
2142
- // TODO: rename localObject to scopeObject
2143
-
2144
2142
  /**
2145
2143
  * makeSafeEvaluator()
2146
2144
  * Build the low-level operation used by all evaluators:
@@ -2148,24 +2146,24 @@ const { details: d}= assert;
2148
2146
  *
2149
2147
  * @param {Object} options
2150
2148
  * @param {Object} options.globalObject
2151
- * @param {Object} [options.localObject]
2149
+ * @param {Object} [options.globalLexicals]
2152
2150
  * @param {Array<Transform>} [options.globalTransforms]
2153
2151
  * @param {bool} [options.sloppyGlobalsMode]
2154
2152
  * @param {WeakSet} [options.knownScopeProxies]
2155
2153
  */
2156
2154
  const makeSafeEvaluator= ({
2157
2155
  globalObject,
2158
- localObject= {},
2156
+ globalLexicals= {},
2159
2157
  globalTransforms= [],
2160
2158
  sloppyGlobalsMode= false,
2161
2159
  knownScopeProxies= new WeakSet()}=
2162
2160
  {})=> {
2163
- const {
2164
- scopeHandler,
2165
- admitOneUnsafeEvalNext,
2166
- resetOneUnsafeEvalNext}=
2167
- createScopeHandler(globalObject, localObject, {
2168
- sloppyGlobalsMode});
2161
+ const { scopeHandler, scopeController}= createScopeHandler(
2162
+ globalObject,
2163
+ globalLexicals,
2164
+ {
2165
+ sloppyGlobalsMode});
2166
+
2169
2167
 
2170
2168
  const { proxy: scopeProxy, revoke: revokeScopeProxy}= proxyRevocable(
2171
2169
  immutableObject,
@@ -2179,7 +2177,7 @@ const makeSafeEvaluator= ({
2179
2177
  let evaluate;
2180
2178
  const makeEvaluate= ()=> {
2181
2179
  if( !evaluate) {
2182
- const constants= getScopeConstants(globalObject, localObject);
2180
+ const constants= getScopeConstants(globalObject, globalLexicals);
2183
2181
  const evaluateFactory= makeEvaluateFactory(constants);
2184
2182
  evaluate= apply(evaluateFactory, scopeProxy, []);
2185
2183
  }
@@ -2201,7 +2199,7 @@ const makeSafeEvaluator= ({
2201
2199
  mandatoryTransforms]);
2202
2200
 
2203
2201
 
2204
- admitOneUnsafeEvalNext();
2202
+ scopeController.allowNextEvalToBeUnsafe= true;
2205
2203
  let err;
2206
2204
  try {
2207
2205
  // Ensure that "this" resolves to the safe global.
@@ -2211,13 +2209,15 @@ const makeSafeEvaluator= ({
2211
2209
  err= e;
2212
2210
  throw e;
2213
2211
  }finally {
2214
- if( resetOneUnsafeEvalNext()) {
2212
+ const unsafeEvalWasStillExposed= scopeController.allowNextEvalToBeUnsafe;
2213
+ scopeController.allowNextEvalToBeUnsafe= false;
2214
+ if( unsafeEvalWasStillExposed) {
2215
2215
  // Barring a defect in the SES shim, the scope proxy should allow the
2216
2216
  // powerful, unsafe `eval` to be used by `evaluate` exactly once, as the
2217
2217
  // very first name that it attempts to access from the lexical scope.
2218
- // A defect in the SES shim could throw an exception after our call to
2219
- // `admitOneUnsafeEvalNext()` and before `evaluate` calls `eval`
2220
- // internally.
2218
+ // A defect in the SES shim could throw an exception after we set
2219
+ // `scopeController.allowNextEvalToBeUnsafe` and before `evaluate`
2220
+ // calls `eval` internally.
2221
2221
  // If we get here, SES is very broken.
2222
2222
  // This condition is one where this vat is now hopelessly confused, and
2223
2223
  // the vat as a whole should be aborted.
@@ -2298,7 +2298,7 @@ const provideCompartmentEvaluator= (compartmentFields, options)=> {
2298
2298
 
2299
2299
  ({ safeEvaluate}= makeSafeEvaluator({
2300
2300
  globalObject,
2301
- localObject,
2301
+ globalLexicals: localObject,
2302
2302
  globalTransforms,
2303
2303
  sloppyGlobalsMode,
2304
2304
  knownScopeProxies}));
@@ -2685,7 +2685,10 @@ $h‍_once.uniqueGlobalPropertyNames(uniqueGlobalPropertyNames);const NativeErro
2685
2685
  * property definition.
2686
2686
  * <li>"ObjectPrototype" is the default "[[Proto]]" (when not specified).
2687
2687
  * <li>Constants "fn" and "getter" are used to keep the structure DRY.
2688
- * <li>Symbol properties are listed using the "@@name" form.
2688
+ * <li>Symbol properties are listed as follow:
2689
+ * <li>Well-known symbols use the "@@name" form.
2690
+ * <li>Registered symbols use the "RegisteredSymbol(key)" form.
2691
+ * <li>Unique symbols use the "UniqueSymbol(description)" form.
2689
2692
  */
2690
2693
 
2691
2694
  // Function Instances
@@ -2879,6 +2882,7 @@ const whitelist= {
2879
2882
  getOwnPropertyNames: fn,
2880
2883
  getOwnPropertySymbols: fn,
2881
2884
  getPrototypeOf: fn,
2885
+ hasOwn: fn,
2882
2886
  is: fn,
2883
2887
  isExtensible: fn,
2884
2888
  isFrozen: fn,
@@ -2888,9 +2892,7 @@ const whitelist= {
2888
2892
  prototype: '%ObjectPrototype%',
2889
2893
  seal: fn,
2890
2894
  setPrototypeOf: fn,
2891
- values: fn,
2892
- // See https://github.com/tc39/proposal-accessible-object-hasownproperty
2893
- hasOwn: fn},
2895
+ values: fn},
2894
2896
 
2895
2897
 
2896
2898
  '%ObjectPrototype%': {
@@ -3185,6 +3187,7 @@ const whitelist= {
3185
3187
  '%StringPrototype%': {
3186
3188
  // Properties of the String Prototype Object
3187
3189
  length: 'number',
3190
+ at: fn,
3188
3191
  charAt: fn,
3189
3192
  charCodeAt: fn,
3190
3193
  codePointAt: fn,
@@ -3237,11 +3240,7 @@ const whitelist= {
3237
3240
  trimLeft: fn,
3238
3241
  trimRight: fn,
3239
3242
  // See https://github.com/Moddable-OpenSource/moddable/issues/523
3240
- compare: false,
3241
-
3242
- // Stage 3:
3243
- // https://tc39.es/proposal-relative-indexing-method/
3244
- at: fn},
3243
+ compare: false},
3245
3244
 
3246
3245
 
3247
3246
  '%StringIteratorPrototype%': {
@@ -3338,6 +3337,7 @@ const whitelist= {
3338
3337
 
3339
3338
  '%ArrayPrototype%': {
3340
3339
  // Properties of the Array Prototype Object
3340
+ at: fn,
3341
3341
  length: 'number',
3342
3342
  concat: fn,
3343
3343
  constructor: 'Array',
@@ -3386,11 +3386,11 @@ const whitelist= {
3386
3386
  values: 'boolean',
3387
3387
  // Failed tc39 proposal
3388
3388
  // Seen on FF Nightly 88.0a1
3389
- at: false},
3389
+ at: false,
3390
+ // See https://github.com/tc39/proposal-array-find-from-last
3391
+ findLast: 'boolean',
3392
+ findLastIndex: 'boolean'},
3390
3393
 
3391
- // Failed tc39 proposal
3392
- // Seen on FF Nightly 88.0a1
3393
- at: false,
3394
3394
  // See https://github.com/tc39/proposal-array-find-from-last
3395
3395
  findLast: fn,
3396
3396
  findLastIndex: fn},
@@ -3415,6 +3415,7 @@ const whitelist= {
3415
3415
 
3416
3416
 
3417
3417
  '%TypedArrayPrototype%': {
3418
+ at: fn,
3418
3419
  buffer: getter,
3419
3420
  byteLength: getter,
3420
3421
  byteOffset: getter,
@@ -3447,9 +3448,6 @@ const whitelist= {
3447
3448
  values: fn,
3448
3449
  '@@iterator': fn,
3449
3450
  '@@toStringTag': getter,
3450
- // Failed tc39 proposal
3451
- // Seen on FF Nightly 88.0a1
3452
- at: false,
3453
3451
  // See https://github.com/tc39/proposal-array-find-from-last
3454
3452
  findLast: fn,
3455
3453
  findLastIndex: fn},
@@ -3749,7 +3747,11 @@ const whitelist= {
3749
3747
  constructor: 'Promise',
3750
3748
  finally: fn,
3751
3749
  then: fn,
3752
- '@@toStringTag': 'string'},
3750
+ '@@toStringTag': 'string',
3751
+ // Non-standard, used in node to prevent async_hooks from breaking
3752
+ 'UniqueSymbol(async_id_symbol)': accessor,
3753
+ 'UniqueSymbol(trigger_async_id_symbol)': accessor,
3754
+ 'UniqueSymbol(destroyed)': accessor},
3753
3755
 
3754
3756
 
3755
3757
  '%InertAsyncFunction%': {
@@ -4468,7 +4470,8 @@ $h‍_once.deferExports(deferExports);const getDeferredExports=(
4468
4470
  })
4469
4471
  ,
4470
4472
  // === functors[18] ===
4471
- (({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, }) => { let assert,getDeferredExports,ReferenceError,SyntaxError,TypeError,arrayForEach,arrayIncludes,arrayPush,arraySome,arraySort,create,defineProperty,entries,freeze,isArray,keys,mapGet,weakmapGet,compartmentEvaluate;$h‍_imports([["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]],["./module-proxy.js", [["getDeferredExports", [$h‍_a => (getDeferredExports = $h‍_a)]]]],["./commons.js", [["ReferenceError", [$h‍_a => (ReferenceError = $h‍_a)]],["SyntaxError", [$h‍_a => (SyntaxError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["arrayForEach", [$h‍_a => (arrayForEach = $h‍_a)]],["arrayIncludes", [$h‍_a => (arrayIncludes = $h‍_a)]],["arrayPush", [$h‍_a => (arrayPush = $h‍_a)]],["arraySome", [$h‍_a => (arraySome = $h‍_a)]],["arraySort", [$h‍_a => (arraySort = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["isArray", [$h‍_a => (isArray = $h‍_a)]],["keys", [$h‍_a => (keys = $h‍_a)]],["mapGet", [$h‍_a => (mapGet = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]]]],["./compartment-evaluate.js", [["compartmentEvaluate", [$h‍_a => (compartmentEvaluate = $h‍_a)]]]]]);
4473
+ (({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, }) => { let assert,getDeferredExports,ReferenceError,SyntaxError,TypeError,arrayForEach,arrayIncludes,arrayPush,arraySome,arraySort,create,defineProperty,entries,freeze,isArray,keys,mapGet,weakmapGet,reflectHas,compartmentEvaluate;$h‍_imports([["./error/assert.js", [["assert", [$h‍_a => (assert = $h‍_a)]]]],["./module-proxy.js", [["getDeferredExports", [$h‍_a => (getDeferredExports = $h‍_a)]]]],["./commons.js", [["ReferenceError", [$h‍_a => (ReferenceError = $h‍_a)]],["SyntaxError", [$h‍_a => (SyntaxError = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["arrayForEach", [$h‍_a => (arrayForEach = $h‍_a)]],["arrayIncludes", [$h‍_a => (arrayIncludes = $h‍_a)]],["arrayPush", [$h‍_a => (arrayPush = $h‍_a)]],["arraySome", [$h‍_a => (arraySome = $h‍_a)]],["arraySort", [$h‍_a => (arraySort = $h‍_a)]],["create", [$h‍_a => (create = $h‍_a)]],["defineProperty", [$h‍_a => (defineProperty = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["freeze", [$h‍_a => (freeze = $h‍_a)]],["isArray", [$h‍_a => (isArray = $h‍_a)]],["keys", [$h‍_a => (keys = $h‍_a)]],["mapGet", [$h‍_a => (mapGet = $h‍_a)]],["weakmapGet", [$h‍_a => (weakmapGet = $h‍_a)]],["reflectHas", [$h‍_a => (reflectHas = $h‍_a)]]]],["./compartment-evaluate.js", [["compartmentEvaluate", [$h‍_a => (compartmentEvaluate = $h‍_a)]]]]]);
4474
+
4472
4475
 
4473
4476
 
4474
4477
 
@@ -4543,22 +4546,36 @@ const makeThirdPartyModuleInstance= (
4543
4546
  update(value);
4544
4547
  };
4545
4548
  });
4549
+ // This is enough to support import * from cjs - the '*' field doesn't need to be in exports nor proxiedExports because import will only ever access it via notifiers
4550
+ notifiers['*']= (update)=>{
4551
+ update(proxiedExports);
4552
+ };
4546
4553
  }
4547
4554
 
4548
- let activated= false;
4555
+ const localState= {
4556
+ activated: false};
4557
+
4549
4558
  return freeze({
4550
4559
  notifiers,
4551
4560
  exportsProxy,
4552
4561
  execute() {
4553
- if( !activated) {
4562
+ if( reflectHas(localState, 'errorFromExecute')) {
4563
+ throw localState.errorFromExecute;
4564
+ }
4565
+ if( !localState.activated) {
4554
4566
  activate();
4555
- activated= true;
4556
- // eslint-disable-next-line @endo/no-polymorphic-call
4557
- staticModuleRecord.execute(
4558
- proxiedExports,
4559
- compartment,
4560
- resolvedImports);
4567
+ localState.activated= true;
4568
+ try {
4569
+ // eslint-disable-next-line @endo/no-polymorphic-call
4570
+ staticModuleRecord.execute(
4571
+ proxiedExports,
4572
+ compartment,
4573
+ resolvedImports);
4561
4574
 
4575
+ }catch( err) {
4576
+ localState.errorFromExecute= err;
4577
+ throw err;
4578
+ }
4562
4579
  }
4563
4580
  }});
4564
4581
 
@@ -5398,7 +5415,7 @@ const makeCompartmentConstructor= (
5398
5415
  const knownScopeProxies= new WeakSet();
5399
5416
  const { safeEvaluate}= makeSafeEvaluator({
5400
5417
  globalObject,
5401
- localObject: globalLexicals,
5418
+ globalLexicals,
5402
5419
  globalTransforms,
5403
5420
  sloppyGlobalsMode: false,
5404
5421
  knownScopeProxies});
@@ -8011,7 +8028,9 @@ function tameRegExpConstructor(regExpTaming= 'safe') {
8011
8028
  })
8012
8029
  ,
8013
8030
  // === functors[38] ===
8014
- (({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, }) => { let whitelist,FunctionInstance,isAccessorPermit,String,TypeError,arrayIncludes,getOwnPropertyDescriptor,getPrototypeOf,isObject,objectHasOwnProperty,ownKeys,stringSlice;$h‍_imports([["./whitelist.js", [["whitelist", [$h‍_a => (whitelist = $h‍_a)]],["FunctionInstance", [$h‍_a => (FunctionInstance = $h‍_a)]],["isAccessorPermit", [$h‍_a => (isAccessorPermit = $h‍_a)]]]],["./commons.js", [["String", [$h‍_a => (String = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["arrayIncludes", [$h‍_a => (arrayIncludes = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getPrototypeOf", [$h‍_a => (getPrototypeOf = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["ownKeys", [$h‍_a => (ownKeys = $h‍_a)]],["stringSlice", [$h‍_a => (stringSlice = $h‍_a)]]]]]);
8031
+ (({ imports: $h‍_imports, liveVar: $h‍_live, onceVar: $h‍_once, }) => { let whitelist,FunctionInstance,isAccessorPermit,Map,String,TypeError,arrayFilter,arrayIncludes,arrayMap,entries,getOwnPropertyDescriptor,getPrototypeOf,isObject,mapGet,objectHasOwnProperty,ownKeys,symbolKeyFor;$h‍_imports([["./whitelist.js", [["whitelist", [$h‍_a => (whitelist = $h‍_a)]],["FunctionInstance", [$h‍_a => (FunctionInstance = $h‍_a)]],["isAccessorPermit", [$h‍_a => (isAccessorPermit = $h‍_a)]]]],["./commons.js", [["Map", [$h‍_a => (Map = $h‍_a)]],["String", [$h‍_a => (String = $h‍_a)]],["TypeError", [$h‍_a => (TypeError = $h‍_a)]],["arrayFilter", [$h‍_a => (arrayFilter = $h‍_a)]],["arrayIncludes", [$h‍_a => (arrayIncludes = $h‍_a)]],["arrayMap", [$h‍_a => (arrayMap = $h‍_a)]],["entries", [$h‍_a => (entries = $h‍_a)]],["getOwnPropertyDescriptor", [$h‍_a => (getOwnPropertyDescriptor = $h‍_a)]],["getPrototypeOf", [$h‍_a => (getPrototypeOf = $h‍_a)]],["isObject", [$h‍_a => (isObject = $h‍_a)]],["mapGet", [$h‍_a => (mapGet = $h‍_a)]],["objectHasOwnProperty", [$h‍_a => (objectHasOwnProperty = $h‍_a)]],["ownKeys", [$h‍_a => (ownKeys = $h‍_a)]],["symbolKeyFor", [$h‍_a => (symbolKeyFor = $h‍_a)]]]]]);
8032
+
8033
+
8015
8034
 
8016
8035
 
8017
8036
 
@@ -8069,23 +8088,8 @@ function tameRegExpConstructor(regExpTaming= 'safe') {
8069
8088
 
8070
8089
 
8071
8090
 
8072
- /**
8073
- * asStringPropertyName()
8074
- *
8075
- * @param {string} path
8076
- * @param {string | symbol} prop
8077
- */
8078
- function asStringPropertyName(path, prop) {
8079
- if( typeof prop=== 'string') {
8080
- return prop;
8081
- }
8082
8091
 
8083
- if( typeof prop=== 'symbol') {
8084
- return `@@${stringSlice(String(prop),14, -1) }`;
8085
- }
8086
8092
 
8087
- throw new TypeError( `Unexpected property name type ${path} ${prop}`);
8088
- }
8089
8093
 
8090
8094
  /**
8091
8095
  * whitelistIntrinsics()
@@ -8099,9 +8103,53 @@ function whitelistIntrinsics(
8099
8103
  intrinsics,
8100
8104
  markVirtualizedNativeFunction)
8101
8105
  {
8102
- // These primities are allowed allowed for permits.
8106
+ // These primitives are allowed allowed for permits.
8103
8107
  const primitives= ['undefined', 'boolean', 'number', 'string', 'symbol'];
8104
8108
 
8109
+ // These symbols are allowed as well-known symbols
8110
+ const wellKnownSymbolNames= new Map(
8111
+ intrinsics.Symbol?
8112
+ arrayMap(
8113
+ arrayFilter(
8114
+ entries(whitelist.Symbol),
8115
+ ([name, permit])=>
8116
+ permit=== 'symbol'&&
8117
+ typeof intrinsics.Symbol[name]=== 'symbol'),
8118
+
8119
+ ([name])=> [intrinsics.Symbol[name], `@@${name}`]):
8120
+
8121
+ []);
8122
+
8123
+
8124
+ /**
8125
+ * asStringPropertyName()
8126
+ *
8127
+ * @param {string} path
8128
+ * @param {string | symbol} prop
8129
+ */
8130
+ function asStringPropertyName(path, prop) {
8131
+ if( typeof prop=== 'string') {
8132
+ return prop;
8133
+ }
8134
+
8135
+ const wellKnownSymbol= mapGet(wellKnownSymbolNames, prop);
8136
+
8137
+ if( typeof prop=== 'symbol') {
8138
+ if( wellKnownSymbol) {
8139
+ return wellKnownSymbol;
8140
+ }else {
8141
+ const registeredKey= symbolKeyFor(prop);
8142
+ if( registeredKey!== undefined) {
8143
+ return `RegisteredSymbol(${registeredKey})`;
8144
+ }else {
8145
+ return `Unique${String(prop)}`;
8146
+ }
8147
+ }
8148
+ }
8149
+
8150
+ throw new TypeError( `Unexpected property name type ${path} ${prop}`);
8151
+ }
8152
+
8105
8153
  /*
8106
8154
  * visitPrototype()
8107
8155
  * Validate the object's [[prototype]] against a permit.
@@ -8808,6 +8856,8 @@ assign(globalThis, {
8808
8856
  toStringTagSymbol: cell("toStringTagSymbol"),
8809
8857
  iteratorSymbol: cell("iteratorSymbol"),
8810
8858
  matchAllSymbol: cell("matchAllSymbol"),
8859
+ symbolKeyFor: cell("symbolKeyFor"),
8860
+ symbolFor: cell("symbolFor"),
8811
8861
  isInteger: cell("isInteger"),
8812
8862
  stringifyJson: cell("stringifyJson"),
8813
8863
  fromEntries: cell("fromEntries"),
@@ -9115,6 +9165,8 @@ assign(globalThis, {
9115
9165
  toStringTagSymbol: cells[0].toStringTagSymbol.set,
9116
9166
  iteratorSymbol: cells[0].iteratorSymbol.set,
9117
9167
  matchAllSymbol: cells[0].matchAllSymbol.set,
9168
+ symbolKeyFor: cells[0].symbolKeyFor.set,
9169
+ symbolFor: cells[0].symbolFor.set,
9118
9170
  isInteger: cells[0].isInteger.set,
9119
9171
  stringifyJson: cells[0].stringifyJson.set,
9120
9172
  fromEntries: cells[0].fromEntries.set,