ses 2.1.0 → 2.3.0

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