ses 2.2.0 → 2.3.1

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 ADDED
@@ -0,0 +1,1462 @@
1
+ # ses
2
+
3
+ ## 2.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - `rejectImportExpressions` rejects any property access on `import`, including `import.source(...)`, `import.defer(...)`, the bare `import.meta` property and any future faux property of `import`, whether or not the access is then called. Engines that parse the source-phase and deferred-import proposals accept `import.source(specifier)` and `import.defer(specifier)` in script code as dynamic imports, which reached the host's module loader from inside a compartment.
8
+
9
+ This is intentionally broader than strictly necessary: source text that only incidentally contains `import.` (in a string or a comment) is now rejected too, except in a trailing `//# sourceURL=` or `//# sourceMappingURL=` comment, as module loaders and bundlers append, whose value cannot end a comment, string or template. `evadeImportExpressionTest` shares the pattern and now also rewrites `import.` to `__import__.`.
10
+
11
+ ## 2.3.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#3308](https://github.com/endojs/endo/pull/3308) [`4da9a99`](https://github.com/endojs/endo/commit/4da9a9959e4376c5760a3232e978a4f8fe4ac6b7) Thanks [@kriskowal](https://github.com/kriskowal)! - Drop the immutable-ArrayBuffer pseudo-prototype.
16
+
17
+ Emulated immutable `ArrayBuffer`s produced by `@endo/immutable-arraybuffer` now inherit directly from `ArrayBuffer.prototype` rather than from an intermediate prototype. `Object.getPrototypeOf(immuAB) === ArrayBuffer.prototype` for both emulated immutable and genuine buffers; the brand check is the new `immutable` accessor on `ArrayBuffer.prototype` installed by the shim.
18
+
19
+ The `[Symbol.toStringTag]` slot is preserved as an own property on each emulated immutable buffer (not on the shared prototype), so `Object.prototype.toString.call(immuAB)` continues to return `'[object ImmutableArrayBuffer]'` (as in master) while genuine ArrayBuffers continue to read as `'[object ArrayBuffer]'`. This keeps `concordance` (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's `Buffer.from`, which throws because the emulated immutable is not an exotic object.
20
+
21
+ `@endo/immutable-arraybuffer` is now a side-effect-only package: its sole public export is `./shim.js`. The `index.js` and 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 the `ArrayBuffer.prototype.immutable` accessor (or `Object.prototype.toString.call(buffer) === '[object ImmutableArrayBuffer]'` when the shim has not been loaded) and convert via `buffer.sliceToImmutable(...)` and `buffer.transferToImmutable(...)` on the prototype. The break is a major bump for the `@endo/immutable-arraybuffer` package.
22
+
23
+ `@endo/bytes`'s `to-immutable.js` imports `@endo/immutable-arraybuffer/shim.js` (triggering the shim install) and calls `buffer.sliceToImmutable(...)` on `ArrayBuffer.prototype` instead of the previously exported `sliceBufferToImmutable` free function.
24
+
25
+ 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.prototype` is already true when the shim loads, the shim does nothing.
26
+
27
+ `ses` drops 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.
28
+
29
+ `@endo/pass-style`'s `byteArray` brand check no longer routes through an intermediate prototype; it consults the `immutable` accessor on `ArrayBuffer.prototype` directly. 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.
30
+
31
+ - [#3322](https://github.com/endojs/endo/pull/3322) [`eeefaa0`](https://github.com/endojs/endo/commit/eeefaa0100625d6ef7b712e7b79b2223d9e30a85) Thanks [@kriskowal](https://github.com/kriskowal)! - Permit `TextEncoder` and `TextDecoder` as universal intrinsics.
32
+
33
+ `TextEncoder` and `TextDecoder` are pure transformations between `string` and `Uint8Array` with 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.
34
+
35
+ Code that monkey-patches `TextEncoder.prototype` or `TextDecoder.prototype` after `lockdown()` will now throw, because the prototypes are frozen. Such mutations must happen before lockdown, the same rule that already applies to every other intrinsic.
36
+
37
+ - [#3220](https://github.com/endojs/endo/pull/3220) [`d47d74f`](https://github.com/endojs/endo/commit/d47d74f3139e737de932b3cb59b2b62d4c055299) Thanks [@boneskull](https://github.com/boneskull)! - Exposes `__noNamespaceBox__` getter on `Compartment`.
38
+
39
+ - [#3316](https://github.com/endojs/endo/pull/3316) [`71cbdb9`](https://github.com/endojs/endo/commit/71cbdb989afcc4b5633f8b3981ae8254109d8d2d) Thanks [@boneskull](https://github.com/boneskull)! - `makeError()` now allows a `code?: string` option, which sets a `code` property on the resulting `Error`, if so desired.
40
+
41
+ ### Patch Changes
42
+
43
+ - [#3306](https://github.com/endojs/endo/pull/3306) [`a85b212`](https://github.com/endojs/endo/commit/a85b212344b2a1e2329e55852e11c590828fc450) Thanks [@gibson042](https://github.com/gibson042)! - - `consoleTaming: 'safe'` prevents Node.js console logging from invoking custom inspect methods
44
+
45
+ - [#3307](https://github.com/endojs/endo/pull/3307) [`c69eb03`](https://github.com/endojs/endo/commit/c69eb033e5db48c681e6ab39445142732871bb80) Thanks [@gibson042](https://github.com/gibson042)! - The console format specifier `%c` is for consuming a CSS style string and applying that style to the rendering of the remaining arguments. Node.js and browsers both parse `%c` the same way and have it consume one argument.
46
+ - Browsers actually make use of the CSS, leading to security problems (e.g., <https://issues.chromium.org/40056332> ).
47
+ - Node.js ignores the `%c` and its corresponding argument, which is allowed by the [WHATWG Console specification](https://console.spec.whatwg.org/).
48
+
49
+ To avoid the CSS security problems on all platforms, under the defaut `consoleTaming: 'safe'`, we now sanitize out the `%c` and 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.
50
+
51
+ - [#3309](https://github.com/endojs/endo/pull/3309) [`bfa149b`](https://github.com/endojs/endo/commit/bfa149b4f18c6ad1cf1fed3e91cbaddf1e61b39d) Thanks [@boneskull](https://github.com/boneskull)! - `makeError` now narrows type of return instance when `errConstructor` provided.
52
+
53
+ - Updated dependencies [[`4da9a99`](https://github.com/endojs/endo/commit/4da9a9959e4376c5760a3232e978a4f8fe4ac6b7)]:
54
+ - @endo/immutable-arraybuffer@2.0.0
55
+
56
+ ## 2.2.0
57
+
58
+ ### Minor Changes
59
+
60
+ - [#3285](https://github.com/endojs/endo/pull/3285) [`889be5e`](https://github.com/endojs/endo/commit/889be5eda934c439e97df81104d35945c4f519e2) Thanks [@erights](https://github.com/erights)! - Permit both initial powerful Temporal and safe shared Temporal
61
+
62
+ - [#2422](https://github.com/endojs/endo/pull/2422) [`fe6be07`](https://github.com/endojs/endo/commit/fe6be074317c8afedc28139683e148a952377062) Thanks [@kriskowal](https://github.com/kriskowal)! - Add support for host module exits in bundled compartments.
63
+
64
+ `ses` exports a new `StrictModuleDescriptor` type that consists only of the
65
+ `NamespaceModuleDescriptor` and `SourceModuleDescriptor` shapes mutually
66
+ supported by SES and XS.
67
+
68
+ `compartment-mapper` lets arbitrary module descriptors pass through
69
+ `importHook` when no policy is in effect for that edge (the
70
+ policy-enforcement runtime was previously limited to virtual module sources).
71
+ It also implicitly treats any module specifier with a URL-scheme prefix
72
+ (like `node:fs`) as an exit module when bundling, removing the need for an
73
+ additional bundler flag in the common case.
74
+
75
+ `import-bundle` threads the `importHook` option through to the underlying
76
+ compartment so that bundled applications can route exits to host-provided
77
+ implementations at import time.
78
+ Host-provided modules must be hardened and pure to avoid being a
79
+ side-channel or man-in-the-middle attack surface between guests.
80
+
81
+ ## 2.1.0
82
+
83
+ ### Minor Changes
84
+
85
+ - [#3284](https://github.com/endojs/endo/pull/3284) [`f2aa55a`](https://github.com/endojs/endo/commit/f2aa55a7d0ab3abfa7279e3973277faa7cdd791f) Thanks [@boneskull](https://github.com/boneskull)! - Allows `Map.prototype.getOrInsert`, `Map.prototype.getOrInsertComputed`, `WeakMap.prototype.getOrInsert` and `WeakMap.prototype.getOrInsertComputed`.
86
+
87
+ ### Patch Changes
88
+
89
+ - [#3223](https://github.com/endojs/endo/pull/3223) [`fa0b6a9`](https://github.com/endojs/endo/commit/fa0b6a9ad57c0791b314d233b7962ca860977216) Thanks [@gibson042](https://github.com/gibson042)! - Addresses infidelities and inefficiencies of [#3214](https://github.com/endojs/endo/issues/3214)
90
+
91
+ - [#3214](https://github.com/endojs/endo/pull/3214) [`459347b`](https://github.com/endojs/endo/commit/459347b34b8b5d5adfac9def8cee035b6cfa42d7) Thanks [@erights](https://github.com/erights)! - Fixes bug [#3202](https://github.com/endojs/endo/issues/3202) repairing momentary breakage of setFloat16 and setFloat32
92
+
93
+ ## 2.0.0
94
+
95
+ ### Major Changes
96
+
97
+ - [#3153](https://github.com/endojs/endo/pull/3153) [`e619205`](https://github.com/endojs/endo/commit/e6192056a5d7ff5acb084f6a58dca3663aa9943e) Thanks [@erights](https://github.com/erights)! - # Plug NaN Side-channel
98
+
99
+ The 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.
100
+
101
+ @ChALkeR explains at https://github.com/tc39/ecma262/pull/758#issuecomment-3919093669 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.
102
+
103
+ To plug this side-channel, we make two coordinated changes.
104
+ - We stop listing the `Float*Array` constructors 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 on `lockdown()`. Thus, they can be explicitly endowed to child compartments at the price of enabling code in that compartment to read the side-channel.
105
+ - On `lockdown()`, we repair the `DataView.prototype.setFloat*` methods so that they only write canonical NaNs into the underlying ArrayBuffer.
106
+
107
+ The `@endo.marshal` package's `encodePassable` encodings need to obtain the bit representation of floating point values. It had used `Float64Array` for that. However, sometimes the `@endo/marshal` package is evaluated in a created compartment that would now lack that constructor. (This reevaluation typically occurs when bundling bundles in that package.) So instead, `encodePassable` now uses the `DataView` methods which are now safe.
108
+
109
+ ### Minor Changes
110
+
111
+ - [#3129](https://github.com/endojs/endo/pull/3129) [`a675d8e`](https://github.com/endojs/endo/commit/a675d8ec9df34d69cef84da6dec7750180108b59) Thanks [@erights](https://github.com/erights)! - `overrideTaming: 'moderate'` includes `overrideTaming: 'min'`.
112
+
113
+ Previously `overrideTaming: 'min'` correctly enabled `Iterator.prototype.constructor` to be overridden by assignment, but due to an oversight, `overrideTaming: 'moderate'` did not. Now it does.
114
+
115
+ 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.
116
+
117
+ ## 1.15.0
118
+
119
+ ### Minor Changes
120
+
121
+ - [#3082](https://github.com/endojs/endo/pull/3082) [`2e00276`](https://github.com/endojs/endo/commit/2e00276ce0f08beb5e5259b8df195063fe008fe7) Thanks [@boneskull](https://github.com/boneskull)! - - Adds `assert.makeError` and deprecates `assert.error` as an alias, matching
122
+ the API already exported from `@endo/errors`.
123
+ - Before this version, the `assert` left in global scope before `lockdown`
124
+ would redact errors and would be replaced by `lockdown` with a version that
125
+ did _not_ redact errors if the caller opted-in with `errorTaming`
126
+ set to one of the `unsafe` variants.
127
+ After this version, the reverse is true: the `assert` left in global scope
128
+ before `lockdown` does not redact.
129
+ Then, `lockdown` replaces `assert` with a redacting `assert` unless the
130
+ caller opted-out with `errorTaming` set to one of the `unsafe` variants.
131
+
132
+ - [#3008](https://github.com/endojs/endo/pull/3008) [`a29ecd4`](https://github.com/endojs/endo/commit/a29ecd44c788440faf016f1f8e658a5a364d6181) Thanks [@kriskowal](https://github.com/kriskowal)! - - `lockdown` and `repairIntrinsics` now detect when code has already called a
133
+ `harden` imported from `@endo/harden` before lockdown, and fail with a clear
134
+ error about hardened modules executing before lockdown.
135
+ - Adds `Object[Symbol.for('harden')]` as a variant of `globalThis.harden` that
136
+ cannot be overridden by an endowment named `harden` in compartments.
137
+
138
+ ## [1.14.0](https://github.com/endojs/endo/compare/ses@1.13.1...ses@1.14.0) (2025-07-12)
139
+
140
+ ### Features
141
+
142
+ - **cache-map:** Promote makeLRUCacheMap into a new package ([a39db9e](https://github.com/endojs/endo/commit/a39db9e03dd9bdcc20e25bb857351ca5bfe314ef))
143
+ - **cache-map:** Return a kit for exposing metrics ([f513ebd](https://github.com/endojs/endo/commit/f513ebd36c01ce45eb2684d5f9db4db57a4ac526))
144
+ - **ses:** add noAggregateLoadErrors flag ([#2832](https://github.com/endojs/endo/issues/2832)) ([b222f9f](https://github.com/endojs/endo/commit/b222f9f5c68ef373c31a68b091452b7789a6621b))
145
+
146
+ ### Bug Fixes
147
+
148
+ - **immutable-arraybuffer:** unify shim to work on more platforms ([#2855](https://github.com/endojs/endo/issues/2855)) ([25039f5](https://github.com/endojs/endo/commit/25039f561d5e0c1bac48260adcf7e1a26d661659)), closes [#2785](https://github.com/endojs/endo/issues/2785) [#2399](https://github.com/endojs/endo/issues/2399) [#2785](https://github.com/endojs/endo/issues/2785) [#2785](https://github.com/endojs/endo/issues/2785)
149
+
150
+ ## [1.13.1](https://github.com/endojs/endo/compare/ses@1.13.0...ses@1.13.1) (2025-06-17)
151
+
152
+ ### Bug Fixes
153
+
154
+ - **pass-style:** better byteArray support ([#2843](https://github.com/endojs/endo/issues/2843)) ([492551a](https://github.com/endojs/endo/commit/492551a936cf74fbeff0935b95fbd02ce02f796a)), closes [#2248](https://github.com/endojs/endo/issues/2248) [#2248](https://github.com/endojs/endo/issues/2248) [#2248](https://github.com/endojs/endo/issues/2248)
155
+
156
+ ## [1.13.0](https://github.com/endojs/endo/compare/ses@1.12.0...ses@1.13.0) (2025-06-02)
157
+
158
+ - Two new `stackFiltering:` options are added
159
+ - `'omit-frames'` -- Only omit likely uninteresting frames. Keep original paths.
160
+ - `'shorten-paths'` -- Only shorten paths to text likely clickable in an IDE
161
+
162
+ This fills out the matrix of what should have been orthogonal options.
163
+ The existing `'concise'` setting both omits likely uninteresting frames and
164
+ shortens their paths. The existing `'verbose'` setting does neither.
165
+
166
+ - Uses the `@endo/immutable-arraybuffer` shim to add `ArrayBuffer.p.immutable`, `ArrayBuffer.p.transferToImmutable`, and `ArrayBuffer.p.sliceToImmutable` to ses, in order to emulate the [Immutable ArrayBuffer proposal](https://github.com/tc39/proposal-immutable-arraybuffer). These make an ArrayBuffer-like object whose contents cannot be mutated. However, due to limitations of the shim
167
+ - Unlike `ArrayBuffer` and `SharedArrayBuffer` this shim's ArrayBuffer-like object cannot be transfered or cloned between JS threads.
168
+ - Unlike `ArrayBuffer` and `SharedArrayBuffer`, this shim's ArrayBuffer-like object cannot be used as the backing store of TypeArrays or DataViews.
169
+ - The shim depends on the platform providing either `structuredClone` or `Array.prototype.transfer`. Node <= 16 and provides neither, causing the shim to fail to initialize, and therefore SES to fail to initialize on such platforms.
170
+ - Current Hermes has even stronger constraints, lacking `structuredClone`, `transfer`, private fields, and even `class` syntax. This requires other coping strategies. See <https://github.com/endojs/endo/pull/2785>
171
+ - Even after the upcoming `transferToImmutable` proposal is implemented by the platform, the current code will still replace it with the shim implementation, in accord with shim best practices. See <https://github.com/endojs/endo/pull/2311#discussion_r1632607527> . It will require a later manual step to delete the shim or have it avoid overriting a platform implementation, after manual analysis of the compat implications.
172
+
173
+ - The [evalTaming](https://github.com/endojs/endo/blob/master/packages/ses/docs/lockdown.md#evaltaming-options)
174
+ option `'safe-eval'` now can only throw error `SES_DIRECT_EVAL`.
175
+ This allows SES to initialize with `'unsafe-eval'` or `'no-eval'` on hosts with no
176
+ direct eval available such as Hermes for a successful lockdown that tolerates it's
177
+ language [features](https://github.com/facebook/hermes/blob/main/doc/Features.md).
178
+
179
+ The module name `ses/hermes` can now be required to call `lockdown` and
180
+ `repairIntrinsics` only, `Compartment` is not yet available.
181
+
182
+ It is currently compatible with Hermes [v0.12.0](https://www.npmjs.com/package/hermes-engine-cli/v/0.12.0),
183
+ we plan to support [v0.13.0](https://github.com/facebook/hermes/releases/tag/v0.13.0)
184
+ then subsequent Hermes [tags](https://github.com/facebook/hermes/tags) or side-by-side
185
+ versions built for React Native depending on ecosystem usage and official
186
+ [support](https://github.com/reactwg/react-native-releases/blob/main/docs/support.md),
187
+ then Static Hermes when released.
188
+
189
+ Also `ses/hermes` can now be hooked into bundlers such as Metro to run Hardened JS.
190
+
191
+ - The `Compartment` constructor now accepts a `boolean` option, `noAggregateLoadErrors`, to control how module-loading errors are reported.
192
+
193
+ By default, its value is `false`, which retains the previous behavior (it causes all relevant errors to be collected and rejected or thrown in a single exception from `compartment.import()` or `compartment.importNow()`, respectively).
194
+
195
+ If set to `true`, this will cause the _first_ module-loading error encountered to be thrown (or rejected) immediately; no further module-loading will be attempted, and no further errors will be collected.
196
+
197
+ This is mostly useful for supporting optional dependencies in CommonJS modules.
198
+
199
+ ## [1.12.0](https://github.com/endojs/endo/compare/ses@1.11.0...ses@1.12.0) (2025-03-24)
200
+
201
+ - The `evalTaming:` option values are renamed
202
+ - from `'safeEval'`, `'unsafeEval'`, and `'noEval'`
203
+ - to `'safe-eval'`, `'unsafe-eval'`, and `'no-eval'`
204
+
205
+ in order to follow the convention that lockdown option values use kebob-case
206
+ rather than camelCase. To avoid breaking old programs during the transition,
207
+ the old names are deprecated, but continue to work for now.
208
+
209
+ - Evaluating a non-lexical name that is also absent on the global object of a
210
+ compartment no longer throws a `ReferenceError` and instead produces
211
+ `undefined` because it proves impossible to do so without revealing what
212
+ properties exist on the host `globalThis` to compartmentalized code with a
213
+ shim.
214
+ This is a divergence from the expected behavior of a native Hardened
215
+ JavaScript implementation, like XS.
216
+
217
+ ## [1.11.0](https://github.com/endojs/endo/compare/ses@1.10.0...ses@1.11.0) (2025-01-24)
218
+
219
+ - Adds support for dynamic `import` in conjunction with an update to
220
+ `@endo/module-source`.
221
+
222
+ - Specifying the long-discontinued `mathTaming` or `dateTaming` options logs a
223
+ warning.
224
+
225
+ Incubating: Please do not rely on these features as they are under development
226
+ and subject to breaking changes that will not be signaled by semver.
227
+
228
+ - Adds support for an XS-specific variant of the SES shim that is triggered
229
+ with the `xs` package export condition.
230
+ This version of SES preserves all the features of `Compartment` provided
231
+ uniquely by the SES shim, but with the `__native__` constructor option,
232
+ loses support for importing precompiled module records and gains support
233
+ for native `ModuleSource`.
234
+
235
+ ## [1.10.0](https://github.com/endojs/endo/compare/ses@1.9.1...ses@1.10.0) (2024-11-13)
236
+
237
+ - Permit [Promise.try](https://github.com/tc39/proposal-promise-try),
238
+ since it has reached Stage 4.
239
+
240
+ - Adds a `reporting` option to `lockdown` and `repairIntrinsics`.
241
+
242
+ The default behavior is `"platform"` which will detect the platform and
243
+ report warnings according to whether a web `console`, Node.js `console`, or
244
+ `print` are available.
245
+ The web platform is distinguished by the existence of `window` or
246
+ `importScripts` (WebWorker).
247
+ The Node.js behavior is to report all warnings to `stderr` visually
248
+ consistent with use of a console group.
249
+ SES will use `print` in the absence of a `console`.
250
+ Captures the platform `console` at the time `lockdown` or `repairIntrinsics`
251
+ are called, not at the time `ses` initializes.
252
+
253
+ The `"console"` option forces the web platform behavior.
254
+ On Node.js, this results in group labels being reported to `stdout`.
255
+
256
+ The `"none"` option mutes warnings.
257
+
258
+ ## [1.9.1](https://github.com/endojs/endo/compare/ses@1.9.0...ses@1.9.1) (2024-10-22)
259
+
260
+ **Note:** Version bump only for package ses
261
+
262
+ ## [1.9.0](https://github.com/endojs/endo/compare/ses@1.8.0...ses@1.9.0) (2024-10-10)
263
+
264
+ - On platforms without
265
+ [`Array.prototype.transfer`](https://github.com/tc39/proposal-resizablearraybuffer)
266
+ but with a global `structuredClone`, the ses-shim's `lockdown` will now
267
+ install an emulation of `Array.prototype.transfer`. On platforms with neither,
268
+ the ses-shim will _currently_ not install such an emulation.
269
+ However, once we verify that endo is not intended to support platforms
270
+ without both, we may change `lockdown` to throw, failing to lock down.
271
+ - XS and Node >= 22 already have `Array.prototype.transfer`.
272
+ - Node 18, Node 20, and all browsers have `structuredClone`
273
+ - Node <= 16 have neither, but are also no longer supported by Endo.
274
+ - Now exports separate layer for console shim: `ses/console-shim.js`.
275
+ - Adds permits for `ModuleSource`, either the native implementation or from
276
+ `@endo/module-source/shim.js`.
277
+
278
+ ## [1.8.0](https://github.com/endojs/endo/compare/ses@1.7.0...ses@1.8.0) (2024-08-27)
279
+
280
+ - New `legacyRegeneratorRuntimeTaming: 'unsafe-ignore'` lockdown option to tame
281
+ old `regenerator-runtime` (from 0.10.5 to 0.13.7).
282
+ - If lockdown's `errorTrapping: 'report'` mode is selected (possibly via the
283
+ `'platform'`, or `'exit'` or `'abort'` modes), uncaught exceptions will be
284
+ written to standard error with the new `SES_UNCAUGHT_EXCEPTION:` prefix.
285
+ This is intended to give valuable context to users of the system, especially
286
+ when an uncaught exception is not an `Error` object, and therefore its origin
287
+ may be hard to find in source code.
288
+
289
+ This is not likely to affect most systems built with SES, as stderr is
290
+ generally reserved for user-only messages. If your SES system sends its
291
+ stderr to a program which parses it, you may need to adapt that program to be
292
+ tolerant of the `SES_UNCAUGHT_EXCEPTION:` prefix. Even for such programs, it
293
+ is unlikely they are that sensitive to stderr formatting.
294
+
295
+ ## [1.7.0](https://github.com/endojs/endo/compare/ses@1.6.0...ses@1.7.0) (2024-08-01)
296
+
297
+ ### Features
298
+
299
+ - **ses:** call lockdown before bundling SES shim ([#2337](https://github.com/endojs/endo/issues/2337)) ([8c01dd4](https://github.com/endojs/endo/commit/8c01dd4dd796d6fc492784d3a993d091fd3cd595))
300
+
301
+ ## [1.6.0](https://github.com/endojs/endo/compare/ses@1.5.0...ses@1.6.0) (2024-07-30)
302
+
303
+ - _NOTICE_: This version introduces multiple features to converge upon a
304
+ more common standard for [Hardened JavaScript](https://hardenedjs.org).
305
+ All code should begin migrating to these usage patterns as the older
306
+ patterns are now deprecated and will not be supported in a future major
307
+ version of SES.
308
+
309
+ - To converge on a portable pattern for using `Compartment`, introduces an
310
+ `__options__` property for the first argument of the `Compartment`
311
+ constructor that must be `true` if present and indicates the object is the
312
+ options bag and not the global endowments. All code going forward should
313
+ include this flag until the next major version of SES, when we plan for it to
314
+ become vesgitial and drop support for three-argument `Compartment`
315
+ construction.
316
+
317
+ In the unlikely event that existing code names an endowment `__options__`,
318
+ that code will break and need to be adjusted to adopt this version.
319
+ Because we rate this unlikely, we have elected not to mark this with
320
+ a major version bump.
321
+
322
+ - Adds a `__noNamespaceBox__` option that aligns the behavior of the `import`
323
+ method on SES `Compartment` with the behavior of XS and the behavior we will
324
+ champion for compartment standards.
325
+ All use of `Compartment` should migrate to use this option as the standard
326
+ behavior will be enabled by default with the next major version of SES.
327
+
328
+ - Adds support for module descriptors better aligned with XS.
329
+ Compartments use module desriptors to load and link modules.
330
+ The importHook, importNowHook, and moduleMapHook all return module descriptors
331
+ (sometimes promises for module descriptors).
332
+ The modules option or argument to the Compatment constructor has module
333
+ descriptors for all its values.
334
+ - `{record, specifier, compartment}` should become `{source: record,
335
+ specifier, compartment}`.
336
+ - `{specifier, compartment}` should become `{source: specifier,
337
+ compartment}`.
338
+ - `{record: compartment.module(specifier)}` should become `{namespace:
339
+ specifier, compartment}`.
340
+
341
+ - When running transpiled code on Node, the SES error taming
342
+ gives line-numbers into the generated JavaScript, which often don't match the
343
+ the original lines. This happens even with the normal development-time
344
+ lockdown options setting,
345
+
346
+ ```js
347
+ errorTaming: 'unsafe';
348
+ ```
349
+
350
+ or setting the environment variable
351
+
352
+ ```sh
353
+ export LOCKDOWN_ERROR_TAMING=unsafe
354
+ ```
355
+
356
+ To get the original line numbers, this release
357
+ adds `'unsafe-debug'`. This `errorTaming: 'unsafe-debug'` setting
358
+ should be used **_during development only_** when you can
359
+ sacrifice more security for a better debugging experience, as explained at
360
+ [`errorTaming` Options](https://github.com/endojs/endo/blob/master/packages/ses/docs/lockdown.md#errortaming-options).
361
+ With this setting, when running transpiled code on Node (e.g. tests written
362
+ in TypeScript),
363
+ the stacktrace line-numbers point back into the original
364
+ source, as they do on Node without SES.
365
+
366
+ ## [1.5.0](https://github.com/endojs/endo/compare/ses@1.4.1...ses@1.5.0) (2024-05-07)
367
+
368
+ - Adds `importNowHook` to the `Compartment` options. The compartment will invoke the hook whenever it encounters a missing dependency while running `compartmentInstance.importNow(specifier)`, which cannot use an asynchronous `importHook`.
369
+ - To support TypeScript v5.5, a CommonJS-specific type declaration file is now explicitly exported.
370
+
371
+ ## [1.4.1](https://github.com/endojs/endo/compare/ses@1.4.0...ses@1.4.1) (2024-04-04)
372
+
373
+ **Note:** Version bump only for package ses
374
+
375
+ ## [1.4.0](https://github.com/endojs/endo/compare/ses@1.3.0...ses@1.4.0) (2024-03-20)
376
+
377
+ ### Features
378
+
379
+ - **ses-ava:** import test from @endo/ses-ava/prepare-endo.js ([#2133](https://github.com/endojs/endo/issues/2133)) ([9d3a7ce](https://github.com/endojs/endo/commit/9d3a7ce150b6fd6fe7c8c4cc43da411e981731ac))
380
+ - **ses:** tolerate omitted species ([#2108](https://github.com/endojs/endo/issues/2108)) ([70c85ef](https://github.com/endojs/endo/commit/70c85ef3796acb579af8651e210f172ee200c364))
381
+
382
+ ## [1.3.0](https://github.com/endojs/endo/compare/ses@1.2.0...ses@1.3.0) (2024-02-23)
383
+
384
+ - Now supports `Promise.any`, `AggegateError`, `error.errors`,
385
+ and `error.cause`.
386
+ - Assertion functions/methods that were parameterized by an error constructor
387
+ (`makeError`, `assert`, `assert.fail`, `assert.equal`) now also accept named
388
+ options `cause` and `errors` in their immediately succeeding
389
+ `options` argument.
390
+ - For all those, the error constructor can now be an `AggregateError`.
391
+ If they do make an error instance, they encapsulate the
392
+ non-uniformity of the `AggregateError` construction arguments, allowing
393
+ all the error constructors to be used polymorphically
394
+ (generic / interchangeable).
395
+ - Adds a `GenericErrorConstructor` type to be effectively the common supertype
396
+ of `ErrorConstructor` and `AggregateErrorConstructor`, for typing these
397
+ error constructor parameters that handle the error constructor
398
+ polymorphically.
399
+ - The SES `console` now includes `error.cause` and `error.errors` in
400
+ its diagnostic output for errors.
401
+
402
+ ## [1.2.0](https://github.com/endojs/endo/compare/ses@1.1.0...ses@1.2.0) (2024-02-15)
403
+
404
+ - Exports `ses/lockdown-shim.js`, `ses/compartment-shim.js`, and
405
+ `ses/assert-shim.js` for piecemeal usage.
406
+ This change is motivated by the need to omit `ses/assert-shim.js` in Test262
407
+ environments.
408
+
409
+ ## [1.1.0](https://github.com/endojs/endo/compare/ses@1.0.1...ses@1.1.0) (2024-01-18)
410
+
411
+ - The [iterators-helpers](https://github.com/tc39/proposal-iterator-helpers)
412
+ proposal includes two accessor properties whose purpose is to emulate
413
+ a data property, but without the override mistake problem. The ses-shim
414
+ creates many such properties, but was unprepared for them to already be
415
+ present in the JS platform it starts with. Chrome Canary and Node 22
416
+ both implement the iterators-helper proposal, triggering this bug, preventing
417
+ the ses-shim from initializing. The ses-shim
418
+ [now copes safely](https://github.com/endojs/endo/pull/1969) with an
419
+ enumerated set of such properties, starting with these two properties from
420
+ the iterators-helpers proposal.
421
+ - The ses-shim now permits the new methods from the
422
+ [set-methods](https://github.com/tc39/proposal-set-methods) proposal,
423
+ enabling these methods to be used on platforms where they are implemented,
424
+ which are currently a Chrome Canary and a Node 22.
425
+
426
+ ## [1.0.1](https://github.com/endojs/endo/compare/ses@1.0.0...ses@1.0.1) (2023-12-20)
427
+
428
+ **Note:** Version bump only for package ses
429
+
430
+ ## [1.0.0](https://github.com/endojs/endo/compare/ses@0.18.8...ses@1.0.0) (2023-12-12)
431
+
432
+ ### Features
433
+
434
+ - **ses:** add SES version ([db17743](https://github.com/endojs/endo/commit/db17743885e7a221eaf3f6cf5e811a1a1d97788f))
435
+ - **ses:** Freeze evaluators, Compartment constructor and Symbol ([1016375](https://github.com/endojs/endo/commit/1016375f86082e927e7906f11046bb53d9025d68))
436
+
437
+ ### Bug Fixes
438
+
439
+ - enable compatibility with node16/nodenext module resolution ([9063c47](https://github.com/endojs/endo/commit/9063c47a2016a8ed3ae371646c7b81e47006a091))
440
+ - **ses:** Fake a good-enough console ([a2fd851](https://github.com/endojs/endo/commit/a2fd85145b6c0e316b2205090ba49b60974d10e0)), closes [#1819](https://github.com/endojs/endo/issues/1819)
441
+ - **ses:** fix ThirdPartyStaticModuleInterface type ([fe38c40](https://github.com/endojs/endo/commit/fe38c4095c059ed9550aa682a0de5ab958d3522e))
442
+ - **ses:** fix types export for newer module resolutions ([9cc3dd5](https://github.com/endojs/endo/commit/9cc3dd5551be369d854d5a4c3724b96dc8cc6691)), closes [#1803](https://github.com/endojs/endo/issues/1803)
443
+ - **ses:** refactor import assert {type: json} to fs ([d5741a4](https://github.com/endojs/endo/commit/d5741a44450bb31150cf90e9a0d12eecc836503a))
444
+ - **ses:** Support absence of console ([fece445](https://github.com/endojs/endo/commit/fece445f0191e41c1324d26d83d830dfa8822400)), closes [#1819](https://github.com/endojs/endo/issues/1819)
445
+
446
+ ## [0.18.8](https://github.com/endojs/endo/compare/ses@0.18.7...ses@0.18.8) (2023-09-12)
447
+
448
+ - Extracts `repairIntrinsics(options)` and `hardenIntrinsics()` from the
449
+ behavior of `lockdown(options)` so vetted shims can run between these
450
+ calls.
451
+ Any modifications to shared intrinsics survive if applied after
452
+ `repairIntrinsics()`.
453
+ - In the SES-shim implementation of HardenedJS, all constructed compartments
454
+ get the same safe `Date` constructor, that does not provide the ability to
455
+ measure duration.
456
+ It used to do this by having `Date.now()` return `NaN`, and to have calls on
457
+ the constructor that would normally have returned an indication of the
458
+ current date, instead return the corresponding invalid date indication.
459
+ Now, all of these throw a `TypeError` whose message begins with `'secure
460
+ mode'`.
461
+ This aligns with the XS implementation of HardenedJS.
462
+ - Similarly, In the SES-shim implementation of HardenedJS, all constructed
463
+ compartments get the same safe `Math` namespace object that does not provide
464
+ a working `random()` function.
465
+ It used to do that by omitting the `random` property from the safe `Math`
466
+ namespace object.
467
+ Now, the safe shared `Math` namespace object has a `Math.random()` function
468
+ that throws a `TypeError whose message begins with`'secure mode'`.
469
+ This again aligns with the XS implementation of HardenedJS.
470
+
471
+ ## [0.18.7](https://github.com/endojs/endo/compare/ses@0.18.5...ses@0.18.7) (2023-08-07)
472
+
473
+ ### Bug Fixes
474
+
475
+ - **fix:** Censor spread import ([fc90c64](https://github.com/endojs/endo/commit/fc90c6429604dc79ce8e3355e236ccce2bada041))
476
+ - **ses:** add more missing permits ([222f8f1](https://github.com/endojs/endo/commit/222f8f1ee9f579de9e325a2807663fc3931efa9a))
477
+ - **ses:** normalize bestEffortsStringify property order ([137daff](https://github.com/endojs/endo/commit/137dafff089b7ff5bea74a398caa238f4d313f5e))
478
+
479
+ ## [0.18.6](https://github.com/endojs/endo/compare/ses@0.18.5...ses@0.18.6) (2023-08-07)
480
+
481
+ - Censors the pattern `{...import(specifier)}`.
482
+ We previously censored `import(specifier)` and expressly allowed
483
+ `object.import(specifier)`.
484
+ The relaxation for the latter form in version 0.13.0 inadvertently allowed
485
+ import with the spread operator.
486
+
487
+ ## [0.18.5](https://github.com/endojs/endo/compare/ses@0.18.4...ses@0.18.5) (2023-07-19)
488
+
489
+ - Adds `assert.bare` for embedding unquoted strings in details.
490
+ - Permits new `dispose` symbols, other recent additions to JavaScript, and for
491
+ the anticipated iterator helpers.
492
+ - Tames `Symbol` so symbols can be preserved in the start compartment and
493
+ denied to shared compartments.
494
+ - Improves debugging in Safari.
495
+ - Adds missing native function markers.
496
+ All native functions should have a `toString` that says `[native code]`, even
497
+ if emulated.
498
+
499
+ ## [0.18.4](https://github.com/endojs/endo/compare/ses@0.18.3...ses@0.18.4) (2023-04-20)
500
+
501
+ - Pass through the start compartment's `globalThis.harden` if defined.
502
+
503
+ ## [0.18.3](https://github.com/endojs/endo/compare/ses@0.18.2...ses@0.18.3) (2023-04-14)
504
+
505
+ - New `__hardenTaming__: 'unsafe'` lockdown option to fake harden unsafely,
506
+ which can be used to improve performance for applications that are known to be
507
+ safe even with a no-op `harden`.
508
+ - Finite deep stacks, using LRU budgets for depth of stacks an well as the
509
+ maximum number of weakly-held errors to annotate.
510
+ - Add `%AsyncGenerator%.length` and `%AsyncFunctionPrototype%.length` `number`
511
+ properties to allowlist.
512
+
513
+ ## [0.18.2](https://github.com/endojs/endo/compare/ses@0.18.1...ses@0.18.2) (2023-03-07)
514
+
515
+ - Introduces the `__syncModuleFunctor__` property of static module record
516
+ to replace evauluation of `__syncModuleProgram__` for environments without eval.
517
+
518
+ ## [0.18.1](https://github.com/endojs/endo/compare/ses@0.18.0...ses@0.18.1) (2022-12-23)
519
+
520
+ - Fixes a bug for SES initialization in a no-unsafe-eval
521
+ Content-Security-Policy.
522
+ - Fixes a bug where reexport of multiple named exports of the same name was
523
+ causing them to be overridden by the last value. Now named exports are
524
+ handled in the same manner as `export *`.
525
+ - Allows Compatment `importHook` implementations to return aliases: module
526
+ descriptors that refer to a module by its specifier in the same or a
527
+ specified compartment, without providing a static module record (module
528
+ source).
529
+
530
+ ## [0.18.0](https://github.com/endojs/endo/compare/ses@0.17.0...ses@0.18.0) (2022-11-14)
531
+
532
+ - _BREAKING_: Removes support for `globalLexicals`.
533
+ To our knowledge, there are no production uses for `globalLexicals`.
534
+ They currently could leak because `moduleLexicals` and `globalLexicals`
535
+ used the same scope object, so properties of one would leak to the other
536
+ with crafted modules.
537
+ We had an opportunity to plug the leak at the cost of a fifth scope
538
+ in all evaluators, but elected to remove the unnecessary complexity instead.
539
+
540
+ ## [0.17.0](https://github.com/endojs/endo/compare/ses@0.16.0...ses@0.17.0) (2022-10-24)
541
+
542
+ - Previous versions of SES would leak the proxy used to isolate evaluated
543
+ code to functions added to the global object by guest code.
544
+ The value of `this` in such functions should be `undefined`, but that is not
545
+ possible to emulate in this shim.
546
+ This version changes the value of `this` in such functions to be the same as
547
+ `globalThis` of the compartment, as would be correct in sloppy mode.
548
+ - Removes experimental support for "known scope proxies".
549
+
550
+ ## [0.16.0](https://github.com/endojs/endo/compare/ses@0.15.23...ses@0.16.0) (2022-10-19)
551
+
552
+ - When hardening a typed array, detects and locks down properties named as
553
+ number-coercible strings that are not index properties.
554
+
555
+ ## [0.15.23](https://github.com/endojs/endo/compare/ses@0.15.22...ses@0.15.23) (2022-09-27)
556
+
557
+ - Fixes the unhandled promise rejection logic to report unhandled rejections
558
+ when the promise is collected. Because of a bug it previously only reported
559
+ at process exit.
560
+ - Improves the fidelity of emulation for V8 `Error.prepareStackTrace`,
561
+ allowing more legacy code to work by default in isolation.
562
+
563
+ ## [0.15.22](https://github.com/endojs/endo/compare/ses@0.15.21...ses@0.15.22) (2022-09-14)
564
+
565
+ ### Bug Fixes
566
+
567
+ - alt syntax for positive but faster assertions ([#1280](https://github.com/endojs/endo/issues/1280)) ([dc24f2f](https://github.com/endojs/endo/commit/dc24f2f2c3cac7ce239a64c503493c41a2334315))
568
+
569
+ ## [0.15.21](https://github.com/endojs/endo/compare/ses@0.15.20...ses@0.15.21) (2022-08-26)
570
+
571
+ **Note:** Version bump only for package ses
572
+
573
+ ## [0.15.20](https://github.com/endojs/endo/compare/ses@0.15.19...ses@0.15.20) (2022-08-26)
574
+
575
+ **Note:** Version bump only for package ses
576
+
577
+ ## [0.15.19](https://github.com/endojs/endo/compare/ses@0.15.18...ses@0.15.19) (2022-08-25)
578
+
579
+ **Note:** Version bump only for package ses
580
+
581
+ ## [0.15.18](https://github.com/endojs/endo/compare/ses@0.15.17...ses@0.15.18) (2022-08-23)
582
+
583
+ - Removes the `__allowUnsafeMonkeyPatching__` option to lockdown. As the name
584
+ should indicate, this was always an unsafe temporary kludge. Its only known
585
+ use was in agoric-sdk, now gone at
586
+ <https://github.com/Agoric/agoric-sdk/pull/5922> . Without this option, a
587
+ successful `lockdown` will now always harden the primordials.
588
+
589
+ ## [0.15.17](https://github.com/endojs/endo/compare/ses@0.15.16...ses@0.15.17) (2022-06-28)
590
+
591
+ ### Features
592
+
593
+ - **compartment-mapper:** implement passing values in import.meta.url ([d6294f6](https://github.com/endojs/endo/commit/d6294f6832f978eaa7af94fee4496d76bd35a927))
594
+ - add the foundations for support of import.meta ([36f6449](https://github.com/endojs/endo/commit/36f644998c21f6333268707555b97938ff0fff08))
595
+ - call importMetaHook on instantiation if import.meta uttered by module ([23e8c40](https://github.com/endojs/endo/commit/23e8c405e0be823c728f8af1a6db9607e21f2f74))
596
+
597
+ ### Bug Fixes
598
+
599
+ - rename meta to importMeta, fix detection to detect import.meta not import.meta.something ([c61a862](https://github.com/endojs/endo/commit/c61a862c9f4354f0e6d86d8c8efaa826840a6efd))
600
+ - tolerate empty func.prototype ([#1221](https://github.com/endojs/endo/issues/1221)) ([4da7742](https://github.com/endojs/endo/commit/4da7742e8017d07094ed9b9336a85b6a4d3ee7b6))
601
+
602
+ ## [0.15.16](https://github.com/endojs/endo/compare/ses@0.15.15...ses@0.15.16) (2022-06-11)
603
+
604
+ ### Features
605
+
606
+ - **console-taming:** `unhandledRejectionTrapping` after finalized ([7dccecf](https://github.com/endojs/endo/commit/7dccecfc1766b5287eeb0ebe958d1e1715cb63a4))
607
+ - **ses:** add to commons ([9dc2de8](https://github.com/endojs/endo/commit/9dc2de812755a3c2ba6f73764f8ee7f43dd6f717))
608
+
609
+ ### Bug Fixes
610
+
611
+ - **console:** close over severity for error note callbacks ([59910b2](https://github.com/endojs/endo/commit/59910b2a0ac146162c5191a3b315421b92ac5d77))
612
+ - **console:** direct error output to the current severity ([f5d460d](https://github.com/endojs/endo/commit/f5d460d1cc1828100ce0ad237cb0f6bfd0a8e45c))
613
+ - **ses:** Fix compartment with name from object with toString ([405c00b](https://github.com/endojs/endo/commit/405c00b3cc8f663ef73ef4275ba1776913dc26e7))
614
+ - **static-module-record:** Make types consistent with implementation ([#1184](https://github.com/endojs/endo/issues/1184)) ([5b7e3a6](https://github.com/endojs/endo/commit/5b7e3a6d006a686520c4ffeedea5428a720f7e7d))
615
+ - all errors have stacks, even if empty ([#1171](https://github.com/endojs/endo/issues/1171)) ([25b7d86](https://github.com/endojs/endo/commit/25b7d86240a5fc2772343664e5a42d1400d363d9))
616
+ - make `*Trapping` orthogonal to `consoleTaming` ([8c5e12e](https://github.com/endojs/endo/commit/8c5e12e96f8c71d0c52e2d17786558e88585e04b))
617
+ - repair deviations from local convention ([#1183](https://github.com/endojs/endo/issues/1183)) ([13614f5](https://github.com/endojs/endo/commit/13614f56872ac976e3440f8bcce706200ffe9822))
618
+
619
+ ## [0.15.15](https://github.com/endojs/endo/compare/ses@0.15.14...ses@0.15.15) (2022-04-15)
620
+
621
+ **Note:** Version bump only for package ses
622
+
623
+ ## [0.15.14](https://github.com/endojs/endo/compare/ses@0.15.13...ses@0.15.14) (2022-04-14)
624
+
625
+ **Note:** Version bump only for package ses
626
+
627
+ ## [0.15.13](https://github.com/endojs/endo/compare/ses@0.15.12...ses@0.15.13) (2022-04-13)
628
+
629
+ ### Bug Fixes
630
+
631
+ - Revert dud release ([c8a7101](https://github.com/endojs/endo/commit/c8a71017d8d7af10a97909c9da9c5c7e59aed939))
632
+ - **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)
633
+
634
+ ## [0.15.12](https://github.com/endojs/endo/compare/ses@0.15.11...ses@0.15.12) (2022-04-12)
635
+
636
+ ### Features
637
+
638
+ - 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))
639
+ - **compartment-mapper:** proper default export implementation for cjs with import and require compatibility ([30cbaa8](https://github.com/endojs/endo/commit/30cbaa8cb79b906742a9f5c1854b22fe506b0575))
640
+ - **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))
641
+
642
+ ### Bug Fixes
643
+
644
+ - **ses:** avoid cache corruption when execute() throws ([1d9c17b](https://github.com/endojs/endo/commit/1d9c17b4c4a5ed1450cddd996bd948dd59c80bf6))
645
+ - some tests sensitive to errorTaming ([#1135](https://github.com/endojs/endo/issues/1135)) ([0c22364](https://github.com/endojs/endo/commit/0c22364104fb8b2528cd5437accda09a045a6ff0))
646
+ - **endo:** Ensure conditions include default, import, and endo ([1361abd](https://github.com/endojs/endo/commit/1361abd8c732596d192ecef6a039eda98b4ee563))
647
+ - **ses:** Do not bundle modules for use as modules ([7d27020](https://github.com/endojs/endo/commit/7d2702037295211d8d3f08431a4d4de0a4e3ffd7))
648
+ - **ses:** Do not get confused by well-known look-alikes ([5139dad](https://github.com/endojs/endo/commit/5139dad7719d7a32360e2daf8a37b9ab3f2cd94a))
649
+ - **ses:** Ignore Array unscopable findLast{,Index} ([#1129](https://github.com/endojs/endo/issues/1129)) ([bbf7e7d](https://github.com/endojs/endo/commit/bbf7e7dd0ba19349120d4913016c62b9f8dc4995))
650
+ - **ses:** make import \* and default from cjs wire up correctly ([33cbd27](https://github.com/endojs/endo/commit/33cbd2776f9d47e6e8438650565155e4185d9373))
651
+
652
+ ## [0.15.11](https://github.com/endojs/endo/compare/ses@0.15.10...ses@0.15.11) (2022-03-07)
653
+
654
+ **Note:** Version bump only for package ses
655
+
656
+ ## [0.15.10](https://github.com/endojs/endo/compare/ses@0.15.9...ses@0.15.10) (2022-03-02)
657
+
658
+ ### Features
659
+
660
+ - add evalTaming option ([#961](https://github.com/endojs/endo/issues/961)) ([735ff94](https://github.com/endojs/endo/commit/735ff94bf3513613e64aaca03116f289d07aa366))
661
+
662
+ ## [0.15.9](https://github.com/endojs/endo/compare/ses@0.15.8...ses@0.15.9) (2022-02-20)
663
+
664
+ **Note:** Version bump only for package ses
665
+
666
+ ## [0.15.8](https://github.com/endojs/endo/compare/ses@0.15.7...ses@0.15.8) (2022-02-18)
667
+
668
+ - Harden now gives special treatment to typed arrays.
669
+ Instead of freezing a typed array, harden will seal it and make all of its
670
+ non-integer properties non-writable.
671
+ All of their integer properties will remain writable and non-configurable.
672
+ TypedArrays are exceedingly unusual because their integer properties are
673
+ writable and neither freeze nor defineProperty can convert them from writable
674
+ to non-writable.
675
+
676
+ ## [0.15.7](https://github.com/endojs/endo/compare/ses@0.15.6...ses@0.15.7) (2022-01-31)
677
+
678
+ ### Bug Fixes
679
+
680
+ - **ses:** Globals have vars, not consts ([#1027](https://github.com/endojs/endo/issues/1027)) ([157669f](https://github.com/endojs/endo/commit/157669f0b669332f703747e36dd867bf6a823e59))
681
+
682
+ ## [0.15.6](https://github.com/endojs/endo/compare/ses@0.15.5...ses@0.15.6) (2022-01-27)
683
+
684
+ **Note:** Version bump only for package ses
685
+
686
+ ## [0.15.5](https://github.com/endojs/endo/compare/ses@0.15.4...ses@0.15.5) (2022-01-25)
687
+
688
+ **Note:** Version bump only for package ses
689
+
690
+ ## [0.15.4](https://github.com/endojs/endo/compare/ses@0.15.3...ses@0.15.4) (2022-01-23)
691
+
692
+ ### Features
693
+
694
+ - **ses:** Check early for dynamic evalability ([d0f6f09](https://github.com/endojs/endo/commit/d0f6f099d41edee3f484da5d5094848f72f93084)), closes [#343](https://github.com/endojs/endo/issues/343)
695
+
696
+ ### Bug Fixes
697
+
698
+ - **ses:** Direct eval check should not preclude no-eval under CSP ([#1004](https://github.com/endojs/endo/issues/1004)) ([fc8f9ee](https://github.com/endojs/endo/commit/fc8f9eee5ec703ebc611bc015b94fc8ecb721324))
699
+ - **ses:** Fix mistaken this binding example ([#990](https://github.com/endojs/endo/issues/990)) ([71db876](https://github.com/endojs/endo/commit/71db876ee3d7557f0f19dd995a4e027cc7945c2b))
700
+ - minor wording ([#989](https://github.com/endojs/endo/issues/989)) ([f8d6ff6](https://github.com/endojs/endo/commit/f8d6ff6c63b0c46bcaf93378b61d7286d971fd5f))
701
+ - **ses:** Add assert.error options bag to type definition ([#978](https://github.com/endojs/endo/issues/978)) ([ca42997](https://github.com/endojs/endo/commit/ca4299714d5769ea15418612f679abb400ff7e25)), closes [#977](https://github.com/endojs/endo/issues/977)
702
+ - **ses:** Number.prototype.toLocaleString radix confusion ([#975](https://github.com/endojs/endo/issues/975)) ([6a17595](https://github.com/endojs/endo/commit/6a175953e5c78d2575c2e9e4e72e6b893bcdb631)), closes [#852](https://github.com/endojs/endo/issues/852)
703
+ - **ses:** Remove superfluous error cause on prototypes ([#955](https://github.com/endojs/endo/issues/955)) ([6e50c45](https://github.com/endojs/endo/commit/6e50c4526f457b31e00a783406d175b0088907eb))
704
+
705
+ ## [0.15.3](https://github.com/endojs/endo/compare/ses@0.15.2...ses@0.15.3) (2021-12-14)
706
+
707
+ - Fixes the type definition for assert.error so that the final options bag,
708
+ which may include `errorName`, checks correctly in TypeScript.
709
+ - Lockdown will now throw an error if code running before SES initialization
710
+ replaced `eval`.
711
+
712
+ ## [0.15.2](https://github.com/endojs/endo/compare/ses@0.15.1...ses@0.15.2) (2021-12-08)
713
+
714
+ - The `Removing...` messages that Lockdown emits when encountering unrecognized
715
+ properties on shared intrinsics are now logged as "warnings".
716
+ This has the material benefit of sending these messages to STDERR on Node.js.
717
+ - Updates permits for all current TC39 stage 3 and 4 proposals, notably
718
+ suppressing the `Removing...` messages for `Object.hasOwn`; `findLast` and
719
+ `findLastIndex` on both `Array.prototype` and `TypedArray.prototype`; and the
720
+ properties `transfer`, `resize`, `resizable`, and `maxByteLength` of
721
+ `ArrayBuffer.prototype`.
722
+
723
+ ## [0.15.1](https://github.com/endojs/endo/compare/ses@0.15.0...ses@0.15.1) (2021-11-16)
724
+
725
+ - The TypeScript definition of `lockdown` now allows for the option
726
+ `"errorTrapping": "none"`.
727
+ - Fixes error trapping on the web, showing both the message (and stack) of any
728
+ error that throws out of the top of an event.
729
+
730
+ ## [0.15.0](https://github.com/endojs/endo/compare/ses@0.14.4...ses@0.15.0) (2021-11-02)
731
+
732
+ - _BREAKING CHANGE_: The lockdown option `domainTaming` is now `safe` by
733
+ default, which will break any application that depends transtively on the
734
+ Node.js `domain` module.
735
+ Notably, [standard-things/esm](https://github.com/standard-things/esm)
736
+ uses domains and so SES will not support `node -r esm` going forward.
737
+
738
+ This protects against the unhardened `domain` property appearing on shared
739
+ objects like callbacks and promises.
740
+ This overcomes the last _known_ obstacle toward object capability containment.
741
+
742
+ - Lockdown will now read options from the environment as defined by the Node.js
743
+ `process.env` parameter space.
744
+ - _BREAKING CHANGE_: Lockdown may no longer be called more than once.
745
+ Lockdown no longer returns a boolean to indicate whether it was effective
746
+ (true) or redundant (false). Instead, Lockdown will return undefined for
747
+ its first invocation or throw an error otherwise.
748
+
749
+ ## [0.14.4](https://github.com/endojs/endo/compare/ses@0.14.3...ses@0.14.4) (2021-10-15)
750
+
751
+ - Fixes a defect in the per-compartment `Function` and `eval` functions, such
752
+ that these environments did not have the compartment's `globalLexicals`.
753
+ There is no known environment depending on this invariant for security
754
+ reasons, but such a scenario would be a program arranging a translator that
755
+ introduces run-time security checks, like metering, that depend on the
756
+ existence of a named global lexical.
757
+ [#898](https://github.com/endojs/endo/issues/898)
758
+ - The above fix incidentally improved the performance of compartment evaluation
759
+ for cases that do not require special global lexicals, by sharing a single
760
+ per-compartment evaluator.
761
+
762
+ ## [0.14.3](https://github.com/endojs/endo/compare/ses@0.14.2...ses@0.14.3) (2021-09-18)
763
+
764
+ - Due to a peculiar bit of error handling code in Node 14, as explained at
765
+ [Hardened JavaScript interferes with Node.js 14 Error
766
+ construction](https://github.com/endojs/endo/issues/868),
767
+ we have added more overrides to the default `overrideTaming: 'moderate'`
768
+ setting. At this setting, assigning to the `name` property of a mutable error
769
+ instance should work. It will continue not to work at the `'min'` setting, so
770
+ use the default `'moderate'` setting if you need to.
771
+ - Adds a lockdown option `domainTaming` to detect whether Node.js domains have
772
+ been initialized and prevents them from being initialized afterward.
773
+ Domains otherwise presented a hazard to the integrity of SES containment on
774
+ Node.js.
775
+ The option defaults to `"unsafe"` in this version and will be switched to
776
+ `"safe"` by default in the next release that allows for breaking-changes, to
777
+ afford a gradual migration.
778
+ Thank you to @dominictarr with [Least Authority](https://leastauthority.com/)
779
+ for devising this feature.
780
+ - Fixes reflexive module imports. Previously, SES would fail to initialize a
781
+ module graph where a module imported an alias to itself.
782
+
783
+ ## [0.14.2](https://github.com/endojs/endo/compare/ses@0.14.1...ses@0.14.2) (2021-08-14)
784
+
785
+ **Note:** Version bump only for package ses
786
+
787
+ ## [0.14.1](https://github.com/endojs/endo/compare/ses@0.14.0...ses@0.14.1) (2021-08-13)
788
+
789
+ - Adds permits for `Array.prototype.at` and `String.prototype.at` which are
790
+ Stage 3 proposals for ECMA 262.
791
+
792
+ ## [0.14.0](https://github.com/endojs/endo/compare/ses@0.13.4...ses@0.14.0) (2021-07-22)
793
+
794
+ - _BREAKING_: Any precompiled static module records from prior versions
795
+ will not load in this version of SES or beyond. The format of the preamble
796
+ has been changed to admit the possibility of a variable named `Map` declared
797
+ in the scope of a module.
798
+ - Fixes the type assertions for `assert` and `assert.string`.
799
+ - Reveals `harden` only after `lockdown`. Harden was never usable before
800
+ lockdown because it would render the environment irreparable.
801
+ Calling `harden` before `lockdown` previously threw an exception.
802
+ Now it is possible to write libraries that are usable both in JS and SES,
803
+ which can know whether to harden their API by the presence of harden in
804
+ global scope.
805
+ - Adds `errorTrapping` lockdown option and by default traps uncaught exceptions
806
+ and logs them back with their original stack traces.
807
+ These would previously appear as mysterios `{}` lines in Node.js.
808
+
809
+ ## [0.13.4](https://github.com/endojs/endo/compare/ses@0.13.3...ses@0.13.4) (2021-06-20)
810
+
811
+ - Adds more TypeScript definitions, importable with `/// <reference types="ses"/>`, covering `harden`, `lockdown`, `assert`, and `Compartment`,
812
+ and many types importable with `import('ses')` notation.
813
+ - Adds descriptive detail to module system link error messages and fixes the
814
+ reported exports for one.
815
+
816
+ ## [0.13.3](https://github.com/endojs/endo/compare/ses@0.13.2...ses@0.13.3) (2021-06-16)
817
+
818
+ ### Features
819
+
820
+ - **ses:** Improve link errors ([71a509c](https://github.com/endojs/endo/commit/71a509cd67305b5af60d66f0b2b600ed0df8b632))
821
+
822
+ ## [0.13.2](https://github.com/endojs/endo/compare/ses@0.13.1...ses@0.13.2) (2021-06-14)
823
+
824
+ **Note:** Version bump only for package ses
825
+
826
+ ## [0.13.1](https://github.com/endojs/endo/compare/ses@0.13.0...ses@0.13.1) (2021-06-06)
827
+
828
+ - Fixes type exports for `harden`.
829
+ - Packaging fixes.
830
+
831
+ ## 0.13.0 (2021-06-02)
832
+
833
+ - _BREAKING CHANGE_ The `ses/lockdown` module is again just `ses`.
834
+ Instead of having a light 43KB `ses/lockdown` and a heavy 3.1MB `ses`, there
835
+ is just a 52KB `ses` that has everything except `StaticModuleRecord`.
836
+ For this release, there remains a `ses/lockdown` alias to `ses`.
837
+ - _BREAKING CHANGE_ Third-party static module interface implementations _must_
838
+ now explicitly list their exported names.
839
+ For CommonJS, this implies using a heuristic static analysis of `exports`
840
+ changes.
841
+ Consequently, third-party modules can now participate in linkage with ESM
842
+ including support for `export * from './spec.cjs'` and also named imports
843
+ like `import * from './spec.cjs'`.
844
+ - _BREAKING CHANGE_ The `StaticModuleRecord` constructor has been removed in
845
+ favor of a duck-type for compiled static module records that is intrinsic to
846
+ the shim and may be emulated by a third-party `StaticModuleRecord`
847
+ constructor.
848
+ The constructor must perform the module analysis and transform the source,
849
+ and present this duck-type to the Compartment `importHook`.
850
+ This relieves SES of a dependency on Babel and simplifies its API.
851
+ - _BREAKING CHANGE_ The UMD distribution of SES must have the UTF-8 charset.
852
+ The prior versions were accidentally ASCII, so SES would have worked
853
+ in any web page, regardless of the charset.
854
+ To remedy this, be sure to include `<head><meta charset="utf-8"></head>` in
855
+ the containing page (a general best-practice for web pages) or specifically
856
+ use `<script charset="utf-8" src="ses.umd.min.js">` to address the single
857
+ file.
858
+ - Relaxes the censorship of `import` and `eval` in programs evaluated
859
+ under SES to specifically allow the use of `something.import()` or
860
+ `something.eval()` methods.
861
+ - Fix: `new Compartment(null, null, options)` no longer throws.
862
+ - New lockdown option: `overrideDebug: [...props]` to detect where a property
863
+ assignment needs to be turned into a `defineProperty` to avoid the override
864
+ mistake. Most useful as `overrideTaming: 'severe', overrideDebug: ['constructor']`.
865
+ - We reopened Safari bug
866
+ [Object.defineProperties triggering a setter](https://bugs.webkit.org/show_bug.cgi?id=222538#c17)
867
+ when we found that it was causing an infinite recursion initializing SES
868
+ on Safari.
869
+ - We revised an error message to include the error tag of a new error
870
+ explanation page:
871
+ [SES_DEFINE_PROPERTY_FAILED_SILENTLY](error-codes/SES_DEFINE_PROPERTY_FAILED_SILENTLY.md).
872
+ We hope to add such explanations for more errors over time. Please let us
873
+ know as you encounter errors that strongly needs explaining.
874
+
875
+ ## 0.12.7 (2021-05-05)
876
+
877
+ - Added to `assert.error` an optional options bag with an option named
878
+ `errorName`. The `assert.error` function makes error objects with detailed
879
+ error messages whose unredacted contents appear only in `console` output
880
+ and are otherwise unobservable. If `errorName` is provided, then
881
+ it is also used in the console output instead of the normal error name,
882
+ but is otherwise unobservable. This will rarely be used, but will be
883
+ used by the `@agoric/marshal` package to name an unserialized error
884
+ so that it can be traced back to the site that serialized it; and
885
+ ultimately to its origin.
886
+
887
+ ## 0.12.6 (2021-03-27)
888
+
889
+ - Added a new temporary `__allowUnsafeMonkeyPatching__` option to `lockdown`.
890
+
891
+ Sometimes SES is used where SES's safety is not required. Some libraries
892
+ are not compatible with SES because they monkey patch the shared primordials
893
+ is ways SES cannot allow. We temporarily introduce this option to enable
894
+ some of these libraries to work in, approximately, a SES environment
895
+ whose safety was sacrificed in order to allow this monkey patching to
896
+ succeed. More at the
897
+ [\_\_allowUnsafeMonkeyPatching\_\_ Options](./lockdown-options.md#__allowUnsafeMonkeyPatching__-options)
898
+ section of [lockdown-options](./lockdown-options.md).
899
+
900
+ ## 0.12.5 (2021-03-25)
901
+
902
+ - The 0.12.4 release was broken by <https://github.com/endojs/endo/pull/552>
903
+ since fixed by <https://github.com/endojs/endo/pull/638>
904
+ - These merely remove a repair needed by an old v8 / Node version that
905
+ no one any longer supports.
906
+
907
+ ## 0.12.4 (2021-03-24)
908
+
909
+ - Expand TypeScript definitions to include Compartment, StaticModuleRecord,
910
+ StaticModuleType, RedirectStaticModuleInterface, FinalStaticModuleType,
911
+ ThirdPartyStaticModuleInterface, Transform, ImportHook, and ModuleMapHook.
912
+ - The previous took `Object.prototype.constructor` off of the default
913
+ [list of properties](src/enablements.js) we enable to be overridden by
914
+ assignment. This default is the `{overrideTaming: 'moderate'}` setting.
915
+ In this release, we stop enabling `'hasOwnProperty'` by default as
916
+ well. With both of these gone, we now have a reasonable debugging
917
+ experience.
918
+ - Unfortunately, both rollup and webpack seem to turn exported names
919
+ into assignments to an `exports` object that inherits from
920
+ `Object.prototype`, thereby potentially stepping on any name.
921
+ To deal with this perverse case, the release also provides an
922
+ `{overrideTaming: 'severe'}` option which enables all properties on
923
+ at least `Object.prototype`. This is more compatible but makes the
924
+ vscode debugger's inspector unusable. At
925
+ [Tracking issue for getting 3rd party packages more SES friendly (#576)](https://github.com/endojs/endo/issues/576)
926
+ we track the incompatibilities we encounter and progress toward
927
+ getting them fixed.
928
+ - Add utility function `Compartment.prototype.__isKnownScopeProxy__(value)` to
929
+ aid working around scopeProxy leakage. Returns true if `value` is one of the
930
+ scopeProxies created during calls to this Compartment instances's
931
+ `Compartment.prototype.evaluate`. See `test-compartment-known-scope-proxy.js`
932
+ for an example of performing a scopeProxy leak workaround.
933
+ - Under the default `{errorTaming: 'safe'}` setting, the SES shim already redacts stack traces from error instances when it can (currently: v8, spiderMonkey, XS). The setting `{errorTaming: 'unsafe'}` suppresses that redaction, instead blabbing these stack traces on error instances via the expected `errorInstance.stack`.
934
+
935
+ The purpose of the `details` template literal tag (often spelled `X`) together with the `quote` function (often spelled `q`) is to redact data from the error messages carried by error instances. With this release, the same `{errorTaming: 'unsafe'}` would suppress that redaction as well, so that all substitution values would act like they've been quoted. IOW, with this setting
936
+
937
+ ```js
938
+ assert(false, X`literal part ${secretData} with ${q(publicData)}.`);
939
+ ```
940
+
941
+ acts like
942
+
943
+ ```js
944
+ assert(false, X`literal part ${q(secretData)} with ${q(publicData)}.`);
945
+ ```
946
+
947
+ Note that the information rendered by the SES shim `console` object always includes all the unredacted data independent of the setting of `errorTaming`.
948
+
949
+ ## 0.12.3 (2021-03-01)
950
+
951
+ - The `assert.js` module in the `ses` package of this repository exports
952
+ a `makeAssert` function, to make other `assert` functions with a different
953
+ failure scope. Inadvertantly, this did not enable the `@agoric/assert`
954
+ package (currently defined in the agoric-sdk repository) to reexport
955
+ the same `makeAssert` function as originally intended, and now
956
+ [needed](https://github.com/Agoric/agoric-sdk/pull/2515).
957
+ As of this release the `assert` object exported by the `assert.js` module
958
+ now carries this function as a `makeAssert` property.
959
+ - The `assert.quote` function re-exported by `@agoric/assert` as `q`
960
+ has always done only a best effort stringify, intended only to
961
+ be interpreted by a human under benign conditions. Within that constraint
962
+ its best effort is now better, providing informative though ambiguous
963
+ renderings of values problematic for `JSON.stringify`, still including
964
+ cycles, but now also functions, promises, `undefined`, `NaN`, `Infinity`,
965
+ bigints, and symbols. To distinguish this from
966
+ strings in the input, these synthesized strings always begin and
967
+ end with square brackets. To distinguish those strings from an
968
+ input string with square brackets, an input string that starts
969
+ with an open square bracket `[` is itself placed in square brackets.
970
+ - The `q` function now has an optional second `spaces` parameter which is
971
+ passed through to the underlying `JSON.stringfiy`. Passing in a space or
972
+ two spaces makes the output much more readable using indentation and other
973
+ whitespace, but takes multiple lines.
974
+ - The SES enhanced `console` had previously only produced meaningful stack
975
+ traces on v8-based browsers such as Brave, Chromium, or Chrome. It now
976
+ works on Firefox and Safari as well. It should work on all major browsers
977
+ but have not yet been tested on others.
978
+ - On all platforms `Error.stackTrace` is now an assignable accessor property.
979
+ On v8-based platforms, for the `Error` constructor in the start compartment,
980
+ it has the same effect that it does outside SES. Outside the start
981
+ compartment, or outside v8-based platforms, the assignment succeeds silently
982
+ with no effect.
983
+ This accommodates a de facto standard idiom encouraged by Google.
984
+ - The "SES Demo Console" and "SES Challenge" have been fixed to work with
985
+ modern SES. Both now run in browsers, though these are not yet hosted
986
+ for visiting as an external web page.
987
+ - We no longer enable overriding `Object.prototype.constructor` by assigning
988
+ to the `constructor` property of a derived object. We were enabling it
989
+ due to a bug in acorn 7, since fixed in acorn 8. To enable it, we were
990
+ making `Object.prototype.constructor` into an accessor property, which
991
+ confused the Node debugger, causing annoying extra noise in the console
992
+ output. Now that we've worked around our acorn problem (currently with
993
+ a patch) we have stopped enabling this assignment, and so stopped
994
+ confusing the Node debugger.
995
+
996
+ ## 0.12.2 (2021-02-05)
997
+
998
+ - fix non-standard regex range syntax that throws on XS (3877d72)
999
+ - refine concise stack traces (cbbabeb)
1000
+
1001
+ ## 0.12.1 (2021-02-02)
1002
+
1003
+ - Consolidated documentation of [`lockdown` options](./lockdown-options.md) into its
1004
+ own page.
1005
+ - Added a `stackFiltering` option to `lockdown` with
1006
+ two settings, `'concise'` and `'verbose'`. Stack traces are now filtered
1007
+ `'concise'` by default, making them typically much easier to work with.
1008
+ `'verbose'` shows complete stack traces, as sometimes it contains clues
1009
+ needed to find your bug.
1010
+ See [`stackFiltering` options](./lockdown-options.md#stackfiltering-options)
1011
+ for an explanation.
1012
+ - Changed the meaning of the default `'moderate'` setting of the
1013
+ `overrideTaming` options of `lockdown`. See
1014
+ [`overrideTaming` options](./lockdown-options.md#overridetaming-options)
1015
+ for an explanation of when to use which.
1016
+
1017
+ :warning: This change of meaning of the `'moderate'` setting of the
1018
+ `overrideTaming` option of `lockdown` is not strictly compatible with its
1019
+ old meaning. The old `'moderate`' setting would enable all properties on a few
1020
+ widely used prototype objects, including `Object.prototype`. Resulting in a
1021
+ miserable debugging experience when using the VSCode debugger's object
1022
+ inspector.
1023
+
1024
+ <details>
1025
+ <summary>Expand to see the vscode inspector display if enabling all of Object.prototype</summary>
1026
+
1027
+ ![vscode inspector display if enabling all of Object.prototype](docs/images/override-taming-star-inspector.png)
1028
+
1029
+ </details>
1030
+
1031
+ The new `'moderate'` setting only tames those properties we know or expect to
1032
+ be problematic. If you run into an override mistake problem not addressed at
1033
+ the `'moderate'` setting **_please file an issue._**
1034
+
1035
+ <details>
1036
+ <summary>Expand for { overrideTaming: 'moderate' } vscode inspector display</summary>
1037
+
1038
+ ![overrideTaming: 'moderate' vscode inspector display](docs/images/override-taming-moderate-inspector.png)
1039
+
1040
+ </details>
1041
+
1042
+ For an even better debugging experience, try the `'min'` setting, which
1043
+ makes the debugging experience even less noisy, but may not be compatible with
1044
+ all the code you're running under SES.
1045
+
1046
+ <details>
1047
+ <summary>Expand for { overrideTaming: 'min' } vscode inspector display</summary>
1048
+
1049
+ ![overrideTaming: 'min' vscode inspector display](docs/images/override-taming-min-inspector.png)
1050
+
1051
+ </details>
1052
+
1053
+ ## 0.11.1 (2021-01-21)
1054
+
1055
+ - Upgrades `harden` such that that it transitively freezes an object's
1056
+ prototype chain, eliminating the notion of a "fringe set" and errors
1057
+ that were previously thrown if an object's prototype was not already
1058
+ in the fringe.
1059
+ - Added an `overrideTaming` option to `lockdown` with two settings,
1060
+ `'min'` and `'moderate'`. See
1061
+ [Enabling Override by Assignment](README.md#enabling-override-by-assignment)
1062
+ for an explanation of when to use which. **_(This documentation has moved
1063
+ to [`overrideTaming`
1064
+ options](./lockdown-options.md#overridetaming-options))_**
1065
+ - Modules and evaluated code that contains the censored substrings
1066
+ for dynamic eval, dynamic import, and HTML comments will now
1067
+ throw errors that contain the `sourceURL` from any `//#sourceURL=` comment
1068
+ toward the end of the source or merely `<unknown>`.
1069
+
1070
+ ## 0.11.0 (2020-11-03)
1071
+
1072
+ - `lockdown()` adds new global `assert` and tames the global `console`. The
1073
+ error taming hides error stacks, accumulating them in side tables. The
1074
+ `assert` system generated other diagnostic information hidden in side
1075
+ tables. The tamed console uses these side tables to output more informative
1076
+ diagnostics. [Logging Errors](./src/error/README.md) explains the design.
1077
+ - Adds a non-standardizable `__shimTransforms__` option to the
1078
+ Compartment constructor that allows a single transform to work
1079
+ for both programs passed to `evaluate` and modules that the SES shim
1080
+ compiles to programs.
1081
+
1082
+ ## 0.10.4 (2020-09-28)
1083
+
1084
+ - When converting each of [these data properties](src/enablements.js) to
1085
+ accessor properties, to suppress the
1086
+ [override mistake](https://github.com/tc39/ecma262/pull/1320), we now
1087
+ add to that accessor's getter an `originalValue` property to mark it
1088
+ as alleging that it is emulating a data property whose original value
1089
+ was that value.
1090
+ - Fixes an exception thrown when calling `lockdown` after just importing
1091
+ `ses/lockdown` in all environments.
1092
+
1093
+ ## 0.10.3 (2020-09-08)
1094
+
1095
+ - The `ses/lockdown` module and Rollup bundles now include a minimal
1096
+ implementation of `Compartment` that supports `evaluate` but not loading
1097
+ modules.
1098
+ This is sufficient for containment of JavaScript programs, including
1099
+ modules that have been pre-compiled to programs out-of-band, without
1100
+ entraining a full JavaScript parser framework.
1101
+ - Allows a compartment's `importHook` to return an "alias" if the returned
1102
+ static module record has a different specifier than requested.
1103
+ - Adds the `name` option to the `Compartment` constructor and `name` accessor
1104
+ to the `Compartment` prototype.
1105
+ Errors that propagate through the module loader will be rethrown anew with
1106
+ the name of the module and compartment so they can be traced.
1107
+ At this time, the intermediate stacks of the causal chain are lost.
1108
+ <https://github.com/Agoric/SES-shim/issues/440>
1109
+
1110
+ ## 0.10.2 (2020-08-20)
1111
+
1112
+ - Adds a `moduleMapHook` option to the `Compartment` constructor options.
1113
+ The module map hook can return values for the `moduleMap` for
1114
+ any given module specifier, or return `undefined` to fall back to the
1115
+ `importHook`.
1116
+ This allows for wildcard linkage to other compartments.
1117
+ - Fix dependency version for `@agoric/transform-module`.
1118
+
1119
+ ## 0.10.1 (2020-08-13)
1120
+
1121
+ - Updates the whitelist to allow a `HandledPromise` global, which is provided
1122
+ by `@agoric/eventual-send`, an early implementation of
1123
+ <https://github.com/tc39/proposal-eventual-send>.
1124
+ - Corrects our fix for the override mistake, so that it correctly emulates
1125
+ how assignment would work in the absence of the override mistake.
1126
+ A property created by assignment will now be a writable, enumerable,
1127
+ configurable data property, as it is for normal assignment.
1128
+
1129
+ ## 0.10.0 (2020-08-08)
1130
+
1131
+ - Creates a `ses/lockdown` module that only introduces `lockdown` and `harden`
1132
+ to global scope, for a much smaller payload than `ses`, which entrains a
1133
+ JavaScript parser to support ECMAScript modules.
1134
+ - Adds the `load` method to `Compartment`.
1135
+ Load allows a bundler or archiver to use the `Compartment` API to gather the
1136
+ transitive dependencies of modules without executing them.
1137
+ - Adds support for third-party implementations of a `StaticModuleRecord`
1138
+ interface (`{imports, execute}`).
1139
+
1140
+ ## 0.9.1 (2020-07-16)
1141
+
1142
+ - The `*Locale*` methods removed in the previous release are now restored
1143
+ by aliasing them to their non-locale equivalents. `localeCompare` had no builtin
1144
+ non-locale equivalent, so we provide one.
1145
+ - Adds a TypeScript definition for `harden`.
1146
+
1147
+ ## 0.9.0 (2020-07-13)
1148
+
1149
+ - BREAKING CHANGE: The compartment `evaluate` method no longer accepts an
1150
+ `endowments` option.
1151
+ Use `compartment.globalThis`, `endowments`, or `globalLexicals`.
1152
+ If per-evaluation `globalLexicals` or `endowments` are necessary,
1153
+ each evaluation will need a fresh `Compartment`.
1154
+ - BREAKING CHANGE: The `lockdown` function's deprecated `noTame*` options have
1155
+ been removed in favor of the `*Taming` options introduced in version 0.8.0.
1156
+ - BREAKING CHANGE: The `.toLocale*` methods of
1157
+ Object/Number/BigInt/Date/String/Array/%TypedArray% were removed from SES
1158
+ environments. This includes methods named `toLocaleString`,
1159
+ `toLocaleDateString`, `toLocaleTimeString`, `toLocaleLowerCase`,
1160
+ `toLocaleUpperCase`, and `localeCompare`. These may be restored (in a
1161
+ modified form) in a future release.
1162
+ - The way `lockdown()` tames the `Error` constructor now cooperates
1163
+ with the V8 stack trace API to a degree that is permissible without
1164
+ breaking the integrity of applications that use it.
1165
+ - The Compartment constructor now accepts a `globalLexicals` option.
1166
+ The own enumerable properties of the global lexicals are captured
1167
+ and presented as constants in the scope of all calls to `evaluate` and all
1168
+ modules.
1169
+ The global lexicals overshadow the global object.
1170
+
1171
+ ## 0.8.0 (2020-05-26)
1172
+
1173
+ - Adds support for modules to Compartments.
1174
+ - SES no longer exports anything.
1175
+ `Compartment`, `StaticModuleRecord`, `lockdown`, and `harden` are all
1176
+ introduced as properties of `globalThis`.
1177
+ - The `Compartment` `global` getter is now named `globalThis`, consistent with
1178
+ the specification proposal.
1179
+ - The `Compartment` `transforms` constructor option is now just an array of
1180
+ transform functions that accept and return program strings.
1181
+ Transforms can no longer introduce `endowments`.
1182
+ The compartment constructor's `endowments` argument (first) and assigning
1183
+ properties to `globalThis` are the remaining supported ways to introduce
1184
+ endowments.
1185
+ - Repair `Function.apply` and `TypeError.message` (as well as `.message` on
1186
+ all the other Error types), to tolerate what the npm `es-abstract` module
1187
+ does. This allows `tape` (version 4.x) to be loaded in a locked-down SES
1188
+ world, and also allows its `t.throws` assertion to work. `tape` (version
1189
+ 5.x) still has problems. [#293]
1190
+
1191
+ - Replaces the old `noTame*` options to `lockdown` with new `*Taming` options.
1192
+ The old style had boolean values defaulting to `false`. In the new style,
1193
+ each option supports at least the options `'safe'` and `'unsafe'` defaulting
1194
+ to `'safe'`. As a transitional matter, this release still supports the
1195
+ old style as well, as another way to say the same thing. [#326]
1196
+
1197
+ [#293]: https://github.com/Agoric/SES-shim/issues/293
1198
+ [#326]: https://github.com/Agoric/SES-shim/issues/326
1199
+
1200
+ ## 0.7.7 (2020-04-27)
1201
+
1202
+ - This version decouples lockdown and the Compartment constructor.
1203
+ The Compartment constructor is now exported by `ses` (was previously only
1204
+ available as a property of `globalThis` _after_ lockdown).
1205
+ The Compartment constructor will also create "privileged" compartments when
1206
+ constructed before lockdown.
1207
+
1208
+ ## 0.7.6 (2020-03-31)
1209
+
1210
+ Bug fixes.
1211
+ This release fixes issues in RegExp and Error taming.
1212
+
1213
+ ## 0.7.4-5 (2020-03-21)
1214
+
1215
+ This release adds Node.js ESM support by upgrading @agoric/make-hardener to a
1216
+ hybrid version for most modern module systems.
1217
+
1218
+ - Newless calls to the RegExp constructor now work after lockdown.
1219
+
1220
+ - upgrade @agoric/make-hardener v0.0.8
1221
+
1222
+ ## 0.7.2-3 (2020-03-13)
1223
+
1224
+ Bug fixes.
1225
+ This release addresses an exception observed where locking down fails because
1226
+ SES cannot delete the prototype of the harden function.
1227
+ This is addressed by upgrading @agoric/make-harden to version 0.0.7.
1228
+ This release also restores fulls upport for importing SES as CommonJS, Node.js
1229
+ ESM, and Node.js emulated ESM with the `esm` package.
1230
+
1231
+ ## 0.7.1 (2020-13-10)
1232
+
1233
+ SECURITY UPDATE: This complete re-architecture which removes the realm-shim and
1234
+ resolve the associatd sandbox escapes related to leaking cross-realm
1235
+ intrinsics. All users should update to this version.
1236
+
1237
+ See [docs/ses-0.7.md].
1238
+
1239
+ ## 0.6.4 (2019-10-16)
1240
+
1241
+ SECURITY UPDATE: This release upgrades realms-shim to fix multiple sandbox
1242
+ escapes. All users should update to this version.
1243
+
1244
+ - upgrade to realms-shim v1.2.1
1245
+
1246
+ Non-security fixes:
1247
+
1248
+ - improve documentation
1249
+
1250
+ ## 0.6.3 (2019-10-02)
1251
+
1252
+ SECURITY UPDATE: This release upgrades realms-shim to fix multiple sandbox
1253
+ escapes. All users should update to this version.
1254
+
1255
+ - upgrade to realms-shim v1.2.0
1256
+
1257
+ Non-security fixes:
1258
+
1259
+ - add `SES.harden` to make hardening available from within the Realm. (#161)
1260
+
1261
+ ## 0.6.2 (2019-09-25)
1262
+
1263
+ No user-visible changes.
1264
+
1265
+ Use realms-shim as a normal package, not a git-submodule. Update eslint
1266
+ dependencies.
1267
+
1268
+ ## 0.6.1 (2019-19-14)
1269
+
1270
+ - SECURITY UPDATE: This release fixes a sandbox escape discovered in the
1271
+ realms-shim by GitHub user "XmiliaH", which works by causing an infinite
1272
+ loop and extracting the real function constructor from the RangeError
1273
+ exception object. See <https://github.com/Agoric/realms-shim/issues/48> for
1274
+ more details.
1275
+
1276
+ ## 0.6.0 (2019-09-03)
1277
+
1278
+ - Breaking change: `options.transforms` may no longer specify `endow()`
1279
+ transforms. Instead, use `rewrite()`, which can now modify endowments.
1280
+ See <https://github.com/Agoric/realms-shim/pull/38> for details.
1281
+ - Repair the "override mistake", with optional repair plan in
1282
+ `options.dataPropertiesToRepair`. See src/bundle/dataPropertiesToRepair.js
1283
+ and <https://github.com/Agoric/SES/pull/146> for details.
1284
+ - `options.sloppyGlobals` is rejected by `makeSESRootRealm()`, since all SES
1285
+ root realms are frozen. `sloppyGlobals` can only be used in a new
1286
+ "Compartment", made by calling `Realm.makeCompartment(options)`. See
1287
+ <https://github.com/Agoric/SES/issues/142>
1288
+ <https://github.com/Agoric/realms-shim/pull/33>
1289
+ <https://github.com/Agoric/realms-shim/pull/30> for details.
1290
+ - Add `options.whitelist` to override the set of properties that are retained
1291
+ in the new realm. The default gives you SES, but it could be overridden to
1292
+ e.g. enforce a Jessie-only environment.
1293
+
1294
+ ## 0.5.3 (2019-07-24)
1295
+
1296
+ - Re-enable indirect eval. (#131)
1297
+
1298
+ ## 0.5.2 (2019-07-13)
1299
+
1300
+ Dependency updates only, no user-visible changes.
1301
+
1302
+ ## 0.5.1 (2019-07-10)
1303
+
1304
+ - The 'realms-shim' module, upon which SES depends, has been split out of the
1305
+ TC39 'proposal-realms' repository, and now lives in
1306
+ <https://github.com/Agoric/realms-shim>. It has not been released to NPM,
1307
+ rather SES incorporates it as a git submodule. (#110)
1308
+ - The documentation is now hosted on ReadTheDocs at
1309
+ <https://ses-secure-ecmascript.readthedocs.io/en/latest/> (#111, #117)
1310
+ - SES.makeRootRealm() now accepts a 'transforms' option. This is a list of `{ endow, rewrite }` functions which can add/modify endowments and/or rewrite
1311
+ source code each time an `evaluate()` is performed. (#125)
1312
+
1313
+ Thanks to Kate Sills, Dan Connolly, Michael Fig, and the ever-dependable
1314
+ Dependabot for additional fixes in this release.
1315
+
1316
+ ## 0.5.0 (2019-04-05)
1317
+
1318
+ INCOMPATIBLE API CHANGE: Starting with this release, the SES package exports
1319
+ a single default object (named `SES`, from which you can get the
1320
+ `SES.makeSESRootRealm()` function). Previously, it exported both a `SES`
1321
+ object and the `makeSESRootRealm` function.
1322
+
1323
+ Code which uses this package as an ES6 module must change its import from
1324
+ `import { SES } from 'ses';` to:
1325
+
1326
+ ```js
1327
+ import SES from 'ses';
1328
+ ```
1329
+
1330
+ Similarly, for code which uses CommonJS-style, it must change from `const { SES } = require('ses')` to:
1331
+
1332
+ ```js
1333
+ const SES = require('ses');
1334
+ ```
1335
+
1336
+ The package now exports bundles in various flavors: CommonJS, ES6 Module, and
1337
+ browser-based UMD.
1338
+
1339
+ Other changes:
1340
+
1341
+ - whitelist Symbol.matchAll, to fix Chrome-v73 (Issue #90)
1342
+ - change primary export #88
1343
+ - improve documentation #66 #67
1344
+ - add integration tests #85
1345
+ - packaging: remove ses-shim.js, add other generated bundles
1346
+ - update Realms shim to commit 0c00eb, to fix Browserify #79
1347
+ - test against node v10/v11, switch from travis to circleci #73
1348
+ - fix examples #102
1349
+
1350
+ Thanks to Matt Bell, Kate Sills, and Mark Miller for additional fixes in this
1351
+ release.
1352
+
1353
+ ## 0.4.0 (2019-02-20)
1354
+
1355
+ Improve usability.
1356
+
1357
+ - remove `Nat` and `def` from the global environment #45
1358
+ - provide a helper function named `s.makeRequire()` to build a `require`
1359
+ endowment. This can be configured to enable `require('@agoric/nat')` or
1360
+ `require('@agoric/harden')` (among others), so the same code can work
1361
+ either inside or outside of a SES realm. For details of its configuration,
1362
+ see the comments in the commit which landed it. #13
1363
+ - harden() comes from `@agoric/make-hardener`, which doesn't climb
1364
+ prototype/inheritance chains, but does complain if the prototype wasn't
1365
+ already known to harden(). This avoids the "Ice-9" freeze-the-world
1366
+ problem, and also serves to signal when an object from one realm is passed
1367
+ into the harden() of a different realm. #15
1368
+ - harden() now shares a WeakSet of previously-hardened objects #4
1369
+ - use harden() instead of def() #39
1370
+ - SES no longer depends upon Nat, but uses it during unit tests. Client code
1371
+ that wants Nat should use `require('@agoric/nat')`. #45
1372
+ - Include AsyncIteratorPrototype in the set of anonIntrinsics #58
1373
+ - use eslint to format all SES code
1374
+
1375
+ ## 0.3.0 (2019-02-08)
1376
+
1377
+ Improves security and functionality.
1378
+
1379
+ This fixes all known confinement leaks:
1380
+
1381
+ - We now freeze AsyncGeneratorFunction and AsyncFunction, the last of the
1382
+ "anonymous" intrinsics (which are reachable by syntax but not simple
1383
+ property lookup). In the previous release, attacker code could modify their
1384
+ behavior (which defender code might have been relying upon) or use them as
1385
+ a communication channel. (#3, #41)
1386
+ - We now remove all unknown properties from the global object, using a
1387
+ special list of ones that are safe to expose. This protects us from
1388
+ surprising platform-specific objects, or newly-added standard JS objects
1389
+ that have not yet been examined for safety. The 'Intl' object is currently
1390
+ removed by this check (and `intlMode: "allow"` has been removed), but may
1391
+ be brought back in a future release. (#26)
1392
+ - RegExp.prototype.compile is removed unconditionally (even if regexpMode:
1393
+ "allow" is set), because it violates the semantics of Object.freeze
1394
+
1395
+ It also improves usability:
1396
+
1397
+ - Uncaught exceptions in Node.js are now rendered correctly when the
1398
+ `errorStackMode: "allow"` option is enabled. In the previous release, such
1399
+ exceptions were always displayed as "undefined", which was particularly
1400
+ unhelpful. If your program is abruptly exiting with "undefined", try
1401
+ turning this option on while you're debugging. But don't leave it on,
1402
+ because it probably enables a confinement breach.
1403
+ - SES is an ES6 module, but should now be importable with `require()` by
1404
+ other code which is unaware of ES6 modules, because it now uses the `esm`
1405
+ module internally. (#32)
1406
+ - `console.log` is now available within the confined code, if the
1407
+ `consoleMode: "allow"` option is enabled. If this is disabled,
1408
+ `console.log()` will throw a `TypeError` (since `console` is undefined, it
1409
+ has no `log` property). Many other `console` methods (but not all) are
1410
+ exposed too. (#35)
1411
+
1412
+ SES now requires Node.js version 10 or later.
1413
+
1414
+ ## 0.2.0 (2019-01-18)
1415
+
1416
+ Improves confinement, small API changes.
1417
+
1418
+ The options passed as `SES.makeSESRootRealm(options)` have changed:
1419
+
1420
+ - `options.dateNowMode="allow"` allows `Date.now()` and `new Date()` to
1421
+ work normally, otherwise they return NaN
1422
+ - `options.mathRandomMode="allow"` allows `Math.random()` to work
1423
+ normally (nondeterministically), else it will throw an Error
1424
+ - `options.intlMode="allow"` lets `Intl.DateTimeFormat()`, `Intl.NumberFormat()`,
1425
+ and `Intl.getCanonicalLocales()` to work normally, else they throw Errors
1426
+ - `options.errorStackMode="allow"` exposes `Error.prototype.stack` and
1427
+ `Error.captureStackTrace` (on platforms that support them), otherwise they
1428
+ are suppressed. Note that these could be used to break confinement, not
1429
+ just access nondeterminism.
1430
+
1431
+ Previously the only option honored was `options.dateNowTrap = false`
1432
+
1433
+ The suppression of `Error.captureStackTrace` is new in this release. This
1434
+ release also suppresses `RegExp.prototype.compile` and properties like
1435
+ `RegExp.$1` which cause some surprising behavior.
1436
+
1437
+ `SES.def` and `SES.Nat` are exported, so they can be used by non-confined
1438
+ code (mostly in tests). `def(obj)` makes an object defensive, by freezing
1439
+ it's external API surface (anything reachable by property lookup and
1440
+ prototype traversal). `Nat(num)` throws an error unless its argument is a
1441
+ natural number (a non-negative integer small enough to remain an integer
1442
+ inside a Javascript `Number` type). Both are important for defensive
1443
+ programming.
1444
+
1445
+ ## 0.1.3 (2018-08-24)
1446
+
1447
+ Adds Nat and SES.confineExpr.
1448
+
1449
+ - `Nat(val)` ensures the value is a natural (non-negative) integer
1450
+ - `SES.confineExpr(expr)` makes it easy to start with a function object, turn
1451
+ it into a string, then into a new function inside the SES realm.
1452
+
1453
+ This also updates the challenge page to fix a demo vulnerability (#8).
1454
+
1455
+ ## 0.1.2 (2018-07-30)
1456
+
1457
+ - npm name is now 'ses'
1458
+ - update to current proposal-realms
1459
+
1460
+ ## 0.0.1 (2018-07-28)
1461
+
1462
+ first preliminary release