ses 1.9.1 → 1.11.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/README.md +2 -0
- package/dist/lockdown.cjs +947 -490
- package/dist/lockdown.mjs +947 -490
- package/dist/lockdown.umd.js +947 -490
- package/dist/lockdown.umd.min.js +1 -1
- package/dist/ses.cjs +947 -490
- package/dist/ses.mjs +947 -490
- package/dist/ses.umd.js +947 -490
- package/dist/ses.umd.min.js +1 -1
- package/dist/types.d.cts +12 -5
- package/package.json +18 -11
- package/src/cauterize-property.js +69 -0
- package/src/commons.js +18 -16
- package/src/compartment-shim.js +10 -1
- package/src/compartment.js +89 -7
- package/src/enable-property-overrides.js +6 -3
- package/src/enablements.js +1 -1
- package/src/error/README.md +2 -2
- package/src/error/console.js +46 -37
- package/src/error/internal-types.js +1 -1
- package/src/error/tame-v8-error-constructor.js +3 -3
- package/src/global-object.js +5 -2
- package/src/intrinsics.js +27 -9
- package/src/lockdown.js +52 -14
- package/src/make-safe-evaluator.js +8 -6
- package/src/module-instance.js +14 -1
- package/src/module-link.js +6 -8
- package/src/module-load.js +17 -6
- package/src/permits-intrinsics.js +19 -62
- package/src/permits.js +104 -22
- package/src/reporting-types.d.ts +13 -0
- package/src/reporting.js +108 -0
- package/src/sloppy-globals-scope-terminator.js +9 -2
- package/src/strict-scope-terminator.js +10 -3
- package/src/tame-date-constructor.js +1 -4
- package/src/tame-math-object.js +1 -4
- package/src/tame-symbol-constructor.js +2 -2
- package/src/transforms.js +2 -1
- package/types.d.ts +12 -5
|
@@ -7,12 +7,19 @@ import {
|
|
|
7
7
|
freeze,
|
|
8
8
|
getOwnPropertyDescriptors,
|
|
9
9
|
globalThis,
|
|
10
|
-
immutableObject,
|
|
11
10
|
} from './commons.js';
|
|
12
11
|
import { assert } from './error/assert.js';
|
|
13
12
|
|
|
14
13
|
const { Fail, quote: q } = assert;
|
|
15
14
|
|
|
15
|
+
/**
|
|
16
|
+
* `freeze` but not `harden` the proxy target so it remains trapping.
|
|
17
|
+
* Thus, it should not be shared outside this module.
|
|
18
|
+
*
|
|
19
|
+
* @see https://github.com/endojs/endo/blob/master/packages/ses/docs/preparing-for-stabilize.md
|
|
20
|
+
*/
|
|
21
|
+
const objTarget = freeze({ __proto__: null });
|
|
22
|
+
|
|
16
23
|
/**
|
|
17
24
|
* alwaysThrowHandler
|
|
18
25
|
* This is an object that throws if any property is called. It's used as
|
|
@@ -21,7 +28,7 @@ const { Fail, quote: q } = assert;
|
|
|
21
28
|
* create one and share it between all Proxy handlers.
|
|
22
29
|
*/
|
|
23
30
|
export const alwaysThrowHandler = new Proxy(
|
|
24
|
-
|
|
31
|
+
objTarget,
|
|
25
32
|
freeze({
|
|
26
33
|
get(_shadow, prop) {
|
|
27
34
|
Fail`Please report unexpected scope handler trap: ${q(String(prop))}`;
|
|
@@ -88,6 +95,6 @@ export const strictScopeTerminatorHandler = freeze(
|
|
|
88
95
|
);
|
|
89
96
|
|
|
90
97
|
export const strictScopeTerminator = new Proxy(
|
|
91
|
-
|
|
98
|
+
objTarget,
|
|
92
99
|
strictScopeTerminatorHandler,
|
|
93
100
|
);
|
|
@@ -8,10 +8,7 @@ import {
|
|
|
8
8
|
defineProperties,
|
|
9
9
|
} from './commons.js';
|
|
10
10
|
|
|
11
|
-
export default function tameDateConstructor(
|
|
12
|
-
if (dateTaming !== 'safe' && dateTaming !== 'unsafe') {
|
|
13
|
-
throw TypeError(`unrecognized dateTaming ${dateTaming}`);
|
|
14
|
-
}
|
|
11
|
+
export default function tameDateConstructor() {
|
|
15
12
|
const OriginalDate = Date;
|
|
16
13
|
const DatePrototype = OriginalDate.prototype;
|
|
17
14
|
|
package/src/tame-math-object.js
CHANGED
|
@@ -6,10 +6,7 @@ import {
|
|
|
6
6
|
objectPrototype,
|
|
7
7
|
} from './commons.js';
|
|
8
8
|
|
|
9
|
-
export default function tameMathObject(
|
|
10
|
-
if (mathTaming !== 'safe' && mathTaming !== 'unsafe') {
|
|
11
|
-
throw TypeError(`unrecognized mathTaming ${mathTaming}`);
|
|
12
|
-
}
|
|
9
|
+
export default function tameMathObject() {
|
|
13
10
|
const originalMath = Math;
|
|
14
11
|
const initialMath = originalMath; // to follow the naming pattern
|
|
15
12
|
|
|
@@ -16,8 +16,8 @@ import {
|
|
|
16
16
|
* `Symbol` constructor on constructed compartments.
|
|
17
17
|
*
|
|
18
18
|
* Starting these properties as configurable assumes two succeeding phases of
|
|
19
|
-
* processing: A
|
|
20
|
-
* removes all properties not on the
|
|
19
|
+
* processing: A permit enforcement phase, that
|
|
20
|
+
* removes all properties not on the permits (which requires them to be
|
|
21
21
|
* configurable) and a global hardening step that freezes all primordials,
|
|
22
22
|
* returning these properties to their expected non-configurable status.
|
|
23
23
|
*
|
package/src/transforms.js
CHANGED
|
@@ -248,7 +248,8 @@ export const mandatoryTransforms = source => {
|
|
|
248
248
|
* @returns {string}
|
|
249
249
|
*/
|
|
250
250
|
export const applyTransforms = (source, transforms) => {
|
|
251
|
-
for (
|
|
251
|
+
for (let i = 0, l = transforms.length; i < l; i += 1) {
|
|
252
|
+
const transform = transforms[i];
|
|
252
253
|
source = transform(source);
|
|
253
254
|
}
|
|
254
255
|
return source;
|
package/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @
|
|
2
|
+
* @module Types of the SES environment
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
/* eslint-disable no-restricted-globals, vars-on-top, no-var */
|
|
@@ -24,10 +24,17 @@ export interface RepairOptions {
|
|
|
24
24
|
localeTaming?: 'safe' | 'unsafe';
|
|
25
25
|
consoleTaming?: 'safe' | 'unsafe';
|
|
26
26
|
errorTrapping?: 'platform' | 'exit' | 'abort' | 'report' | 'none';
|
|
27
|
+
reporting?: 'platform' | 'console' | 'none';
|
|
27
28
|
unhandledRejectionTrapping?: 'report' | 'none';
|
|
28
29
|
errorTaming?: 'safe' | 'unsafe' | 'unsafe-debug';
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated Deprecated and does nothing. In the future specifying it will be an error.
|
|
32
|
+
*/
|
|
33
|
+
dateTaming?: 'safe' | 'unsafe';
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated Deprecated and does nothing. In the future specifying it will be an error.
|
|
36
|
+
*/
|
|
37
|
+
mathTaming?: 'safe' | 'unsafe';
|
|
31
38
|
evalTaming?: 'safeEval' | 'unsafeEval' | 'noEval';
|
|
32
39
|
stackFiltering?: 'concise' | 'verbose';
|
|
33
40
|
overrideTaming?: 'moderate' | 'min' | 'severe';
|
|
@@ -551,12 +558,12 @@ declare global {
|
|
|
551
558
|
|
|
552
559
|
// Deprecated:
|
|
553
560
|
constructor(
|
|
554
|
-
globals?: Record<
|
|
561
|
+
globals?: Record<PropertyKey, any> | undefined,
|
|
555
562
|
modules?: Record<string, ModuleDescriptor>,
|
|
556
563
|
options?: CompartmentOptions,
|
|
557
564
|
);
|
|
558
565
|
|
|
559
|
-
get globalThis(): Record<
|
|
566
|
+
get globalThis(): Record<PropertyKey, any>;
|
|
560
567
|
|
|
561
568
|
get name(): string;
|
|
562
569
|
|