ses 0.18.7 → 1.0.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 +26 -1
- package/README.md +4 -4
- package/dist/lockdown.cjs +3516 -3332
- package/dist/lockdown.mjs +3516 -3332
- package/dist/lockdown.umd.js +3516 -3332
- package/dist/lockdown.umd.min.js +1 -1
- package/dist/ses.cjs +3516 -3332
- package/dist/ses.mjs +3516 -3332
- package/dist/ses.umd.js +3516 -3332
- package/dist/ses.umd.min.js +1 -1
- package/index.js +3 -31
- package/package.json +12 -7
- package/src/assert-shim.js +4 -0
- package/src/assert-sloppy-mode.js +11 -0
- package/src/compartment-shim.js +11 -288
- package/src/compartment.js +292 -0
- package/src/enablements.js +1 -1
- package/src/error/console.js +4 -0
- package/src/error/internal-types.js +2 -2
- package/src/error/note-log-args.js +2 -3
- package/src/error/tame-console.js +38 -4
- package/src/error/types.js +4 -4
- package/src/get-anonymous-intrinsics.js +1 -1
- package/src/global-object.js +8 -6
- package/src/lockdown-shim.js +19 -379
- package/src/lockdown.js +409 -0
- package/src/make-safe-evaluator.js +2 -2
- package/src/permits.js +14 -5
- package/src/tame-date-constructor.js +37 -21
- package/src/tame-math-object.js +20 -1
- package/types.d.ts +29 -9
package/types.d.ts
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
// version of harden.
|
|
20
20
|
export type Harden = <T>(value: T) => T; // not Hardened<T>;
|
|
21
21
|
|
|
22
|
-
export interface
|
|
22
|
+
export interface RepairOptions {
|
|
23
23
|
regExpTaming?: 'safe' | 'unsafe';
|
|
24
24
|
localeTaming?: 'safe' | 'unsafe';
|
|
25
25
|
consoleTaming?: 'safe' | 'unsafe';
|
|
@@ -36,6 +36,11 @@ export interface LockdownOptions {
|
|
|
36
36
|
__hardenTaming__?: 'safe' | 'unsafe';
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
// Deprecated in favor of the more specific RepairOptions
|
|
40
|
+
export type LockdownOptions = RepairOptions;
|
|
41
|
+
|
|
42
|
+
export type RepairIntrinsics = (options?: LockdownOptions) => void;
|
|
43
|
+
export type HardenIntrinsics = () => void;
|
|
39
44
|
export type Lockdown = (options?: LockdownOptions) => void;
|
|
40
45
|
|
|
41
46
|
export type __LiveExportMap__ = Record<string, [string, boolean]>;
|
|
@@ -53,8 +58,11 @@ export interface PrecompiledStaticModuleInterface {
|
|
|
53
58
|
export interface ThirdPartyStaticModuleInterface {
|
|
54
59
|
imports: Array<string>;
|
|
55
60
|
exports: Array<string>;
|
|
61
|
+
/**
|
|
62
|
+
* Note that this value does _not_ contain any numeric or symbol property keys, which can theoretically be members of `exports` in a CommonJS module.
|
|
63
|
+
*/
|
|
56
64
|
execute(
|
|
57
|
-
proxiedExports:
|
|
65
|
+
proxiedExports: Record<string, any>,
|
|
58
66
|
compartment: Compartment,
|
|
59
67
|
resolvedImports: Record<string, string>,
|
|
60
68
|
): void;
|
|
@@ -172,19 +180,13 @@ export type Raise = (reason: Error) => void;
|
|
|
172
180
|
// eslint-disable-next-line no-use-before-define
|
|
173
181
|
export type MakeAssert = (raise?: Raise, unredacted?: boolean) => Assert;
|
|
174
182
|
|
|
175
|
-
export interface
|
|
183
|
+
export interface AssertionFunctions {
|
|
176
184
|
(
|
|
177
185
|
value: any,
|
|
178
186
|
details?: Details,
|
|
179
187
|
errorConstructor?: ErrorConstructor,
|
|
180
188
|
): asserts value;
|
|
181
189
|
typeof: AssertTypeof;
|
|
182
|
-
error(
|
|
183
|
-
details?: Details,
|
|
184
|
-
errorConstructor?: ErrorConstructor,
|
|
185
|
-
options?: AssertMakeErrorOptions,
|
|
186
|
-
): Error;
|
|
187
|
-
fail(details?: Details, errorConstructor?: ErrorConstructor): never;
|
|
188
190
|
equal(
|
|
189
191
|
left: any,
|
|
190
192
|
right: any,
|
|
@@ -192,6 +194,15 @@ export interface Assert {
|
|
|
192
194
|
errorConstructor?: ErrorConstructor,
|
|
193
195
|
): void;
|
|
194
196
|
string(specimen: any, details?: Details): asserts specimen is string;
|
|
197
|
+
fail(details?: Details, errorConstructor?: ErrorConstructor): never;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface AssertionUtilities {
|
|
201
|
+
error(
|
|
202
|
+
details?: Details,
|
|
203
|
+
errorConstructor?: ErrorConstructor,
|
|
204
|
+
options?: AssertMakeErrorOptions,
|
|
205
|
+
): Error;
|
|
195
206
|
note(error: Error, details: Details): void;
|
|
196
207
|
details(
|
|
197
208
|
template: TemplateStringsArray | string[],
|
|
@@ -200,9 +211,16 @@ export interface Assert {
|
|
|
200
211
|
Fail(template: TemplateStringsArray | string[], ...args: any): never;
|
|
201
212
|
quote(payload: any, spaces?: string | number): ToStringable;
|
|
202
213
|
bare(payload: any, spaces?: string | number): ToStringable;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export interface DeprecatedAssertionUtilities {
|
|
203
217
|
makeAssert: MakeAssert;
|
|
204
218
|
}
|
|
205
219
|
|
|
220
|
+
export type Assert = AssertionFunctions &
|
|
221
|
+
AssertionUtilities &
|
|
222
|
+
DeprecatedAssertionUtilities;
|
|
223
|
+
|
|
206
224
|
interface CompartmentEvaluateOptions {
|
|
207
225
|
sloppyGlobalsMode?: boolean;
|
|
208
226
|
__moduleShimLexicals__?: Object;
|
|
@@ -214,6 +232,8 @@ interface CompartmentEvaluateOptions {
|
|
|
214
232
|
declare global {
|
|
215
233
|
var harden: Harden;
|
|
216
234
|
|
|
235
|
+
var repairIntrinsics: RepairIntrinsics;
|
|
236
|
+
var hardenIntrinsics: HardenIntrinsics;
|
|
217
237
|
var lockdown: Lockdown;
|
|
218
238
|
|
|
219
239
|
var assert: Assert;
|