ses 0.15.3 → 0.15.7
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 +44 -0
- package/NEWS.md +7 -0
- package/README.md +204 -10
- package/SECURITY.md +28 -15
- package/dist/lockdown.cjs +73 -7
- package/dist/lockdown.mjs +73 -7
- package/dist/lockdown.umd.js +73 -7
- package/dist/lockdown.umd.min.js +1 -1
- package/dist/ses.cjs +73 -7
- package/dist/ses.mjs +73 -7
- package/dist/ses.umd.js +73 -7
- package/dist/ses.umd.min.js +1 -1
- package/index.d.ts +113 -37
- package/package.json +8 -9
- package/src/commons.js +1 -0
- package/src/error/tame-console.js +5 -1
- package/src/lockdown-shim.js +42 -1
- package/src/tame-locale-methods.js +12 -0
- package/src/whitelist.js +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,50 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
### [0.15.7](https://github.com/endojs/endo/compare/ses@0.15.6...ses@0.15.7) (2022-01-31)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **ses:** Globals have vars, not consts ([#1027](https://github.com/endojs/endo/issues/1027)) ([157669f](https://github.com/endojs/endo/commit/157669f0b669332f703747e36dd867bf6a823e59))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### [0.15.6](https://github.com/endojs/endo/compare/ses@0.15.5...ses@0.15.6) (2022-01-27)
|
|
16
|
+
|
|
17
|
+
**Note:** Version bump only for package ses
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### [0.15.5](https://github.com/endojs/endo/compare/ses@0.15.4...ses@0.15.5) (2022-01-25)
|
|
24
|
+
|
|
25
|
+
**Note:** Version bump only for package ses
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### [0.15.4](https://github.com/endojs/endo/compare/ses@0.15.3...ses@0.15.4) (2022-01-23)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Features
|
|
35
|
+
|
|
36
|
+
* **ses:** Check early for dynamic evalability ([d0f6f09](https://github.com/endojs/endo/commit/d0f6f099d41edee3f484da5d5094848f72f93084)), closes [#343](https://github.com/endojs/endo/issues/343)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Bug Fixes
|
|
40
|
+
|
|
41
|
+
* **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))
|
|
42
|
+
* **ses:** Fix mistaken this binding example ([#990](https://github.com/endojs/endo/issues/990)) ([71db876](https://github.com/endojs/endo/commit/71db876ee3d7557f0f19dd995a4e027cc7945c2b))
|
|
43
|
+
* minor wording ([#989](https://github.com/endojs/endo/issues/989)) ([f8d6ff6](https://github.com/endojs/endo/commit/f8d6ff6c63b0c46bcaf93378b61d7286d971fd5f))
|
|
44
|
+
* **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)
|
|
45
|
+
* **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)
|
|
46
|
+
* **ses:** Remove superfluous error cause on prototypes ([#955](https://github.com/endojs/endo/issues/955)) ([6e50c45](https://github.com/endojs/endo/commit/6e50c4526f457b31e00a783406d175b0088907eb))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
6
50
|
### [0.15.3](https://github.com/endojs/endo/compare/ses@0.15.2...ses@0.15.3) (2021-12-14)
|
|
7
51
|
|
|
8
52
|
**Note:** Version bump only for package ses
|
package/NEWS.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
User-visible changes in SES:
|
|
2
2
|
|
|
3
|
+
# v0.15.3 (2022-01-21)
|
|
4
|
+
|
|
5
|
+
- Fixes the type definition for assert.error so that the final options bag,
|
|
6
|
+
which may include `errorName`, checks correctly in TypeScript.
|
|
7
|
+
- Lockdown will now throw an error if code running before SES initialization
|
|
8
|
+
replaced `eval`.
|
|
9
|
+
|
|
3
10
|
# 0.15.2 (2021-12-08)
|
|
4
11
|
|
|
5
12
|
- The `Removing...` messages that Lockdown emits when encountering unrecognized
|
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ Most existing JavaScript libraries can run on hardened JavaScript.
|
|
|
13
13
|
other. By sharing the intrinsics, programs from separate compartments
|
|
14
14
|
can recognize each other's arrays, data objects, and so on.
|
|
15
15
|
* **Strict mode** SES enforces JavaScript strict mode that enhances security,
|
|
16
|
-
for example by changing some silent
|
|
16
|
+
for example by changing some silent failures into thrown errors.
|
|
17
17
|
* **POLA** (Principle of Least Authority) By default, Compartments receive no
|
|
18
18
|
ambient authority. They are created without host-provided APIs, (for example
|
|
19
19
|
no `fetch`). Compartments can be selectively endowed with powerful arguments,
|
|
@@ -28,10 +28,9 @@ See https://github.com/Agoric/Jessie to see how SES fits into the various
|
|
|
28
28
|
flavors of confined JavaScript execution. And visit
|
|
29
29
|
https://ses-demo.agoric.app/demos/ for a demo.
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
known security holes that need to be closed.
|
|
31
|
+
SES starts where the Caja project left off
|
|
32
|
+
https://github.com/google/caja/wiki/SES, and goes on to introduce compartments
|
|
33
|
+
and modernize the permitted JavaScript features.
|
|
35
34
|
|
|
36
35
|
## Install
|
|
37
36
|
|
|
@@ -94,7 +93,7 @@ Lockdown does not erase any powerful objects from the initial global scope.
|
|
|
94
93
|
Instead, **Compartments** give complete control over what powerful objects
|
|
95
94
|
exist for client code.
|
|
96
95
|
|
|
97
|
-
See [`lockdown` options](
|
|
96
|
+
See [`lockdown` options](docs/lockdown.md) for configuration options to
|
|
98
97
|
`lockdown`. However, all of these have sensible defaults that should
|
|
99
98
|
work for most projects out of the box.
|
|
100
99
|
|
|
@@ -213,9 +212,15 @@ For example, the `Function` constructor in one compartment creates functions
|
|
|
213
212
|
that evaluate in the global scope of that compartment.
|
|
214
213
|
|
|
215
214
|
```js
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
// true
|
|
215
|
+
const c1 = new Compartment();
|
|
216
|
+
const f1 = new c.globalThis.Function('return globalThis');
|
|
217
|
+
f1() === c1.globalThis; // true
|
|
218
|
+
|
|
219
|
+
const c2 = new Compartment();
|
|
220
|
+
const f2 = new c.globalThis.Function('return globalThis');
|
|
221
|
+
f2() === c2.globalThis; // true
|
|
222
|
+
|
|
223
|
+
f1() === f2(); // false
|
|
219
224
|
```
|
|
220
225
|
|
|
221
226
|
Lockdown prepares for compartments with separate globals by freezing
|
|
@@ -247,7 +252,7 @@ The `importHook` accepts a full specifier and asynchronously returns a
|
|
|
247
252
|
|
|
248
253
|
```js
|
|
249
254
|
import 'ses';
|
|
250
|
-
import { StaticModuleRecord } from '@endo/static-module-record
|
|
255
|
+
import { StaticModuleRecord } from '@endo/static-module-record';
|
|
251
256
|
|
|
252
257
|
const c1 = new Compartment({}, {}, {
|
|
253
258
|
name: "first compartment",
|
|
@@ -503,6 +508,195 @@ system generated other diagnostic information hidden in side tables. The tamed
|
|
|
503
508
|
console uses these side tables to output more informative diagnostics.
|
|
504
509
|
[Logging Errors](./src/error/README.md) explains the design.
|
|
505
510
|
|
|
511
|
+
## Security claims and caveats
|
|
512
|
+
|
|
513
|
+
The `ses` shim concerns boundaries between programs in the same process and
|
|
514
|
+
JavaScript realm.
|
|
515
|
+
In terms of the [Taxonomy of Security Issues](https://agoric.com/blog/all/taxonomy-of-security-issues/),
|
|
516
|
+
the `ses` shim creates a boundary that is finer than an operating system
|
|
517
|
+
process or thread and facilitates boundaries as fine as individual objects.
|
|
518
|
+
While `ses` can interpose at granularities where process isolation is not a
|
|
519
|
+
viable boundary, as between an application and its dependencies or between a
|
|
520
|
+
platform and a plugin, `ses` combines well with coarser boundaries for defense
|
|
521
|
+
in depth.
|
|
522
|
+
|
|
523
|
+
For the purposes of these claims and caveats, a "host program" is a program
|
|
524
|
+
that arranges `ses`, calls `lockdown`, and orchestrates one or more "guest
|
|
525
|
+
programs", providing limited access to its resources.
|
|
526
|
+
|
|
527
|
+
Provided that the `ses` implementation and its trusted compute base are
|
|
528
|
+
correct, we claim that a host program (Figure 1) can evaluate a guest program
|
|
529
|
+
(`program`) in a compartment after `lockdown` and that the program:
|
|
530
|
+
|
|
531
|
+
- will initially only have access to one mutable object, the compartment's
|
|
532
|
+
`globalThis`,
|
|
533
|
+
- specifically cannot modify any shared primordial objects, which are part of
|
|
534
|
+
the default execution environment,
|
|
535
|
+
- cannot initially perform any I/O (except I/O necessarily performed by the
|
|
536
|
+
trusted compute base like paging virtual memory),
|
|
537
|
+
- and specifically cannot measure the passage of time at any resolution.
|
|
538
|
+
|
|
539
|
+
However, such a program can:
|
|
540
|
+
|
|
541
|
+
- execute for an indefinite amount of time,
|
|
542
|
+
- allocate arbitrary amounts of memory,
|
|
543
|
+
- detect the platform endianness,
|
|
544
|
+
- in some JavaScript engines, observe the contents of the stack.
|
|
545
|
+
This may include sensitive information about the layout of files on the host
|
|
546
|
+
disk.
|
|
547
|
+
In cases where the stack is data-dependent, a guest can infer the data.
|
|
548
|
+
`ses` occludes the stack on V8 and SpiderMonkey, but cannot on
|
|
549
|
+
JavaScriptCore.
|
|
550
|
+
|
|
551
|
+
```js
|
|
552
|
+
// Claims, Figure 1
|
|
553
|
+
lockdown();
|
|
554
|
+
const compartment = new Compartment();
|
|
555
|
+
compartment.evaluate(program);
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
If the host program (Figure 2) arranges for the compartment's `globalThis` to
|
|
559
|
+
be frozen, we additionally claim that the host can evaluate any two guest
|
|
560
|
+
programs (`program1` and `program2`) such that neither program will:
|
|
561
|
+
|
|
562
|
+
- initially share *any* mutable objects.
|
|
563
|
+
- be able to observe the relative passage of time of the other program,
|
|
564
|
+
as they would had they been given a reference to a working `Date.now()`.
|
|
565
|
+
- be able to communicate, as they would if they had shared access to mutable
|
|
566
|
+
state like an unfrozen object, a hardened collection like a `Map`, or even
|
|
567
|
+
`Math.random()`.
|
|
568
|
+
|
|
569
|
+
```js
|
|
570
|
+
// Claims, Figure 2
|
|
571
|
+
lockdown();
|
|
572
|
+
const compartment = new Compartment();
|
|
573
|
+
harden(compartment.globaThis);
|
|
574
|
+
compartment.evaluate(program1);
|
|
575
|
+
compartment.evaluate(program2);
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
However such programs (`program`, `program1`, or `program2`) are only
|
|
579
|
+
as useful as a calculator.
|
|
580
|
+
A host program is therefore responsible for maintaining any of the desired
|
|
581
|
+
invariants above when "endowing" a compartment with any of its own objects.
|
|
582
|
+
|
|
583
|
+
For example, a host program (Figure 3) may run two programs in separate
|
|
584
|
+
compartments, giving one program the ability to resolve a promise and the other
|
|
585
|
+
program the ability to observe the settlement (fulfillment or rejection) of
|
|
586
|
+
that promise.
|
|
587
|
+
The host program is responsible for hardening these objects.
|
|
588
|
+
|
|
589
|
+
```js
|
|
590
|
+
// Claims, Figure 2
|
|
591
|
+
lockdown();
|
|
592
|
+
|
|
593
|
+
const promise = new Promise(resolve => {
|
|
594
|
+
const compartmentA = new Compartment(harden({
|
|
595
|
+
resolve,
|
|
596
|
+
}));
|
|
597
|
+
compartment.evaluate(programA);
|
|
598
|
+
});
|
|
599
|
+
|
|
600
|
+
const compartmentB = new Compartment(harden({
|
|
601
|
+
promise,
|
|
602
|
+
}));
|
|
603
|
+
compartmentB.evaluate(programB);
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
With `ses`, guest programs are initially powerless.
|
|
607
|
+
A host can explicitly share limited powers with guest programs
|
|
608
|
+
and provide intentional communication channels between them.
|
|
609
|
+
|
|
610
|
+
Host programs must maintain the `ses` boundary with care in what they present
|
|
611
|
+
as endowments.
|
|
612
|
+
A host program should take care not to share mutable state with guests,
|
|
613
|
+
or distribute mutable state to multiple guests, such as an unfrozen object (use
|
|
614
|
+
`harden`), direct read and write access to a collection, like a `Map` or `Set`,
|
|
615
|
+
even if hardened.
|
|
616
|
+
Furthermore, typed arrays are collections and cannot be hardened.
|
|
617
|
+
|
|
618
|
+
For the purposes of sharing state, pseudo-random number generators (PRNG) like
|
|
619
|
+
`Math.random()` are equivalent to read and write access to shared state, and
|
|
620
|
+
any guest can use one to eavesdrop on other guests or the host that share one.
|
|
621
|
+
|
|
622
|
+
If a guest program needs a high resolution timer to function, the host should
|
|
623
|
+
only invite one guest to a single operating system process and limit the
|
|
624
|
+
activity of the host program in the same process.
|
|
625
|
+
|
|
626
|
+
Hosts must avoid exposing `SharedArrayBuffer` to guests.
|
|
627
|
+
Any two JavaScript programs sharing a `SharedArrayBuffer` can use the shared
|
|
628
|
+
buffer to construct a high resolution timer.
|
|
629
|
+
|
|
630
|
+
The `ses` shim does not in itself isolate the stack of guest programs, even
|
|
631
|
+
when evaluated in separate compartments.
|
|
632
|
+
This is relevant when program created objects are shared between guest
|
|
633
|
+
programs.
|
|
634
|
+
|
|
635
|
+
When a program interacts with an object introduced by another program (as
|
|
636
|
+
through the per-compartment `globalThis`, function arguments or returned
|
|
637
|
+
values), there are potential risks due to the synchronous nature of object
|
|
638
|
+
access.
|
|
639
|
+
Even interactions that are not explicit function calls may cause code from
|
|
640
|
+
another program, like property accessors or proxy traps, to execute on the same
|
|
641
|
+
stack, which may be able to call back into the program (reentrancy), throw, or
|
|
642
|
+
detect the current stack height.
|
|
643
|
+
|
|
644
|
+
A host object can defend itself from reentrancy attacks by ensuring that it
|
|
645
|
+
interacts with guest objects on a clean stack through the use of promises.
|
|
646
|
+
|
|
647
|
+
Within these constraints, a host program can provide objects that grant limited
|
|
648
|
+
I/O capabilities to guest programs, and even revoke or suspend those
|
|
649
|
+
capabilities at runtime.
|
|
650
|
+
|
|
651
|
+
The trusted compute base (TCB) for `ses` includes:
|
|
652
|
+
|
|
653
|
+
- the host hardware,
|
|
654
|
+
- the host operating system,
|
|
655
|
+
- any intermediate virtual operating systems or hypervisors,
|
|
656
|
+
- the process memory manager,
|
|
657
|
+
- an implementation of JavaScript conforming to ECMAScript 262 as of
|
|
658
|
+
2021, providing no unspecified embedding host behavior like the introduction of syntax
|
|
659
|
+
that when evaluated reveals a mutable object.
|
|
660
|
+
`ses` accounts for one such host behavior provided by Node.js, namely the `domain`
|
|
661
|
+
property on promises, by preventing the use of `ses` in concert with the
|
|
662
|
+
`domain` module.
|
|
663
|
+
- Also, any attached debugger, and
|
|
664
|
+
- any JavaScript that has executed in the same realm before the host program calls
|
|
665
|
+
`lockdown`, including JavaScript that executes after `ses` initializes.
|
|
666
|
+
|
|
667
|
+
## Audits
|
|
668
|
+
|
|
669
|
+
In June 2021, `ses` underwent formal third party vulnerability assessment over a
|
|
670
|
+
period of 4 weeks with 3 engineers and a dedicated project manager that
|
|
671
|
+
surfaced no unknown security issues or vulnerabilities within the code. As a
|
|
672
|
+
result of this assessment, [a single code change was
|
|
673
|
+
made](https://github.com/endojs/endo/issues/126) to set a flag to disable the
|
|
674
|
+
domain module in Node.js to mitigate a known issue identified in the code. The
|
|
675
|
+
code will be the subject of another round of intense application security
|
|
676
|
+
review mid-2022 by a reputable application security firm renowned for their
|
|
677
|
+
results in security reviews.
|
|
678
|
+
|
|
679
|
+
In July 2021, `ses` was the target of an intensive collaborative bug hunt lead by
|
|
680
|
+
the MetaMask team.
|
|
681
|
+
No critical flaws in the code surfaced during the review.
|
|
682
|
+
As a result of the search for flaws, deficiencies, and weaknesses in the code
|
|
683
|
+
(which is currently a Stage 1 proposal with the ECMA TC39 committee), a series
|
|
684
|
+
of small code changes and documentation improvements were made. There is a
|
|
685
|
+
report available on the
|
|
686
|
+
[Agoric blog](https://agoric.com/blog/technology/metamask-agoric-hardened-js-security-review/)
|
|
687
|
+
that includes links to recordings of code walk-throughs and technical
|
|
688
|
+
discussion, and issues are tagged
|
|
689
|
+
[audit-SEStival](https://github.com/endojs/endo/labels/audit-sestival).
|
|
690
|
+
|
|
691
|
+
In addition to vulnerability assessments, active efforts to [formally verify
|
|
692
|
+
the Agoric kernel](https://agoric.com/blog/technology/the-path-to-verified-blds-how-informal-systems-and-agoric-are-using-formal-methods-analysis-to-improve-software-integrity/)
|
|
693
|
+
have found the object capability model that `ses` provides to be sound.
|
|
694
|
+
|
|
695
|
+
Hardened JavaScript is also within the scope of the [Agoric bug bounty
|
|
696
|
+
program](hackerone.com/agoric), which rewards researchers for surfacing valid
|
|
697
|
+
bugs in our code. We welcome the opportunity to cooperate with researchers,
|
|
698
|
+
whose efforts will undoubtedly yield stronger, more resilient code.
|
|
699
|
+
|
|
506
700
|
## Bug Disclosure
|
|
507
701
|
|
|
508
702
|
Please help us practice coordinated security bug disclosure, by using the
|
package/SECURITY.md
CHANGED
|
@@ -2,24 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
## Supported Versions
|
|
4
4
|
|
|
5
|
-
The SES package
|
|
5
|
+
The SES package and associated Endo packages are still undergoing development and security review, and all
|
|
6
6
|
users are encouraged to use the latest version available. Security fixes will
|
|
7
7
|
be made for the most recent branch only.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
| ------- | ------------------ |
|
|
11
|
-
| 0.12.x | :white_check_mark: |
|
|
9
|
+
## Coordinated Vulnerability Disclosure of Security Bugs
|
|
12
10
|
|
|
13
|
-
|
|
11
|
+
SES stands for fearless cooperation, and strong security requires strong collaboration with security researchers. If you believe that you have found a security sensitive bug that should not be disclosed until a fix has been made available, we encourage you to report it. To report a bug in HardenedJS, you have several options that include:
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
security-sensitive bug that should not be revealed publically until a fix is
|
|
17
|
-
available, please send email to `security` at (@) `agoric.com`. To encrypt,
|
|
18
|
-
please use my (@warner) personal GPG key [A476E2E6 11880C98 5B3C3A39 0386E81B
|
|
19
|
-
11CAA07A](http://www.lothar.com/warner-gpg.html) . Keybase users can also
|
|
20
|
-
send messages to `@agoric_security`, or share code and other log files via
|
|
21
|
-
the Keybase encrypted file system
|
|
22
|
-
(`/keybase/private/agoric_security,$YOURNAME`).
|
|
13
|
+
* Reporting the issue to the [Agoric HackerOne vulnerability rewards program](hackerone.com/agoric).
|
|
23
14
|
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
* Sending an email to security at (@) agoric.com., encrypted or unencrypted. To encrypt, please use @Warner’s personal GPG key [A476E2E6 11880C98 5B3C3A39 0386E81B 11CAA07A](http://www.lothar.com/warner-gpg.html) .
|
|
16
|
+
|
|
17
|
+
* Sending a message on Keybase to `@agoric_security`, or sharing code and other log files via Keybase’s encrypted file system. ((_keybase_private/agoric_security,$YOURNAME).
|
|
18
|
+
|
|
19
|
+
* It is important to be able to provide steps that reproduce the issue and demonstrate its impact with a Proof of Concept example in an initial bug report. Before reporting a bug, a reporter may want to have another trusted individual reproduce the issue.
|
|
20
|
+
|
|
21
|
+
* A bug reporter can expect acknowledgment of a potential vulnerability reported through [security@agoric.com](mailto:security@agoric.com) within one business day of submitting a report. If an acknowledgement of an issue is not received within this time frame, especially during a weekend or holiday period, please reach out again. Any issues reported to the HackerOne program will be acknowledged within the time frames posted on the program page.
|
|
22
|
+
* The bug triage team and Agoric code maintainers are primarily located in the San Francisco Bay Area with business hours in [Pacific Time](https://www.timeanddate.com/worldclock/usa/san-francisco) .
|
|
23
|
+
|
|
24
|
+
* For the safety and security of those who depend on the code, bug reporters should avoid publicly sharing the details of a security bug on Twitter, Discord, Telegram, or in public Github issues during the coordination process.
|
|
25
|
+
|
|
26
|
+
* Once a vulnerability report has been received and triaged:
|
|
27
|
+
* Agoric code maintainers will confirm whether it is valid, and will provide updates to the reporter on validity of the report.
|
|
28
|
+
* It may take up to 72 hours for an issue to be validated, especially if reported during holidays or on weekends.
|
|
29
|
+
|
|
30
|
+
* When the Agoric team has verified an issue, remediation steps and patch release timeline information will be shared with the reporter.
|
|
31
|
+
* Complexity, severity, impact, and likelihood of exploitation are all vital factors that determine the amount of time required to remediate an issue and distribute a software patch.
|
|
32
|
+
* If an issue is Critical or High Severity, Agoric code maintainers will release a security advisory to notify impacted parties to prepare for an emergency patch.
|
|
33
|
+
* While the current industry standard for vulnerability coordination resolution is 90 days, Agoric code maintainers will strive to release a patch as quickly as possible.
|
|
34
|
+
|
|
35
|
+
When a bug patch is included in a software release, the Agoric code maintainers will:
|
|
36
|
+
* Confirm the version and date of the software release with the reporter.
|
|
37
|
+
* Provide information about the security issue that the software release resolves.
|
|
38
|
+
* Credit the bug reporter for discovery by adding thanks in release notes, securing a CVE designation, or adding the researcher’s name to a Hall of Fame.
|
package/dist/lockdown.cjs
CHANGED
|
@@ -28,6 +28,7 @@ const {
|
|
|
28
28
|
JSON,
|
|
29
29
|
Map,
|
|
30
30
|
Math,
|
|
31
|
+
Number,
|
|
31
32
|
Object,
|
|
32
33
|
Promise,
|
|
33
34
|
Proxy,
|
|
@@ -37,7 +38,7 @@ const {
|
|
|
37
38
|
String,
|
|
38
39
|
WeakMap,
|
|
39
40
|
WeakSet } =
|
|
40
|
-
globalThis;$h_once.Array(Array);$h_once.Date(Date);$h_once.Float32Array(Float32Array);$h_once.JSON(JSON);$h_once.Map(Map);$h_once.Math(Math);$h_once.Object(Object);$h_once.Promise(Promise);$h_once.Proxy(Proxy);$h_once.Reflect(Reflect);$h_once.FERAL_REG_EXP(FERAL_REG_EXP);$h_once.Set(Set);$h_once.String(String);$h_once.WeakMap(WeakMap);$h_once.WeakSet(WeakSet);
|
|
41
|
+
globalThis;$h_once.Array(Array);$h_once.Date(Date);$h_once.Float32Array(Float32Array);$h_once.JSON(JSON);$h_once.Map(Map);$h_once.Math(Math);$h_once.Number(Number);$h_once.Object(Object);$h_once.Promise(Promise);$h_once.Proxy(Proxy);$h_once.Reflect(Reflect);$h_once.FERAL_REG_EXP(FERAL_REG_EXP);$h_once.Set(Set);$h_once.String(String);$h_once.WeakMap(WeakMap);$h_once.WeakSet(WeakSet);
|
|
41
42
|
|
|
42
43
|
const {
|
|
43
44
|
// The feral Error constructor is safe for internal use, but must not be
|
|
@@ -2733,7 +2734,10 @@ function NativeErrorPrototype(constructor) {
|
|
|
2733
2734
|
message: 'string',
|
|
2734
2735
|
name: 'string',
|
|
2735
2736
|
// Redundantly present only on v8. Safe to remove.
|
|
2736
|
-
toString: false
|
|
2737
|
+
toString: false,
|
|
2738
|
+
// Superfluously present in some versions of V8.
|
|
2739
|
+
// https://github.com/tc39/notes/blob/master/meetings/2021-10/oct-26.md#:~:text=However%2C%20Chrome%2093,and%20node%2016.11.
|
|
2740
|
+
cause: false };
|
|
2737
2741
|
|
|
2738
2742
|
}
|
|
2739
2743
|
|
|
@@ -2997,7 +3001,10 @@ const whitelist = {
|
|
|
2997
3001
|
// Seen on FF Nightly 88.0a1
|
|
2998
3002
|
at: false,
|
|
2999
3003
|
// Seen on FF and XS
|
|
3000
|
-
stack: false
|
|
3004
|
+
stack: false,
|
|
3005
|
+
// Superfluously present in some versions of V8.
|
|
3006
|
+
// https://github.com/tc39/notes/blob/master/meetings/2021-10/oct-26.md#:~:text=However%2C%20Chrome%2093,and%20node%2016.11.
|
|
3007
|
+
cause: false },
|
|
3001
3008
|
|
|
3002
3009
|
|
|
3003
3010
|
// NativeError
|
|
@@ -6557,7 +6564,11 @@ optGetStackString = undefined) =>
|
|
|
6557
6564
|
}
|
|
6558
6565
|
|
|
6559
6566
|
// Browser
|
|
6560
|
-
if (
|
|
6567
|
+
if (
|
|
6568
|
+
errorTrapping !== 'none' &&
|
|
6569
|
+
globalThis.window !== undefined &&
|
|
6570
|
+
globalThis.window.addEventListener !== undefined)
|
|
6571
|
+
{
|
|
6561
6572
|
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
6562
6573
|
globalThis.window.addEventListener('error', (event) => {
|
|
6563
6574
|
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
@@ -7709,7 +7720,8 @@ const tameFunctionToString = () => {
|
|
|
7709
7720
|
})
|
|
7710
7721
|
,
|
|
7711
7722
|
// === functors[35] ===
|
|
7712
|
-
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let String,TypeError,defineProperty,getOwnPropertyNames,isObject,regexpExec,assert;$h_imports([["./commons.js", [["String", [$h_a => (String = $h_a)]],["TypeError", [$h_a => (TypeError = $h_a)]],["defineProperty", [$h_a => (defineProperty = $h_a)]],["getOwnPropertyNames", [$h_a => (getOwnPropertyNames = $h_a)]],["isObject", [$h_a => (isObject = $h_a)]],["regexpExec", [$h_a => (regexpExec = $h_a)]]]],["./error/assert.js", [["assert", [$h_a => (assert = $h_a)]]]]]);
|
|
7723
|
+
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let Number,String,TypeError,defineProperty,getOwnPropertyNames,isObject,regexpExec,assert;$h_imports([["./commons.js", [["Number", [$h_a => (Number = $h_a)]],["String", [$h_a => (String = $h_a)]],["TypeError", [$h_a => (TypeError = $h_a)]],["defineProperty", [$h_a => (defineProperty = $h_a)]],["getOwnPropertyNames", [$h_a => (getOwnPropertyNames = $h_a)]],["isObject", [$h_a => (isObject = $h_a)]],["regexpExec", [$h_a => (regexpExec = $h_a)]]]],["./error/assert.js", [["assert", [$h_a => (assert = $h_a)]]]]]);
|
|
7724
|
+
|
|
7713
7725
|
|
|
7714
7726
|
|
|
7715
7727
|
|
|
@@ -7743,10 +7755,15 @@ const tamedMethods = {
|
|
|
7743
7755
|
}
|
|
7744
7756
|
assert(s === that, d`expected ${q(s)} and ${q(that)} to compare`);
|
|
7745
7757
|
return 0;
|
|
7758
|
+
},
|
|
7759
|
+
|
|
7760
|
+
toString() {
|
|
7761
|
+
return `${this}`;
|
|
7746
7762
|
} };
|
|
7747
7763
|
|
|
7748
7764
|
|
|
7749
7765
|
const nonLocaleCompare = tamedMethods.localeCompare;
|
|
7766
|
+
const numberToString = tamedMethods.toString;
|
|
7750
7767
|
|
|
7751
7768
|
function tameLocaleMethods(intrinsics, localeTaming = 'safe') {
|
|
7752
7769
|
if (localeTaming !== 'safe' && localeTaming !== 'unsafe') {
|
|
@@ -7781,6 +7798,12 @@ function tameLocaleMethods(intrinsics, localeTaming = 'safe') {
|
|
|
7781
7798
|
}
|
|
7782
7799
|
}
|
|
7783
7800
|
}
|
|
7801
|
+
|
|
7802
|
+
// Numbers are special because toString accepts a radix instead of ignoring
|
|
7803
|
+
// all of the arguments that we would otherwise forward.
|
|
7804
|
+
defineProperty(Number.prototype, 'toLocaleString', {
|
|
7805
|
+
value: numberToString });
|
|
7806
|
+
|
|
7784
7807
|
}$h_once.default(tameLocaleMethods);
|
|
7785
7808
|
})
|
|
7786
7809
|
,
|
|
@@ -8144,7 +8167,9 @@ markVirtualizedNativeFunction)
|
|
|
8144
8167
|
})
|
|
8145
8168
|
,
|
|
8146
8169
|
// === functors[39] ===
|
|
8147
|
-
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let TypeError,arrayFilter,arrayMap,globalThis,is,ownKeys,stringSplit,enJoin,makeHardener,makeIntrinsicsCollector,whitelistIntrinsics,tameFunctionConstructors,tameDateConstructor,tameMathObject,tameRegExpConstructor,enablePropertyOverrides,tameLocaleMethods,setGlobalObjectConstantProperties,setGlobalObjectMutableProperties,makeSafeEvaluator,initialGlobalPropertyNames,tameFunctionToString,tameDomains,tameConsole,tameErrorConstructor,assert,makeAssert,makeEnvironmentCaptor,getAnonymousIntrinsics,makeCompartmentConstructor;$h_imports([["./commons.js", [["TypeError", [$h_a => (TypeError = $h_a)]],["arrayFilter", [$h_a => (arrayFilter = $h_a)]],["arrayMap", [$h_a => (arrayMap = $h_a)]],["globalThis", [$h_a => (globalThis = $h_a)]],["is", [$h_a => (is = $h_a)]],["ownKeys", [$h_a => (ownKeys = $h_a)]],["stringSplit", [$h_a => (stringSplit = $h_a)]]]],["./error/stringify-utils.js", [["enJoin", [$h_a => (enJoin = $h_a)]]]],["./make-hardener.js", [["makeHardener", [$h_a => (makeHardener = $h_a)]]]],["./intrinsics.js", [["makeIntrinsicsCollector", [$h_a => (makeIntrinsicsCollector = $h_a)]]]],["./whitelist-intrinsics.js", [["default", [$h_a => (whitelistIntrinsics = $h_a)]]]],["./tame-function-constructors.js", [["default", [$h_a => (tameFunctionConstructors = $h_a)]]]],["./tame-date-constructor.js", [["default", [$h_a => (tameDateConstructor = $h_a)]]]],["./tame-math-object.js", [["default", [$h_a => (tameMathObject = $h_a)]]]],["./tame-regexp-constructor.js", [["default", [$h_a => (tameRegExpConstructor = $h_a)]]]],["./enable-property-overrides.js", [["default", [$h_a => (enablePropertyOverrides = $h_a)]]]],["./tame-locale-methods.js", [["default", [$h_a => (tameLocaleMethods = $h_a)]]]],["./global-object.js", [["setGlobalObjectConstantProperties", [$h_a => (setGlobalObjectConstantProperties = $h_a)]],["setGlobalObjectMutableProperties", [$h_a => (setGlobalObjectMutableProperties = $h_a)]]]],["./make-safe-evaluator.js", [["makeSafeEvaluator", [$h_a => (makeSafeEvaluator = $h_a)]]]],["./whitelist.js", [["initialGlobalPropertyNames", [$h_a => (initialGlobalPropertyNames = $h_a)]]]],["./tame-function-tostring.js", [["tameFunctionToString", [$h_a => (tameFunctionToString = $h_a)]]]],["./tame-domains.js", [["tameDomains", [$h_a => (tameDomains = $h_a)]]]],["./error/tame-console.js", [["tameConsole", [$h_a => (tameConsole = $h_a)]]]],["./error/tame-error-constructor.js", [["default", [$h_a => (tameErrorConstructor = $h_a)]]]],["./error/assert.js", [["assert", [$h_a => (assert = $h_a)]],["makeAssert", [$h_a => (makeAssert = $h_a)]]]],["./environment-options.js", [["makeEnvironmentCaptor", [$h_a => (makeEnvironmentCaptor = $h_a)]]]],["./get-anonymous-intrinsics.js", [["getAnonymousIntrinsics", [$h_a => (getAnonymousIntrinsics = $h_a)]]]],["./compartment-shim.js", [["makeCompartmentConstructor", [$h_a => (makeCompartmentConstructor = $h_a)]]]]]);
|
|
8170
|
+
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let FERAL_FUNCTION,FERAL_EVAL,TypeError,arrayFilter,arrayMap,globalThis,is,ownKeys,stringSplit,enJoin,makeHardener,makeIntrinsicsCollector,whitelistIntrinsics,tameFunctionConstructors,tameDateConstructor,tameMathObject,tameRegExpConstructor,enablePropertyOverrides,tameLocaleMethods,setGlobalObjectConstantProperties,setGlobalObjectMutableProperties,makeSafeEvaluator,initialGlobalPropertyNames,tameFunctionToString,tameDomains,tameConsole,tameErrorConstructor,assert,makeAssert,makeEnvironmentCaptor,getAnonymousIntrinsics,makeCompartmentConstructor;$h_imports([["./commons.js", [["FERAL_FUNCTION", [$h_a => (FERAL_FUNCTION = $h_a)]],["FERAL_EVAL", [$h_a => (FERAL_EVAL = $h_a)]],["TypeError", [$h_a => (TypeError = $h_a)]],["arrayFilter", [$h_a => (arrayFilter = $h_a)]],["arrayMap", [$h_a => (arrayMap = $h_a)]],["globalThis", [$h_a => (globalThis = $h_a)]],["is", [$h_a => (is = $h_a)]],["ownKeys", [$h_a => (ownKeys = $h_a)]],["stringSplit", [$h_a => (stringSplit = $h_a)]]]],["./error/stringify-utils.js", [["enJoin", [$h_a => (enJoin = $h_a)]]]],["./make-hardener.js", [["makeHardener", [$h_a => (makeHardener = $h_a)]]]],["./intrinsics.js", [["makeIntrinsicsCollector", [$h_a => (makeIntrinsicsCollector = $h_a)]]]],["./whitelist-intrinsics.js", [["default", [$h_a => (whitelistIntrinsics = $h_a)]]]],["./tame-function-constructors.js", [["default", [$h_a => (tameFunctionConstructors = $h_a)]]]],["./tame-date-constructor.js", [["default", [$h_a => (tameDateConstructor = $h_a)]]]],["./tame-math-object.js", [["default", [$h_a => (tameMathObject = $h_a)]]]],["./tame-regexp-constructor.js", [["default", [$h_a => (tameRegExpConstructor = $h_a)]]]],["./enable-property-overrides.js", [["default", [$h_a => (enablePropertyOverrides = $h_a)]]]],["./tame-locale-methods.js", [["default", [$h_a => (tameLocaleMethods = $h_a)]]]],["./global-object.js", [["setGlobalObjectConstantProperties", [$h_a => (setGlobalObjectConstantProperties = $h_a)]],["setGlobalObjectMutableProperties", [$h_a => (setGlobalObjectMutableProperties = $h_a)]]]],["./make-safe-evaluator.js", [["makeSafeEvaluator", [$h_a => (makeSafeEvaluator = $h_a)]]]],["./whitelist.js", [["initialGlobalPropertyNames", [$h_a => (initialGlobalPropertyNames = $h_a)]]]],["./tame-function-tostring.js", [["tameFunctionToString", [$h_a => (tameFunctionToString = $h_a)]]]],["./tame-domains.js", [["tameDomains", [$h_a => (tameDomains = $h_a)]]]],["./error/tame-console.js", [["tameConsole", [$h_a => (tameConsole = $h_a)]]]],["./error/tame-error-constructor.js", [["default", [$h_a => (tameErrorConstructor = $h_a)]]]],["./error/assert.js", [["assert", [$h_a => (assert = $h_a)]],["makeAssert", [$h_a => (makeAssert = $h_a)]]]],["./environment-options.js", [["makeEnvironmentCaptor", [$h_a => (makeEnvironmentCaptor = $h_a)]]]],["./get-anonymous-intrinsics.js", [["getAnonymousIntrinsics", [$h_a => (getAnonymousIntrinsics = $h_a)]]]],["./compartment-shim.js", [["makeCompartmentConstructor", [$h_a => (makeCompartmentConstructor = $h_a)]]]]]);
|
|
8171
|
+
|
|
8172
|
+
|
|
8148
8173
|
|
|
8149
8174
|
|
|
8150
8175
|
|
|
@@ -8233,6 +8258,37 @@ const harden = makeHardener();
|
|
|
8233
8258
|
// only ever need to be called once and that simplifying lockdown will improve
|
|
8234
8259
|
// the quality of audits.
|
|
8235
8260
|
|
|
8261
|
+
const assertDirectEvalAvailable = () => {
|
|
8262
|
+
let allowed = false;
|
|
8263
|
+
try {
|
|
8264
|
+
allowed = FERAL_FUNCTION(
|
|
8265
|
+
'eval',
|
|
8266
|
+
'SES_changed',
|
|
8267
|
+
`\
|
|
8268
|
+
eval("SES_changed = true");
|
|
8269
|
+
return SES_changed;
|
|
8270
|
+
`)(
|
|
8271
|
+
FERAL_EVAL, false);
|
|
8272
|
+
// If we get here and SES_changed stayed false, that means the eval was sloppy
|
|
8273
|
+
// and indirect, which generally creates a new global.
|
|
8274
|
+
// We are going to throw an exception for failing to initialize SES, but
|
|
8275
|
+
// good neighbors clean up.
|
|
8276
|
+
if (!allowed) {
|
|
8277
|
+
delete globalThis.SES_changed;
|
|
8278
|
+
}
|
|
8279
|
+
} catch (_error) {
|
|
8280
|
+
// We reach here if eval is outright forbidden by a Content Security Policy.
|
|
8281
|
+
// We allow this for SES usage that delegates the responsibility to isolate
|
|
8282
|
+
// guest code to production code generation.
|
|
8283
|
+
allowed = true;
|
|
8284
|
+
}
|
|
8285
|
+
if (!allowed) {
|
|
8286
|
+
throw new TypeError(
|
|
8287
|
+
`SES cannot initialize unless 'eval' is the original intrinsic 'eval', suitable for direct-eval (dynamically scoped eval) (SES_DIRECT_EVAL)`);
|
|
8288
|
+
|
|
8289
|
+
}
|
|
8290
|
+
};
|
|
8291
|
+
|
|
8236
8292
|
/**
|
|
8237
8293
|
* @param {LockdownOptions} [options]
|
|
8238
8294
|
* @returns {() => void} repairIntrinsics
|
|
@@ -8320,6 +8376,8 @@ const repairIntrinsics = (options = {}) => {
|
|
|
8320
8376
|
// trace retained:
|
|
8321
8377
|
priorLockdown.stack;
|
|
8322
8378
|
|
|
8379
|
+
assertDirectEvalAvailable();
|
|
8380
|
+
|
|
8323
8381
|
/**
|
|
8324
8382
|
* Because of packagers and bundlers, etc, multiple invocations of lockdown
|
|
8325
8383
|
* might happen in separate instantiations of the source of this module.
|
|
@@ -8340,11 +8398,14 @@ const repairIntrinsics = (options = {}) => {
|
|
|
8340
8398
|
const seemsToBeLockedDown = () => {
|
|
8341
8399
|
return (
|
|
8342
8400
|
globalThis.Function.prototype.constructor !== globalThis.Function &&
|
|
8401
|
+
// @ts-ignore harden is absent on globalThis type def.
|
|
8343
8402
|
typeof globalThis.harden === 'function' &&
|
|
8403
|
+
// @ts-ignore lockdown is absent on globalThis type def.
|
|
8344
8404
|
typeof globalThis.lockdown === 'function' &&
|
|
8345
8405
|
globalThis.Date.prototype.constructor !== globalThis.Date &&
|
|
8346
8406
|
typeof globalThis.Date.now === 'function' &&
|
|
8347
|
-
// @ts-ignore
|
|
8407
|
+
// @ts-ignore does not recognize that Date constructor is a special
|
|
8408
|
+
// Function.
|
|
8348
8409
|
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
8349
8410
|
is(globalThis.Date.prototype.constructor.now(), NaN));
|
|
8350
8411
|
|
|
@@ -8400,12 +8461,14 @@ const repairIntrinsics = (options = {}) => {
|
|
|
8400
8461
|
|
|
8401
8462
|
globalThis.console = /** @type {Console} */consoleRecord.console;
|
|
8402
8463
|
|
|
8464
|
+
// @ts-ignore assert is absent on globalThis type def.
|
|
8403
8465
|
if (errorTaming === 'unsafe' && globalThis.assert === assert) {
|
|
8404
8466
|
// If errorTaming is 'unsafe' we replace the global assert with
|
|
8405
8467
|
// one whose `details` template literal tag does not redact
|
|
8406
8468
|
// unmarked substitution values. IOW, it blabs information that
|
|
8407
8469
|
// was supposed to be secret from callers, as an aid to debugging
|
|
8408
8470
|
// at a further cost in safety.
|
|
8471
|
+
// @ts-ignore assert is absent on globalThis type def.
|
|
8409
8472
|
globalThis.assert = makeAssert(undefined, true);
|
|
8410
8473
|
}
|
|
8411
8474
|
|
|
@@ -8470,6 +8533,7 @@ const repairIntrinsics = (options = {}) => {
|
|
|
8470
8533
|
// that is portable between JS and SES), the existence of harden in global
|
|
8471
8534
|
// scope signals whether such code should attempt to use harden in the
|
|
8472
8535
|
// defense of its own API.
|
|
8536
|
+
// @ts-ignore harden not yet recognized on globalThis.
|
|
8473
8537
|
globalThis.harden = harden;
|
|
8474
8538
|
|
|
8475
8539
|
// Returning `true` indicates that this is a JS to SES transition.
|
|
@@ -8563,6 +8627,7 @@ assign(globalThis, {
|
|
|
8563
8627
|
JSON: cell("JSON"),
|
|
8564
8628
|
Map: cell("Map"),
|
|
8565
8629
|
Math: cell("Math"),
|
|
8630
|
+
Number: cell("Number"),
|
|
8566
8631
|
Object: cell("Object"),
|
|
8567
8632
|
Promise: cell("Promise"),
|
|
8568
8633
|
Proxy: cell("Proxy"),
|
|
@@ -8862,6 +8927,7 @@ assign(globalThis, {
|
|
|
8862
8927
|
JSON: cells[0].JSON.set,
|
|
8863
8928
|
Map: cells[0].Map.set,
|
|
8864
8929
|
Math: cells[0].Math.set,
|
|
8930
|
+
Number: cells[0].Number.set,
|
|
8865
8931
|
Object: cells[0].Object.set,
|
|
8866
8932
|
Promise: cells[0].Promise.set,
|
|
8867
8933
|
Proxy: cells[0].Proxy.set,
|