ses 1.8.0 → 1.9.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/NEWS.md DELETED
@@ -1,1000 +0,0 @@
1
- User-visible changes in `ses`:
2
-
3
- # v1.8.0 (2024-08-27)
4
-
5
- - New `legacyRegeneratorRuntimeTaming: 'unsafe-ignore'` lockdown option to tame
6
- old `regenerator-runtime` (from 0.10.5 to 0.13.7).
7
- - If lockdown's `errorTrapping: 'report'` mode is selected (possibly via the
8
- `'platform'`, or `'exit'` or `'abort'` modes), uncaught exceptions will be
9
- written to standard error with the new `SES_UNCAUGHT_EXCEPTION: ` prefix.
10
- This is intended to give valuable context to users of the system, especially
11
- when an uncaught exception is not an `Error` object, and therefore its origin
12
- may be hard to find in source code.
13
-
14
- This is not likely to affect most systems built with SES, as stderr is
15
- generally reserved for user-only messages. If your SES system sends its
16
- stderr to a program which parses it, you may need to adapt that program to be
17
- tolerant of the `SES_UNCAUGHT_EXCEPTION: ` prefix. Even for such programs, it
18
- is unlikely they are that sensitive to stderr formatting.
19
-
20
- # v1.6.0 (2024-07-30)
21
-
22
- - *NOTICE*: This version introduces multiple features to converge upon a
23
- more common standard for [Hardened JavaScript](https://hardenedjs.org).
24
- All code should begin migrating to these usage patterns as the older
25
- patterns are now deprecated and will not be supported in a future major
26
- version of SES.
27
-
28
- - To converge on a portable pattern for using `Compartment`, introduces an
29
- `__options__` property for the first argument of the `Compartment`
30
- constructor that must be `true` if present and indicates the object is the
31
- options bag and not the global endowments. All code going forward should
32
- include this flag until the next major version of SES, when we plan for it to
33
- become vesgitial and drop support for three-argument `Compartment`
34
- construction.
35
-
36
- In the unlikely event that existing code names an endowment `__options__`,
37
- that code will break and need to be adjusted to adopt this version.
38
- Because we rate this unlikely, we have elected not to mark this with
39
- a major version bump.
40
-
41
- - Adds a `__noNamespaceBox__` option that aligns the behavior of the `import`
42
- method on SES `Compartment` with the behavior of XS and the behavior we will
43
- champion for compartment standards.
44
- All use of `Compartment` should migrate to use this option as the standard
45
- behavior will be enabled by default with the next major version of SES.
46
-
47
- - Adds support for module descriptors better aligned with XS.
48
- Compartments use module desriptors to load and link modules.
49
- The importHook, importNowHook, and moduleMapHook all return module descriptors
50
- (sometimes promises for module descriptors).
51
- The modules option or argument to the Compatment constructor has module
52
- descriptors for all its values.
53
- - `{record, specifier, compartment}` should become `{source: record,
54
- specifier, compartment}`.
55
- - `{specifier, compartment}` should become `{source: specifier,
56
- compartment}`.
57
- - `{record: compartment.module(specifier)}` should become `{namespace:
58
- specifier, compartment}`.
59
-
60
- - When running transpiled code on Node, the SES error taming
61
- gives line-numbers into the generated JavaScript, which often don't match the
62
- the original lines. This happens even with the normal development-time
63
- lockdown options setting,
64
- ```js
65
- errorTaming: 'unsafe'
66
- ```
67
- or setting the environment variable
68
- ```sh
69
- $ export LOCKDOWN_ERROR_TAMING=unsafe
70
- ```
71
- To get the original line numbers, this release
72
- adds `'unsafe-debug'`. This `errorTaming: 'unsafe-debug'` setting
73
- should be used ***during development only*** when you can
74
- sacrifice more security for a better debugging experience, as explained at
75
- [`errorTaming` Options](https://github.com/endojs/endo/blob/master/packages/ses/docs/lockdown.md#errortaming-options).
76
- With this setting, when running transpiled code on Node (e.g. tests written
77
- in TypeScript),
78
- the stacktrace line-numbers point back into the original
79
- source, as they do on Node without SES.
80
-
81
- # v1.5.0 (2024-05-06)
82
-
83
- - 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`.
84
- - To support TypeScript v5.5, a CommonJS-specific type declaration file is now explicitly exported.
85
-
86
- # v1.3.0 (2024-02-22)
87
-
88
- - Now supports `Promise.any`, `AggegateError`, `error.errors`,
89
- and `error.cause`.
90
- - Assertion functions/methods that were parameterized by an error constructor
91
- (`makeError`, `assert`, `assert.fail`, `assert.equal`) now also accept named
92
- options `cause` and `errors` in their immediately succeeding
93
- `options` argument.
94
- - For all those, the error constructor can now be an `AggregateError`.
95
- If they do make an error instance, they encapsulate the
96
- non-uniformity of the `AggregateError` construction arguments, allowing
97
- all the error constructors to be used polymorphically
98
- (generic / interchangeable).
99
- - Adds a `GenericErrorConstructor` type to be effectively the common supertype
100
- of `ErrorConstructor` and `AggregateErrorConstructor`, for typing these
101
- error constructor parameters that handle the error constructor
102
- polymorphically.
103
- - The SES `console` now includes `error.cause` and `error.errors` in
104
- its diagnostic output for errors.
105
-
106
- # v1.2.0 (2024-02-14)
107
-
108
- - Exports `ses/lockdown-shim.js`, `ses/compartment-shim.js`, and
109
- `ses/assert-shim.js` for piecemeal usage.
110
- This change is motivated by the need to omit `ses/assert-shim.js` in Test262
111
- environments.
112
-
113
- # v1.1.0 (2024-01-17)
114
-
115
- - The [iterators-helpers](https://github.com/tc39/proposal-iterator-helpers)
116
- proposal includes two accessor properties whose purpose is to emulate
117
- a data property, but without the override mistake problem. The ses-shim
118
- creates many such properties, but was unprepared for them to already be
119
- present in the JS platform it starts with. Chrome Canary and Node 22
120
- both implement the iterators-helper proposal, triggering this bug, preventing
121
- the ses-shim from initializing. The ses-shim
122
- [now copes safely](https://github.com/endojs/endo/pull/1969) with an
123
- enumerated set of such properties, starting with these two properties from
124
- the iterators-helpers proposal.
125
- - The ses-shim now permits the new methods from the
126
- [set-methods](https://github.com/tc39/proposal-set-methods) proposal,
127
- enabling these methods to be used on platforms where they are implemented,
128
- which are currently a Chrome Canary and a Node 22.
129
-
130
- # v0.18.8 (2023-09-11)
131
-
132
- - Extracts `repairIntrinsics(options)` and `hardenIntrinsics()` from the
133
- behavior of `lockdown(options)` so vetted shims can run between these
134
- calls.
135
- Any modifications to shared intrinsics survive if applied after
136
- `repairIntrinsics()`.
137
- - In the SES-shim implementation of HardenedJS, all constructed compartments
138
- get the same safe `Date` constructor, that does not provide the ability to
139
- measure duration.
140
- It used to do this by having `Date.now()` return `NaN`, and to have calls on
141
- the constructor that would normally have returned an indication of the
142
- current date, instead return the corresponding invalid date indication.
143
- Now, all of these throw a `TypeError` whose message begins with `'secure
144
- mode'`.
145
- This aligns with the XS implementation of HardenedJS.
146
- - Similarly, In the SES-shim implementation of HardenedJS, all constructed
147
- compartments get the same safe `Math` namespace object that does not provide
148
- a working `random()` function.
149
- It used to do that by omitting the `random` property from the safe `Math`
150
- namespace object.
151
- Now, the safe shared `Math` namespace object has a `Math.random()` function
152
- that throws a `TypeError whose message begins with `'secure mode'`.
153
- This again aligns with the XS implementation of HardenedJS.
154
-
155
- # v0.18.6 (2023-08-07)
156
-
157
- - Censors the pattern `{...import(specifier)}`.
158
- We previously censored `import(specifier)` and expressly allowed
159
- `object.import(specifier)`.
160
- The relaxation for the latter form in version 0.13.0 inadvertently allowed
161
- import with the spread operator.
162
-
163
- # v0.18.5 (2023-07-14)
164
-
165
- - Adds `assert.bare` for embedding unquoted strings in details.
166
- - Permits new `dispose` symbols, other recent additions to JavaScript, and for
167
- the anticipated iterator helpers.
168
- - Tames `Symbol` so symbols can be preserved in the start compartment and
169
- denied to shared compartments.
170
- - Improves debugging in Safari.
171
- - Adds missing native function markers.
172
- All native functions should have a `toString` that says `[native code]`, even
173
- if emulated.
174
-
175
- # v0.18.4 (2023-04-20)
176
-
177
- - Pass through the start compartment's `globalThis.harden` if defined.
178
-
179
- # v0.18.3 (2023-04-14)
180
-
181
- - New `__hardenTaming__: 'unsafe'` lockdown option to fake harden unsafely,
182
- which can be used to improve performance for applications that are known to be
183
- safe even with a no-op `harden`.
184
- - Finite deep stacks, using LRU budgets for depth of stacks an well as the
185
- maximum number of weakly-held errors to annotate.
186
- - Add `%AsyncGenerator%.length` and `%AsyncFunctionPrototype%.length` `number`
187
- properties to allowlist.
188
-
189
- # v0.18.2 (2023-03-07)
190
-
191
- - Introduces the `__syncModuleFunctor__` property of static module record
192
- to replace evauluation of `__syncModuleProgram__` for environments without eval.
193
-
194
- # v0.18.1 (2022-12-23)
195
-
196
- - Fixes a bug for SES initialization in a no-unsafe-eval
197
- Content-Security-Policy.
198
- - Fixes a bug where reexport of multiple named exports of the same name was
199
- causing them to be overridden by the last value. Now named exports are
200
- handled in the same manner as `export *`.
201
- - Allows Compatment `importHook` implementations to return aliases: module
202
- descriptors that refer to a module by its specifier in the same or a
203
- specified compartment, without providing a static module record (module
204
- source).
205
-
206
- # v0.18.0 (2022-11-14)
207
-
208
- - *BREAKING*: Removes support for `globalLexicals`.
209
- To our knowledge, there are no production uses for `globalLexicals`.
210
- They currently could leak because `moduleLexicals` and `globalLexicals`
211
- used the same scope object, so properties of one would leak to the other
212
- with crafted modules.
213
- We had an opportunity to plug the leak at the cost of a fifth scope
214
- in all evaluators, but elected to remove the unnecessary complexity instead.
215
-
216
- # v0.17.0 (2022-10-24)
217
-
218
- - Previous versions of SES would leak the proxy used to isolate evaluated
219
- code to functions added to the global object by guest code.
220
- The value of `this` in such functions should be `undefined`, but that is not
221
- possible to emulate in this shim.
222
- This version changes the value of `this` in such functions to be the same as
223
- `globalThis` of the compartment, as would be correct in sloppy mode.
224
- - Removes experimental support for "known scope proxies".
225
-
226
- # v0.16.0 (2022-10-19)
227
-
228
- - When hardening a typed array, detects and locks down properties named as
229
- number-coercible strings that are not index properties.
230
-
231
- # v0.15.23 (2022-09-27)
232
-
233
- - Fixes the unhandled promise rejection logic to report unhandled rejections
234
- when the promise is collected. Because of a bug it previously only reported
235
- at process exit.
236
- - Improves the fidelity of emulation for V8 `Error.prepareStackTrace`,
237
- allowing more legacy code to work by default in isolation.
238
-
239
- # v0.15.18 (2022-08-23)
240
-
241
- - Removes the `__allowUnsafeMonkeyPatching__` option to lockdown. As the name
242
- should indicate, this was always an unsafe temporary kludge. Its only known
243
- use was in agoric-sdk, now gone at
244
- https://github.com/Agoric/agoric-sdk/pull/5922 . Without this option, a
245
- successful `lockdown` will now always harden the primordials.
246
-
247
- # v0.15.8 (2022-02-18)
248
-
249
- - Harden now gives special treatment to typed arrays.
250
- Instead of freezing a typed array, harden will seal it and make all of its
251
- non-integer properties non-writable.
252
- All of their integer properties will remain writable and non-configurable.
253
- TypedArrays are exceedingly unusual because their integer properties are
254
- writable and neither freeze nor defineProperty can convert them from writable
255
- to non-writable.
256
-
257
- # v0.15.3 (2022-01-21)
258
-
259
- - Fixes the type definition for assert.error so that the final options bag,
260
- which may include `errorName`, checks correctly in TypeScript.
261
- - Lockdown will now throw an error if code running before SES initialization
262
- replaced `eval`.
263
-
264
- # 0.15.2 (2021-12-08)
265
-
266
- - The `Removing...` messages that Lockdown emits when encountering unrecognized
267
- properties on shared intrinsics are now logged as "warnings".
268
- This has the material benefit of sending these messages to STDERR on Node.js.
269
- - Updates permits for all current TC39 stage 3 and 4 proposals, notably
270
- suppressing the `Removing...` messages for `Object.hasOwn`; `findLast` and
271
- `findLastIndex` on both `Array.prototype` and `TypedArray.prototype`; and the
272
- properties `transfer`, `resize`, `resizable`, and `maxByteLength` of
273
- `ArrayBuffer.prototype`.
274
-
275
- # 0.15.1 (2021-11-15)
276
-
277
- - The TypeScript definition of `lockdown` now allows for the option
278
- `"errorTrapping": "none"`.
279
- - Fixes error trapping on the web, showing both the message (and stack) of any
280
- error that throws out of the top of an event.
281
-
282
- # 0.15.0 (2021-11-02)
283
-
284
- - _BREAKING CHANGE_: The lockdown option `domainTaming` is now `safe` by
285
- default, which will break any application that depends transtively on the
286
- Node.js `domain` module.
287
- Notably, [standard-things/esm](https://github.com/standard-things/esm)
288
- uses domains and so SES will not support `node -r esm` going forward.
289
-
290
- This protects against the unhardened `domain` property appearing on shared
291
- objects like callbacks and promises.
292
- This overcomes the last _known_ obstacle toward object capability containment.
293
-
294
- - Lockdown will now read options from the environment as defined by the Node.js
295
- `process.env` parameter space.
296
- - _BREAKING CHANGE_: Lockdown may no longer be called more than once.
297
- Lockdown no longer returns a boolean to indicate whether it was effective
298
- (true) or redundant (false). Instead, Lockdown will return undefined for
299
- its first invocation or throw an error otherwise.
300
-
301
- # 0.14.4 (2021-10-14)
302
-
303
- - Fixes a defect in the per-compartment `Function` and `eval` functions, such
304
- that these environments did not have the compartment's `globalLexicals`.
305
- There is no known environment depending on this invariant for security
306
- reasons, but such a scenario would be a program arranging a translator that
307
- introduces run-time security checks, like metering, that depend on the
308
- existence of a named global lexical.
309
- [#898](https://github.com/endojs/endo/issues/898)
310
- - The above fix incidentally improved the performance of compartment evaluation
311
- for cases that do not require special global lexicals, by sharing a single
312
- per-compartment evaluator.
313
-
314
- # 0.14.3 (2021-09-18)
315
-
316
- - Due to a peculiar bit of error handling code in Node 14, as explained at
317
- [Hardened JavaScript interferes with Node.js 14 Error
318
- construction](https://github.com/endojs/endo/issues/868),
319
- we have added more overrides to the default `overrideTaming: 'moderate'`
320
- setting. At this setting, assigning to the `name` property of a mutable error
321
- instance should work. It will continue not to work at the `'min'` setting, so
322
- use the default `'moderate'` setting if you need to.
323
- - Adds a lockdown option `domainTaming` to detect whether Node.js domains have
324
- been initialized and prevents them from being initialized afterward.
325
- Domains otherwise presented a hazard to the integrity of SES containment on
326
- Node.js.
327
- The option defaults to `"unsafe"` in this version and will be switched to
328
- `"safe"` by default in the next release that allows for breaking-changes, to
329
- afford a gradual migration.
330
- Thank you to @dominictarr with [Least Authority](https://leastauthority.com/)
331
- for devising this feature.
332
- - Fixes reflexive module imports. Previously, SES would fail to initialize a
333
- module graph where a module imported an alias to itself.
334
-
335
- # 0.14.1 (2021-08-12)
336
-
337
- - Adds permits for `Array.prototype.at` and `String.prototype.at` which are
338
- Stage 3 proposals for ECMA 262.
339
-
340
- # 0.14.0 (2021-07-22)
341
-
342
- - _BREAKING_: Any precompiled static module records from prior versions
343
- will not load in this version of SES or beyond. The format of the preamble
344
- has been changed to admit the possibility of a variable named `Map` declared
345
- in the scope of a module.
346
- - Fixes the type assertions for `assert` and `assert.string`.
347
- - Reveals `harden` only after `lockdown`. Harden was never usable before
348
- lockdown because it would render the environment irreparable.
349
- Calling `harden` before `lockdown` previously threw an exception.
350
- Now it is possible to write libraries that are usable both in JS and SES,
351
- which can know whether to harden their API by the presence of harden in
352
- global scope.
353
- - Adds `errorTrapping` lockdown option and by default traps uncaught exceptions
354
- and logs them back with their original stack traces.
355
- These would previously appear as mysterios `{}` lines in Node.js.
356
-
357
- # 0.13.4 (2021-06-19)
358
-
359
- - Adds more TypeScript definitions, importable with `/// <reference types="ses"/>`, covering `harden`, `lockdown`, `assert`, and `Compartment`,
360
- and many types importable with `import('ses')` notation.
361
- - Adds descriptive detail to module system link error messages and fixes the
362
- reported exports for one.
363
-
364
- # 0.13.1 (2021-06-05)
365
-
366
- - Fixes type exports for `harden`.
367
- - Packaging fixes.
368
-
369
- # 0.13.0 (2021-06-01)
370
-
371
- - _BREAKING CHANGE_ The `ses/lockdown` module is again just `ses`.
372
- Instead of having a light 43KB `ses/lockdown` and a heavy 3.1MB `ses`, there
373
- is just a 52KB `ses` that has everything except `StaticModuleRecord`.
374
- For this release, there remains a `ses/lockdown` alias to `ses`.
375
- - _BREAKING CHANGE_ Third-party static module interface implementations _must_
376
- now explicitly list their exported names.
377
- For CommonJS, this implies using a heuristic static analysis of `exports`
378
- changes.
379
- Consequently, third-party modules can now participate in linkage with ESM
380
- including support for `export * from './spec.cjs'` and also named imports
381
- like `import * from './spec.cjs'`.
382
- - _BREAKING CHANGE_ The `StaticModuleRecord` constructor has been removed in
383
- favor of a duck-type for compiled static module records that is intrinsic to
384
- the shim and may be emulated by a third-party `StaticModuleRecord`
385
- constructor.
386
- The constructor must perform the module analysis and transform the source,
387
- and present this duck-type to the Compartment `importHook`.
388
- This relieves SES of a dependency on Babel and simplifies its API.
389
- - _BREAKING CHANGE_ The UMD distribution of SES must have the UTF-8 charset.
390
- The prior versions were accidentally ASCII, so SES would have worked
391
- in any web page, regardless of the charset.
392
- To remedy this, be sure to include `<head><meta charset="utf-8"></head>` in
393
- the containing page (a general best-practice for web pages) or specifically
394
- use `<script charset="utf-8" src="ses.umd.min.js">` to address the single
395
- file.
396
- - Relaxes the censorship of `import` and `eval` in programs evaluated
397
- under SES to specifically allow the use of `something.import()` or
398
- `something.eval()` methods.
399
- - Fix: `new Compartment(null, null, options)` no longer throws.
400
- - New lockdown option: `overrideDebug: [...props]` to detect where a property
401
- assignment needs to be turned into a `defineProperty` to avoid the override
402
- mistake. Most useful as `overrideTaming: 'severe', overrideDebug: ['constructor']`.
403
- - We reopened Safari bug
404
- [Object.defineProperties triggering a setter](https://bugs.webkit.org/show_bug.cgi?id=222538#c17)
405
- when we found that it was causing an infinite recursion initializing SES
406
- on Safari.
407
- - We revised an error message to include the error tag of a new error
408
- explanation page:
409
- [SES_DEFINE_PROPERTY_FAILED_SILENTLY](error-codes/SES_DEFINE_PROPERTY_FAILED_SILENTLY.md).
410
- We hope to add such explanations for more errors over time. Please let us
411
- know as you encounter errors that strongly needs explaining.
412
-
413
- # 0.12.7 (2021-05-05)
414
-
415
- - Added to `assert.error` an optional options bag with an option named
416
- `errorName`. The `assert.error` function makes error objects with detailed
417
- error messages whose unredacted contents appear only in `console` output
418
- and are otherwise unobservable. If `errorName` is provided, then
419
- it is also used in the console output instead of the normal error name,
420
- but is otherwise unobservable. This will rarely be used, but will be
421
- used by the `@agoric/marshal` package to name an unserialized error
422
- so that it can be traced back to the site that serialized it; and
423
- ultimately to its origin.
424
-
425
- # 0.12.6 (2021-03-27)
426
-
427
- - Added a new temporary `__allowUnsafeMonkeyPatching__` option to `lockdown`.
428
-
429
- Sometimes SES is used where SES's safety is not required. Some libraries
430
- are not compatible with SES because they monkey patch the shared primordials
431
- is ways SES cannot allow. We temporarily introduce this option to enable
432
- some of these libraries to work in, approximately, a SES environment
433
- whose safety was sacrificed in order to allow this monkey patching to
434
- succeed. More at the
435
- [\_\_allowUnsafeMonkeyPatching\_\_ Options](./lockdown-options.md#__allowUnsafeMonkeyPatching__-options)
436
- section of [lockdown-options](./lockdown-options.md).
437
-
438
- # 0.12.5 (2021-03-25)
439
-
440
- - The 0.12.4 release was broken by https://github.com/endojs/endo/pull/552
441
- since fixed by https://github.com/endojs/endo/pull/638
442
- - These merely remove a repair needed by an old v8 / Node version that
443
- no one any longer supports.
444
-
445
- # 0.12.4 (2021-03-24)
446
-
447
- - Expand TypeScript definitions to include Compartment, StaticModuleRecord,
448
- StaticModuleType, RedirectStaticModuleInterface, FinalStaticModuleType,
449
- ThirdPartyStaticModuleInterface, Transform, ImportHook, and ModuleMapHook.
450
- - The previous took `Object.prototype.constructor` off of the default
451
- [list of properties](src/enablements.js) we enable to be overridden by
452
- assignment. This default is the `{overrideTaming: 'moderate'}` setting.
453
- In this release, we stop enabling `'hasOwnProperty'` by default as
454
- well. With both of these gone, we now have a reasonable debugging
455
- experience.
456
- - Unfortunately, both rollup and webpack seem to turn exported names
457
- into assignments to an `exports` object that inherits from
458
- `Object.prototype`, thereby potentially stepping on any name.
459
- To deal with this perverse case, the release also provides an
460
- `{overrideTaming: 'severe'}` option which enables all properties on
461
- at least `Object.prototype`. This is more compatible but makes the
462
- vscode debugger's inspector unusable. At
463
- [Tracking issue for getting 3rd party packages more SES friendly (#576)](https://github.com/endojs/endo/issues/576)
464
- we track the incompatibilities we encounter and progress toward
465
- getting them fixed.
466
- - Add utility function `Compartment.prototype.__isKnownScopeProxy__(value)` to
467
- aid working around scopeProxy leakage. Returns true if `value` is one of the
468
- scopeProxies created during calls to this Compartment instances's
469
- `Compartment.prototype.evaluate`. See `test-compartment-known-scope-proxy.js`
470
- for an example of performing a scopeProxy leak workaround.
471
- - 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`.
472
-
473
- 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
474
-
475
- ```js
476
- assert(false, X`literal part ${secretData} with ${q(publicData)}.`);
477
- ```
478
-
479
- acts like
480
-
481
- ```js
482
- assert(false, X`literal part ${q(secretData)} with ${q(publicData)}.`);
483
- ```
484
-
485
- Note that the information rendered by the SES shim `console` object always includes all the unredacted data independent of the setting of `errorTaming`.
486
-
487
- # 0.12.3 (2021-03-01)
488
-
489
- - The `assert.js` module in the `ses` package of this repository exports
490
- a `makeAssert` function, to make other `assert` functions with a different
491
- failure scope. Inadvertantly, this did not enable the `@agoric/assert`
492
- package (currently defined in the agoric-sdk repository) to reexport
493
- the same `makeAssert` function as originally intended, and now
494
- [needed](https://github.com/Agoric/agoric-sdk/pull/2515).
495
- As of this release the `assert` object exported by the `assert.js` module
496
- now carries this function as a `makeAssert` property.
497
- - The `assert.quote` function re-exported by `@agoric/assert` as `q`
498
- has always done only a best effort stringify, intended only to
499
- be interpreted by a human under benign conditions. Within that constraint
500
- its best effort is now better, providing informative though ambiguous
501
- renderings of values problematic for `JSON.stringify`, still including
502
- cycles, but now also functions, promises, `undefined`, `NaN`, `Infinity`,
503
- bigints, and symbols. To distinguish this from
504
- strings in the input, these synthesized strings always begin and
505
- end with square brackets. To distinguish those strings from an
506
- input string with square brackets, an input string that starts
507
- with an open square bracket `[` is itself placed in square brackets.
508
- - The `q` function now has an optional second `spaces` parameter which is
509
- passed through to the underlying `JSON.stringfiy`. Passing in a space or
510
- two spaces makes the output much more readable using indentation and other
511
- whitespace, but takes multiple lines.
512
- - The SES enhanced `console` had previously only produced meaningful stack
513
- traces on v8-based browsers such as Brave, Chromium, or Chrome. It now
514
- works on Firefox and Safari as well. It should work on all major browsers
515
- but have not yet been tested on others.
516
- - On all platforms `Error.stackTrace` is now an assignable accessor property.
517
- On v8-based platforms, for the `Error` constructor in the start compartment,
518
- it has the same effect that it does outside SES. Outside the start
519
- compartment, or outside v8-based platforms, the assignment succeeds silently
520
- with no effect.
521
- This accommodates a de facto standard idiom encouraged by Google.
522
- - The "SES Demo Console" and "SES Challenge" have been fixed to work with
523
- modern SES. Both now run in browsers, though these are not yet hosted
524
- for visiting as an external web page.
525
- - We no longer enable overriding `Object.prototype.constructor` by assigning
526
- to the `constructor` property of a derived object. We were enabling it
527
- due to a bug in acorn 7, since fixed in acorn 8. To enable it, we were
528
- making `Object.prototype.constructor` into an accessor property, which
529
- confused the Node debugger, causing annoying extra noise in the console
530
- output. Now that we've worked around our acorn problem (currently with
531
- a patch) we have stopped enabling this assignment, and so stopped
532
- confusing the Node debugger.
533
-
534
- # 0.12.2 (2021-02-05)
535
-
536
- - fix non-standard regex range syntax that throws on XS (3877d72)
537
- - refine concise stack traces (cbbabeb)
538
-
539
- # 0.12.1 (2021-02-02)
540
-
541
- - Consolidated documentation of [`lockdown` options](./lockdown-options.md) into its
542
- own page.
543
- - Added a `stackFiltering` option to `lockdown` with
544
- two settings, `'concise'` and `'verbose'`. Stack traces are now filtered
545
- `'concise'` by default, making them typically much easier to work with.
546
- `'verbose'` shows complete stack traces, as sometimes it contains clues
547
- needed to find your bug.
548
- See [`stackFiltering` options](./lockdown-options.md#stackfiltering-options)
549
- for an explanation.
550
- - Changed the meaning of the default `'moderate'` setting of the
551
- `overrideTaming` options of `lockdown`. See
552
- [`overrideTaming` options](./lockdown-options.md#overridetaming-options)
553
- for an explanation of when to use which.
554
-
555
- :warning: This change of meaning of the `'moderate'` setting of the
556
- `overrideTaming` option of `lockdown` is not strictly compatible with its
557
- old meaning. The old `'moderate`' setting would enable all properties on a few
558
- widely used prototype objects, including `Object.prototype`. Resulting in a
559
- miserable debugging experience when using the VSCode debugger's object
560
- inspector.
561
-
562
- <details>
563
- <summary>Expand to see the vscode inspector display if enabling all of Object.prototype</summary>
564
-
565
- ![vscode inspector display if enabling all of Object.prototype](docs/images/override-taming-star-inspector.png)
566
-
567
- </details>
568
-
569
- The new `'moderate'` setting only tames those properties we know or expect to
570
- be problematic. If you run into an override mistake problem not addressed at
571
- the `'moderate'` setting **_please file an issue._**
572
-
573
- <details>
574
- <summary>Expand for { overrideTaming: 'moderate' } vscode inspector display</summary>
575
-
576
- ![overrideTaming: 'moderate' vscode inspector display](docs/images/override-taming-moderate-inspector.png)
577
-
578
- </details>
579
-
580
- For an even better debugging experience, try the `'min'` setting, which
581
- makes the debugging experience even less noisy, but may not be compatible with
582
- all the code you're running under SES.
583
-
584
- <details>
585
- <summary>Expand for { overrideTaming: 'min' } vscode inspector display</summary>
586
-
587
- ![overrideTaming: 'min' vscode inspector display](docs/images/override-taming-min-inspector.png)
588
-
589
- </details>
590
-
591
- # 0.11.1 (2021-01-21)
592
-
593
- - Upgrades `harden` such that that it transitively freezes an object's
594
- prototype chain, eliminating the notion of a "fringe set" and errors
595
- that were previously thrown if an object's prototype was not already
596
- in the fringe.
597
- - Added an `overrideTaming` option to `lockdown` with two settings,
598
- `'min'` and `'moderate'`. See
599
- [Enabling Override by Assignment](README.md#enabling-override-by-assignment)
600
- for an explanation of when to use which. **_(This documentation has moved
601
- to [`overrideTaming`
602
- options](./lockdown-options.md#overridetaming-options))_**
603
- - Modules and evaluated code that contains the censored substrings
604
- for dynamic eval, dynamic import, and HTML comments will now
605
- throw errors that contain the `sourceURL` from any `//#sourceURL=` comment
606
- toward the end of the source or merely `<unknown>`.
607
-
608
- # 0.11.0 (2020-11-03)
609
-
610
- - `lockdown()` adds new global `assert` and tames the global `console`. The
611
- error taming hides error stacks, accumulating them in side tables. The
612
- `assert` system generated other diagnostic information hidden in side
613
- tables. The tamed console uses these side tables to output more informative
614
- diagnostics. [Logging Errors](./src/error/README.md) explains the design.
615
- - Adds a non-standardizable `__shimTransforms__` option to the
616
- Compartment constructor that allows a single transform to work
617
- for both programs passed to `evaluate` and modules that the SES shim
618
- compiles to programs.
619
-
620
- # 0.10.4 (2020-09-28)
621
-
622
- - When converting each of [these data properties](src/enablements.js) to
623
- accessor properties, to suppress the
624
- [override mistake](https://github.com/tc39/ecma262/pull/1320), we now
625
- add to that accessor's getter an `originalValue` property to mark it
626
- as alleging that it is emulating a data property whose original value
627
- was that value.
628
- - Fixes an exception thrown when calling `lockdown` after just importing
629
- `ses/lockdown` in all environments.
630
-
631
- # 0.10.3 (2020-09-08)
632
-
633
- - The `ses/lockdown` module and Rollup bundles now include a minimal
634
- implementation of `Compartment` that supports `evaluate` but not loading
635
- modules.
636
- This is sufficient for containment of JavaScript programs, including
637
- modules that have been pre-compiled to programs out-of-band, without
638
- entraining a full JavaScript parser framework.
639
- - Allows a compartment's `importHook` to return an "alias" if the returned
640
- static module record has a different specifier than requested.
641
- - Adds the `name` option to the `Compartment` constructor and `name` accessor
642
- to the `Compartment` prototype.
643
- Errors that propagate through the module loader will be rethrown anew with
644
- the name of the module and compartment so they can be traced.
645
- At this time, the intermediate stacks of the causal chain are lost.
646
- https://github.com/Agoric/SES-shim/issues/440
647
-
648
- # 0.10.2 (2020-08-20)
649
-
650
- - Adds a `moduleMapHook` option to the `Compartment` constructor options.
651
- The module map hook can return values for the `moduleMap` for
652
- any given module specifier, or return `undefined` to fall back to the
653
- `importHook`.
654
- This allows for wildcard linkage to other compartments.
655
- - Fix dependency version for `@agoric/transform-module`.
656
-
657
- # 0.10.1 (2020-08-13)
658
-
659
- - Updates the whitelist to allow a `HandledPromise` global, which is provided
660
- by `@agoric/eventual-send`, an early implementation of
661
- https://github.com/tc39/proposal-eventual-send.
662
- - Corrects our fix for the override mistake, so that it correctly emulates
663
- how assignment would work in the absence of the override mistake.
664
- A property created by assignment will now be a writable, enumerable,
665
- configurable data property, as it is for normal assignment.
666
-
667
- # 0.10.0 (2020-08-08)
668
-
669
- - Creates a `ses/lockdown` module that only introduces `lockdown` and `harden`
670
- to global scope, for a much smaller payload than `ses`, which entrains a
671
- JavaScript parser to support ECMAScript modules.
672
- - Adds the `load` method to `Compartment`.
673
- Load allows a bundler or archiver to use the `Compartment` API to gather the
674
- transitive dependencies of modules without executing them.
675
- - Adds support for third-party implementations of a `StaticModuleRecord`
676
- interface (`{imports, execute}`).
677
-
678
- # 0.9.1 (2020-07-16)
679
-
680
- - The `*Locale*` methods removed in the previous release are now restored
681
- by aliasing them to their non-locale equivalents. `localeCompare` had no builtin
682
- non-locale equivalent, so we provide one.
683
- - Adds a TypeScript definition for `harden`.
684
-
685
- # 0.9.0 (2020-07-13)
686
-
687
- - BREAKING CHANGE: The compartment `evaluate` method no longer accepts an
688
- `endowments` option.
689
- Use `compartment.globalThis`, `endowments`, or `globalLexicals`.
690
- If per-evaluation `globalLexicals` or `endowments` are necessary,
691
- each evaluation will need a fresh `Compartment`.
692
- - BREAKING CHANGE: The `lockdown` function's deprecated `noTame*` options have
693
- been removed in favor of the `*Taming` options introduced in version 0.8.0.
694
- - BREAKING CHANGE: The `.toLocale*` methods of
695
- Object/Number/BigInt/Date/String/Array/%TypedArray% were removed from SES
696
- environments. This includes methods named `toLocaleString`,
697
- `toLocaleDateString`, `toLocaleTimeString`, `toLocaleLowerCase`,
698
- `toLocaleUpperCase`, and `localeCompare`. These may be restored (in a
699
- modified form) in a future release.
700
- - The way `lockdown()` tames the `Error` constructor now cooperates
701
- with the V8 stack trace API to a degree that is permissible without
702
- breaking the integrity of applications that use it.
703
- - The Compartment constructor now accepts a `globalLexicals` option.
704
- The own enumerable properties of the global lexicals are captured
705
- and presented as constants in the scope of all calls to `evaluate` and all
706
- modules.
707
- The global lexicals overshadow the global object.
708
-
709
- # 0.8.0 (2020-05-26)
710
-
711
- - Adds support for modules to Compartments.
712
- - SES no longer exports anything.
713
- `Compartment`, `StaticModuleRecord`, `lockdown`, and `harden` are all
714
- introduced as properties of `globalThis`.
715
- - The `Compartment` `global` getter is now named `globalThis`, consistent with
716
- the specification proposal.
717
- - The `Compartment` `transforms` constructor option is now just an array of
718
- transform functions that accept and return program strings.
719
- Transforms can no longer introduce `endowments`.
720
- The compartment constructor's `endowments` argument (first) and assigning
721
- properties to `globalThis` are the remaining supported ways to introduce
722
- endowments.
723
- - Repair `Function.apply` and `TypeError.message` (as well as `.message` on
724
- all the other Error types), to tolerate what the npm `es-abstract` module
725
- does. This allows `tape` (version 4.x) to be loaded in a locked-down SES
726
- world, and also allows its `t.throws` assertion to work. `tape` (version
727
- 5.x) still has problems. [#293]
728
-
729
- - Replaces the old `noTame*` options to `lockdown` with new `*Taming` options.
730
- The old style had boolean values defaulting to `false`. In the new style,
731
- each option supports at least the options `'safe'` and `'unsafe'` defaulting
732
- to `'safe'`. As a transitional matter, this release still supports the
733
- old style as well, as another way to say the same thing. [#326]
734
-
735
- [#293]: https://github.com/Agoric/SES-shim/issues/293
736
- [#326]: https://github.com/Agoric/SES-shim/issues/326
737
-
738
- # 0.7.7 (2020-04-27)
739
-
740
- - This version decouples lockdown and the Compartment constructor.
741
- The Compartment constructor is now exported by `ses` (was previously only
742
- available as a property of `globalThis` _after_ lockdown).
743
- The Compartment constructor will also create "privileged" compartments when
744
- constructed before lockdown.
745
-
746
- # 0.7.6 (2020-03-31)
747
-
748
- Bug fixes.
749
- This release fixes issues in RegExp and Error taming.
750
-
751
- # 0.7.4-5 (2020-03-21)
752
-
753
- This release adds Node.js ESM support by upgrading @agoric/make-hardener to a
754
- hybrid version for most modern module systems.
755
-
756
- - Newless calls to the RegExp constructor now work after lockdown.
757
-
758
- - upgrade @agoric/make-hardener v0.0.8
759
-
760
- # 0.7.2-3 (2020-03-13)
761
-
762
- Bug fixes.
763
- This release addresses an exception observed where locking down fails because
764
- SES cannot delete the prototype of the harden function.
765
- This is addressed by upgrading @agoric/make-harden to version 0.0.7.
766
- This release also restores fulls upport for importing SES as CommonJS, Node.js
767
- ESM, and Node.js emulated ESM with the `esm` package.
768
-
769
- # 0.7.1 (2020-13-10)
770
-
771
- SECURITY UPDATE: This complete re-architecture which removes the realm-shim and
772
- resolve the associatd sandbox escapes related to leaking cross-realm
773
- intrinsics. All users should update to this version.
774
-
775
- See [docs/ses-0.7.md].
776
-
777
- # 0.6.4 (2019-10-16)
778
-
779
- SECURITY UPDATE: This release upgrades realms-shim to fix multiple sandbox
780
- escapes. All users should update to this version.
781
-
782
- - upgrade to realms-shim v1.2.1
783
-
784
- Non-security fixes:
785
-
786
- - improve documentation
787
-
788
- # 0.6.3 (2019-10-02)
789
-
790
- SECURITY UPDATE: This release upgrades realms-shim to fix multiple sandbox
791
- escapes. All users should update to this version.
792
-
793
- - upgrade to realms-shim v1.2.0
794
-
795
- Non-security fixes:
796
-
797
- - add `SES.harden` to make hardening available from within the Realm. (#161)
798
-
799
- # 0.6.2 (2019-09-25)
800
-
801
- No user-visible changes.
802
-
803
- Use realms-shim as a normal package, not a git-submodule. Update eslint
804
- dependencies.
805
-
806
- # 0.6.1 (2019-19-14)
807
-
808
- - SECURITY UPDATE: This release fixes a sandbox escape discovered in the
809
- realms-shim by GitHub user "XmiliaH", which works by causing an infinite
810
- loop and extracting the real function constructor from the RangeError
811
- exception object. See https://github.com/Agoric/realms-shim/issues/48 for
812
- more details.
813
-
814
- # 0.6.0 (2019-09-03)
815
-
816
- - Breaking change: `options.transforms` may no longer specify `endow()`
817
- transforms. Instead, use `rewrite()`, which can now modify endowments.
818
- See https://github.com/Agoric/realms-shim/pull/38 for details.
819
- - Repair the "override mistake", with optional repair plan in
820
- `options.dataPropertiesToRepair`. See src/bundle/dataPropertiesToRepair.js
821
- and https://github.com/Agoric/SES/pull/146 for details.
822
- - `options.sloppyGlobals` is rejected by `makeSESRootRealm()`, since all SES
823
- root realms are frozen. `sloppyGlobals` can only be used in a new
824
- "Compartment", made by calling `Realm.makeCompartment(options)`. See
825
- https://github.com/Agoric/SES/issues/142
826
- https://github.com/Agoric/realms-shim/pull/33
827
- https://github.com/Agoric/realms-shim/pull/30 for details.
828
- - Add `options.whitelist` to override the set of properties that are retained
829
- in the new realm. The default gives you SES, but it could be overridden to
830
- e.g. enforce a Jessie-only environment.
831
-
832
- # 0.5.3 (2019-07-24)
833
-
834
- - Re-enable indirect eval. (#131)
835
-
836
- # 0.5.2 (2019-07-13)
837
-
838
- Dependency updates only, no user-visible changes.
839
-
840
- # 0.5.1 (2019-07-10)
841
-
842
- - The 'realms-shim' module, upon which SES depends, has been split out of the
843
- TC39 'proposal-realms' repository, and now lives in
844
- https://github.com/Agoric/realms-shim. It has not been released to NPM,
845
- rather SES incorporates it as a git submodule. (#110)
846
- - The documentation is now hosted on ReadTheDocs at
847
- https://ses-secure-ecmascript.readthedocs.io/en/latest/ (#111, #117)
848
- - SES.makeRootRealm() now accepts a 'transforms' option. This is a list of `{ endow, rewrite }` functions which can add/modify endowments and/or rewrite
849
- source code each time an `evaluate()` is performed. (#125)
850
-
851
- Thanks to Kate Sills, Dan Connolly, Michael Fig, and the ever-dependable
852
- Dependabot for additional fixes in this release.
853
-
854
- # 0.5.0 (2019-04-05)
855
-
856
- INCOMPATIBLE API CHANGE: Starting with this release, the SES package exports
857
- a single default object (named `SES`, from which you can get the
858
- `SES.makeSESRootRealm()` function). Previously, it exported both a `SES`
859
- object and the `makeSESRootRealm` function.
860
-
861
- Code which uses this package as an ES6 module must change its import from
862
- `import { SES } from 'ses';` to:
863
-
864
- ```js
865
- import SES from 'ses';
866
- ```
867
-
868
- Similarly, for code which uses CommonJS-style, it must change from `const { SES } = require('ses')` to:
869
-
870
- ```js
871
- const SES = require('ses');
872
- ```
873
-
874
- The package now exports bundles in various flavors: CommonJS, ES6 Module, and
875
- browser-based UMD.
876
-
877
- Other changes:
878
-
879
- - whitelist Symbol.matchAll, to fix Chrome-v73 (Issue #90)
880
- - change primary export #88
881
- - improve documentation #66 #67
882
- - add integration tests #85
883
- - packaging: remove ses-shim.js, add other generated bundles
884
- - update Realms shim to commit 0c00eb, to fix Browserify #79
885
- - test against node v10/v11, switch from travis to circleci #73
886
- - fix examples #102
887
-
888
- Thanks to Matt Bell, Kate Sills, and Mark Miller for additional fixes in this
889
- release.
890
-
891
- # 0.4.0 (2019-02-20)
892
-
893
- Improve usability.
894
-
895
- - remove `Nat` and `def` from the global environment #45
896
- - provide a helper function named `s.makeRequire()` to build a `require`
897
- endowment. This can be configured to enable `require('@agoric/nat')` or
898
- `require('@agoric/harden')` (among others), so the same code can work
899
- either inside or outside of a SES realm. For details of its configuration,
900
- see the comments in the commit which landed it. #13
901
- - harden() comes from `@agoric/make-hardener`, which doesn't climb
902
- prototype/inheritance chains, but does complain if the prototype wasn't
903
- already known to harden(). This avoids the "Ice-9" freeze-the-world
904
- problem, and also serves to signal when an object from one realm is passed
905
- into the harden() of a different realm. #15
906
- - harden() now shares a WeakSet of previously-hardened objects #4
907
- - use harden() instead of def() #39
908
- - SES no longer depends upon Nat, but uses it during unit tests. Client code
909
- that wants Nat should use `require('@agoric/nat')`. #45
910
- - Include AsyncIteratorPrototype in the set of anonIntrinsics #58
911
- - use eslint to format all SES code
912
-
913
- # 0.3.0 (2019-02-08)
914
-
915
- Improves security and functionality.
916
-
917
- This fixes all known confinement leaks:
918
-
919
- - We now freeze AsyncGeneratorFunction and AsyncFunction, the last of the
920
- "anonymous" intrinsics (which are reachable by syntax but not simple
921
- property lookup). In the previous release, attacker code could modify their
922
- behavior (which defender code might have been relying upon) or use them as
923
- a communication channel. (#3, #41)
924
- - We now remove all unknown properties from the global object, using a
925
- special list of ones that are safe to expose. This protects us from
926
- surprising platform-specific objects, or newly-added standard JS objects
927
- that have not yet been examined for safety. The 'Intl' object is currently
928
- removed by this check (and `intlMode: "allow"` has been removed), but may
929
- be brought back in a future release. (#26)
930
- - RegExp.prototype.compile is removed unconditionally (even if regexpMode:
931
- "allow" is set), because it violates the semantics of Object.freeze
932
-
933
- It also improves usability:
934
-
935
- - Uncaught exceptions in Node.js are now rendered correctly when the
936
- `errorStackMode: "allow"` option is enabled. In the previous release, such
937
- exceptions were always displayed as "undefined", which was particularly
938
- unhelpful. If your program is abruptly exiting with "undefined", try
939
- turning this option on while you're debugging. But don't leave it on,
940
- because it probably enables a confinement breach.
941
- - SES is an ES6 module, but should now be importable with `require()` by
942
- other code which is unaware of ES6 modules, because it now uses the `esm`
943
- module internally. (#32)
944
- - `console.log` is now available within the confined code, if the
945
- `consoleMode: "allow"` option is enabled. If this is disabled,
946
- `console.log()` will throw a `TypeError` (since `console` is undefined, it
947
- has no `log` property). Many other `console` methods (but not all) are
948
- exposed too. (#35)
949
-
950
- SES now requires Node.js version 10 or later.
951
-
952
- # 0.2.0 (2019-01-18)
953
-
954
- Improves confinement, small API changes.
955
-
956
- The options passed as `SES.makeSESRootRealm(options)` have changed:
957
-
958
- - `options.dateNowMode="allow"` allows `Date.now()` and `new Date()` to
959
- work normally, otherwise they return NaN
960
- - `options.mathRandomMode="allow"` allows `Math.random()` to work
961
- normally (nondeterministically), else it will throw an Error
962
- - `options.intlMode="allow"` lets `Intl.DateTimeFormat()`, `Intl.NumberFormat()`,
963
- and `Intl.getCanonicalLocales()` to work normally, else they throw Errors
964
- - `options.errorStackMode="allow"` exposes `Error.prototype.stack` and
965
- `Error.captureStackTrace` (on platforms that support them), otherwise they
966
- are suppressed. Note that these could be used to break confinement, not
967
- just access nondeterminism.
968
-
969
- Previously the only option honored was `options.dateNowTrap = false`
970
-
971
- The suppression of `Error.captureStackTrace` is new in this release. This
972
- release also suppresses `RegExp.prototype.compile` and properties like
973
- `RegExp.$1` which cause some surprising behavior.
974
-
975
- `SES.def` and `SES.Nat` are exported, so they can be used by non-confined
976
- code (mostly in tests). `def(obj)` makes an object defensive, by freezing
977
- it's external API surface (anything reachable by property lookup and
978
- prototype traversal). `Nat(num)` throws an error unless its argument is a
979
- natural number (a non-negative integer small enough to remain an integer
980
- inside a Javascript `Number` type). Both are important for defensive
981
- programming.
982
-
983
- # 0.1.3 (2018-08-24)
984
-
985
- Adds Nat and SES.confineExpr.
986
-
987
- - `Nat(val)` ensures the value is a natural (non-negative) integer
988
- - `SES.confineExpr(expr)` makes it easy to start with a function object, turn
989
- it into a string, then into a new function inside the SES realm.
990
-
991
- This also updates the challenge page to fix a demo vulnerability (#8).
992
-
993
- # 0.1.2 (2018-07-30)
994
-
995
- - npm name is now 'ses'
996
- - update to current proposal-realms
997
-
998
- # 0.0.1 (2018-07-28)
999
-
1000
- first preliminary release