ses 0.14.4 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/NEWS.md +18 -0
- package/dist/lockdown.cjs +548 -365
- package/dist/lockdown.mjs +548 -365
- package/dist/lockdown.umd.js +548 -365
- package/dist/lockdown.umd.min.js +1 -1
- package/dist/ses.cjs +548 -365
- package/dist/ses.mjs +548 -365
- package/dist/ses.umd.js +548 -365
- package/dist/ses.umd.min.js +1 -1
- package/index.js +3 -11
- package/package.json +6 -6
- package/src/environment-options.js +125 -0
- package/src/error/stringify-utils.js +24 -1
- package/src/lockdown-shim.js +76 -100
package/dist/lockdown.mjs
CHANGED
|
@@ -142,6 +142,7 @@ FERAL_FUNCTION: cell("FERAL_FUNCTION"),
|
|
|
142
142
|
},{
|
|
143
143
|
an: cell("an"),
|
|
144
144
|
bestEffortStringify: cell("bestEffortStringify"),
|
|
145
|
+
enJoin: cell("enJoin"),
|
|
145
146
|
|
|
146
147
|
|
|
147
148
|
},{
|
|
@@ -241,10 +242,6 @@ CompartmentPrototype: cell("CompartmentPrototype"),
|
|
|
241
242
|
makeCompartmentConstructor: cell("makeCompartmentConstructor"),
|
|
242
243
|
|
|
243
244
|
|
|
244
|
-
},{
|
|
245
|
-
getAnonymousIntrinsics: cell("getAnonymousIntrinsics"),
|
|
246
|
-
|
|
247
|
-
|
|
248
245
|
},{
|
|
249
246
|
makeIntrinsicsCollector: cell("makeIntrinsicsCollector"),
|
|
250
247
|
getGlobalIntrinsics: cell("getGlobalIntrinsics"),
|
|
@@ -260,6 +257,10 @@ severeEnablements: cell("severeEnablements"),
|
|
|
260
257
|
default: cell("default"),
|
|
261
258
|
|
|
262
259
|
|
|
260
|
+
},{
|
|
261
|
+
makeEnvironmentCaptor: cell("makeEnvironmentCaptor"),
|
|
262
|
+
|
|
263
|
+
|
|
263
264
|
},{
|
|
264
265
|
makeLoggingConsoleKit: cell("makeLoggingConsoleKit"),
|
|
265
266
|
makeCausalConsole: cell("makeCausalConsole"),
|
|
@@ -282,6 +283,10 @@ tameV8ErrorConstructor: cell("tameV8ErrorConstructor"),
|
|
|
282
283
|
default: cell("default"),
|
|
283
284
|
|
|
284
285
|
|
|
286
|
+
},{
|
|
287
|
+
getAnonymousIntrinsics: cell("getAnonymousIntrinsics"),
|
|
288
|
+
|
|
289
|
+
|
|
285
290
|
},{
|
|
286
291
|
makeHardener: cell("makeHardener"),
|
|
287
292
|
|
|
@@ -320,7 +325,7 @@ tameV8ErrorConstructor: cell("tameV8ErrorConstructor"),
|
|
|
320
325
|
|
|
321
326
|
},{
|
|
322
327
|
repairIntrinsics: cell("repairIntrinsics"),
|
|
323
|
-
|
|
328
|
+
lockdown: cell("lockdown"),
|
|
324
329
|
|
|
325
330
|
|
|
326
331
|
},{
|
|
@@ -495,6 +500,7 @@ makeLockdown: cell("makeLockdown"),
|
|
|
495
500
|
onceVar: {
|
|
496
501
|
an: cells[2].an.set,
|
|
497
502
|
bestEffortStringify: cells[2].bestEffortStringify.set,
|
|
503
|
+
enJoin: cells[2].enJoin.set,
|
|
498
504
|
|
|
499
505
|
},
|
|
500
506
|
});
|
|
@@ -1201,8 +1207,8 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1201
1207
|
cell.observe(observer);
|
|
1202
1208
|
}
|
|
1203
1209
|
}
|
|
1204
|
-
for (const [name, observers] of map.get("./
|
|
1205
|
-
const cell = cells[
|
|
1210
|
+
for (const [name, observers] of map.get("./whitelist.js")) {
|
|
1211
|
+
const cell = cells[14][name];
|
|
1206
1212
|
if (cell === undefined) {
|
|
1207
1213
|
throw new ReferenceError(`Cannot import name ${name}`);
|
|
1208
1214
|
}
|
|
@@ -1216,11 +1222,27 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1216
1222
|
|
|
1217
1223
|
},
|
|
1218
1224
|
onceVar: {
|
|
1219
|
-
|
|
1225
|
+
makeIntrinsicsCollector: cells[21].makeIntrinsicsCollector.set,
|
|
1226
|
+
getGlobalIntrinsics: cells[21].getGlobalIntrinsics.set,
|
|
1220
1227
|
|
|
1221
1228
|
},
|
|
1222
1229
|
});
|
|
1223
1230
|
functors[22]({
|
|
1231
|
+
imports(entries) {
|
|
1232
|
+
const map = new Map(entries);
|
|
1233
|
+
|
|
1234
|
+
},
|
|
1235
|
+
liveVar: {
|
|
1236
|
+
|
|
1237
|
+
},
|
|
1238
|
+
onceVar: {
|
|
1239
|
+
minEnablements: cells[22].minEnablements.set,
|
|
1240
|
+
moderateEnablements: cells[22].moderateEnablements.set,
|
|
1241
|
+
severeEnablements: cells[22].severeEnablements.set,
|
|
1242
|
+
|
|
1243
|
+
},
|
|
1244
|
+
});
|
|
1245
|
+
functors[23]({
|
|
1224
1246
|
imports(entries) {
|
|
1225
1247
|
const map = new Map(entries);
|
|
1226
1248
|
for (const [name, observers] of map.get("./commons.js")) {
|
|
@@ -1232,8 +1254,8 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1232
1254
|
cell.observe(observer);
|
|
1233
1255
|
}
|
|
1234
1256
|
}
|
|
1235
|
-
for (const [name, observers] of map.get("./
|
|
1236
|
-
const cell = cells[
|
|
1257
|
+
for (const [name, observers] of map.get("./enablements.js")) {
|
|
1258
|
+
const cell = cells[22][name];
|
|
1237
1259
|
if (cell === undefined) {
|
|
1238
1260
|
throw new ReferenceError(`Cannot import name ${name}`);
|
|
1239
1261
|
}
|
|
@@ -1247,23 +1269,7 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1247
1269
|
|
|
1248
1270
|
},
|
|
1249
1271
|
onceVar: {
|
|
1250
|
-
|
|
1251
|
-
getGlobalIntrinsics: cells[22].getGlobalIntrinsics.set,
|
|
1252
|
-
|
|
1253
|
-
},
|
|
1254
|
-
});
|
|
1255
|
-
functors[23]({
|
|
1256
|
-
imports(entries) {
|
|
1257
|
-
const map = new Map(entries);
|
|
1258
|
-
|
|
1259
|
-
},
|
|
1260
|
-
liveVar: {
|
|
1261
|
-
|
|
1262
|
-
},
|
|
1263
|
-
onceVar: {
|
|
1264
|
-
minEnablements: cells[23].minEnablements.set,
|
|
1265
|
-
moderateEnablements: cells[23].moderateEnablements.set,
|
|
1266
|
-
severeEnablements: cells[23].severeEnablements.set,
|
|
1272
|
+
default: cells[23].default.set,
|
|
1267
1273
|
|
|
1268
1274
|
},
|
|
1269
1275
|
});
|
|
@@ -1279,8 +1285,8 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1279
1285
|
cell.observe(observer);
|
|
1280
1286
|
}
|
|
1281
1287
|
}
|
|
1282
|
-
for (const [name, observers] of map.get("./
|
|
1283
|
-
const cell = cells[
|
|
1288
|
+
for (const [name, observers] of map.get("./error/assert.js")) {
|
|
1289
|
+
const cell = cells[4][name];
|
|
1284
1290
|
if (cell === undefined) {
|
|
1285
1291
|
throw new ReferenceError(`Cannot import name ${name}`);
|
|
1286
1292
|
}
|
|
@@ -1294,7 +1300,7 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1294
1300
|
|
|
1295
1301
|
},
|
|
1296
1302
|
onceVar: {
|
|
1297
|
-
|
|
1303
|
+
makeEnvironmentCaptor: cells[24].makeEnvironmentCaptor.set,
|
|
1298
1304
|
|
|
1299
1305
|
},
|
|
1300
1306
|
});
|
|
@@ -1475,6 +1481,15 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1475
1481
|
for (const observer of observers) {
|
|
1476
1482
|
cell.observe(observer);
|
|
1477
1483
|
}
|
|
1484
|
+
}
|
|
1485
|
+
for (const [name, observers] of map.get("./compartment-shim.js")) {
|
|
1486
|
+
const cell = cells[20][name];
|
|
1487
|
+
if (cell === undefined) {
|
|
1488
|
+
throw new ReferenceError(`Cannot import name ${name}`);
|
|
1489
|
+
}
|
|
1490
|
+
for (const observer of observers) {
|
|
1491
|
+
cell.observe(observer);
|
|
1492
|
+
}
|
|
1478
1493
|
}
|
|
1479
1494
|
|
|
1480
1495
|
},
|
|
@@ -1482,7 +1497,7 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1482
1497
|
|
|
1483
1498
|
},
|
|
1484
1499
|
onceVar: {
|
|
1485
|
-
|
|
1500
|
+
getAnonymousIntrinsics: cells[29].getAnonymousIntrinsics.set,
|
|
1486
1501
|
|
|
1487
1502
|
},
|
|
1488
1503
|
});
|
|
@@ -1504,7 +1519,7 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1504
1519
|
|
|
1505
1520
|
},
|
|
1506
1521
|
onceVar: {
|
|
1507
|
-
|
|
1522
|
+
makeHardener: cells[30].makeHardener.set,
|
|
1508
1523
|
|
|
1509
1524
|
},
|
|
1510
1525
|
});
|
|
@@ -1526,7 +1541,7 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1526
1541
|
|
|
1527
1542
|
},
|
|
1528
1543
|
onceVar: {
|
|
1529
|
-
|
|
1544
|
+
default: cells[31].default.set,
|
|
1530
1545
|
|
|
1531
1546
|
},
|
|
1532
1547
|
});
|
|
@@ -1548,7 +1563,7 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1548
1563
|
|
|
1549
1564
|
},
|
|
1550
1565
|
onceVar: {
|
|
1551
|
-
|
|
1566
|
+
tameDomains: cells[32].tameDomains.set,
|
|
1552
1567
|
|
|
1553
1568
|
},
|
|
1554
1569
|
});
|
|
@@ -1570,11 +1585,33 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1570
1585
|
|
|
1571
1586
|
},
|
|
1572
1587
|
onceVar: {
|
|
1573
|
-
|
|
1588
|
+
default: cells[33].default.set,
|
|
1574
1589
|
|
|
1575
1590
|
},
|
|
1576
1591
|
});
|
|
1577
1592
|
functors[34]({
|
|
1593
|
+
imports(entries) {
|
|
1594
|
+
const map = new Map(entries);
|
|
1595
|
+
for (const [name, observers] of map.get("./commons.js")) {
|
|
1596
|
+
const cell = cells[0][name];
|
|
1597
|
+
if (cell === undefined) {
|
|
1598
|
+
throw new ReferenceError(`Cannot import name ${name}`);
|
|
1599
|
+
}
|
|
1600
|
+
for (const observer of observers) {
|
|
1601
|
+
cell.observe(observer);
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
},
|
|
1606
|
+
liveVar: {
|
|
1607
|
+
|
|
1608
|
+
},
|
|
1609
|
+
onceVar: {
|
|
1610
|
+
tameFunctionToString: cells[34].tameFunctionToString.set,
|
|
1611
|
+
|
|
1612
|
+
},
|
|
1613
|
+
});
|
|
1614
|
+
functors[35]({
|
|
1578
1615
|
imports(entries) {
|
|
1579
1616
|
const map = new Map(entries);
|
|
1580
1617
|
for (const [name, observers] of map.get("./commons.js")) {
|
|
@@ -1601,11 +1638,11 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1601
1638
|
|
|
1602
1639
|
},
|
|
1603
1640
|
onceVar: {
|
|
1604
|
-
default: cells[
|
|
1641
|
+
default: cells[35].default.set,
|
|
1605
1642
|
|
|
1606
1643
|
},
|
|
1607
1644
|
});
|
|
1608
|
-
functors[
|
|
1645
|
+
functors[36]({
|
|
1609
1646
|
imports(entries) {
|
|
1610
1647
|
const map = new Map(entries);
|
|
1611
1648
|
for (const [name, observers] of map.get("./commons.js")) {
|
|
@@ -1623,11 +1660,11 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1623
1660
|
|
|
1624
1661
|
},
|
|
1625
1662
|
onceVar: {
|
|
1626
|
-
default: cells[
|
|
1663
|
+
default: cells[36].default.set,
|
|
1627
1664
|
|
|
1628
1665
|
},
|
|
1629
1666
|
});
|
|
1630
|
-
functors[
|
|
1667
|
+
functors[37]({
|
|
1631
1668
|
imports(entries) {
|
|
1632
1669
|
const map = new Map(entries);
|
|
1633
1670
|
for (const [name, observers] of map.get("./commons.js")) {
|
|
@@ -1645,11 +1682,11 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1645
1682
|
|
|
1646
1683
|
},
|
|
1647
1684
|
onceVar: {
|
|
1648
|
-
default: cells[
|
|
1685
|
+
default: cells[37].default.set,
|
|
1649
1686
|
|
|
1650
1687
|
},
|
|
1651
1688
|
});
|
|
1652
|
-
functors[
|
|
1689
|
+
functors[38]({
|
|
1653
1690
|
imports(entries) {
|
|
1654
1691
|
const map = new Map(entries);
|
|
1655
1692
|
for (const [name, observers] of map.get("./commons.js")) {
|
|
@@ -1676,11 +1713,11 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1676
1713
|
|
|
1677
1714
|
},
|
|
1678
1715
|
onceVar: {
|
|
1679
|
-
default: cells[
|
|
1716
|
+
default: cells[38].default.set,
|
|
1680
1717
|
|
|
1681
1718
|
},
|
|
1682
1719
|
});
|
|
1683
|
-
functors[
|
|
1720
|
+
functors[39]({
|
|
1684
1721
|
imports(entries) {
|
|
1685
1722
|
const map = new Map(entries);
|
|
1686
1723
|
for (const [name, observers] of map.get("./commons.js")) {
|
|
@@ -1691,8 +1728,26 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1691
1728
|
for (const observer of observers) {
|
|
1692
1729
|
cell.observe(observer);
|
|
1693
1730
|
}
|
|
1731
|
+
}
|
|
1732
|
+
for (const [name, observers] of map.get("./compartment-shim.js")) {
|
|
1733
|
+
const cell = cells[20][name];
|
|
1734
|
+
if (cell === undefined) {
|
|
1735
|
+
throw new ReferenceError(`Cannot import name ${name}`);
|
|
1736
|
+
}
|
|
1737
|
+
for (const observer of observers) {
|
|
1738
|
+
cell.observe(observer);
|
|
1739
|
+
}
|
|
1694
1740
|
}
|
|
1695
1741
|
for (const [name, observers] of map.get("./enable-property-overrides.js")) {
|
|
1742
|
+
const cell = cells[23][name];
|
|
1743
|
+
if (cell === undefined) {
|
|
1744
|
+
throw new ReferenceError(`Cannot import name ${name}`);
|
|
1745
|
+
}
|
|
1746
|
+
for (const observer of observers) {
|
|
1747
|
+
cell.observe(observer);
|
|
1748
|
+
}
|
|
1749
|
+
}
|
|
1750
|
+
for (const [name, observers] of map.get("./environment-options.js")) {
|
|
1696
1751
|
const cell = cells[24][name];
|
|
1697
1752
|
if (cell === undefined) {
|
|
1698
1753
|
throw new ReferenceError(`Cannot import name ${name}`);
|
|
@@ -1709,6 +1764,15 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1709
1764
|
for (const observer of observers) {
|
|
1710
1765
|
cell.observe(observer);
|
|
1711
1766
|
}
|
|
1767
|
+
}
|
|
1768
|
+
for (const [name, observers] of map.get("./error/stringify-utils.js")) {
|
|
1769
|
+
const cell = cells[2][name];
|
|
1770
|
+
if (cell === undefined) {
|
|
1771
|
+
throw new ReferenceError(`Cannot import name ${name}`);
|
|
1772
|
+
}
|
|
1773
|
+
for (const observer of observers) {
|
|
1774
|
+
cell.observe(observer);
|
|
1775
|
+
}
|
|
1712
1776
|
}
|
|
1713
1777
|
for (const [name, observers] of map.get("./error/tame-console.js")) {
|
|
1714
1778
|
const cell = cells[26][name];
|
|
@@ -1727,6 +1791,15 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1727
1791
|
for (const observer of observers) {
|
|
1728
1792
|
cell.observe(observer);
|
|
1729
1793
|
}
|
|
1794
|
+
}
|
|
1795
|
+
for (const [name, observers] of map.get("./get-anonymous-intrinsics.js")) {
|
|
1796
|
+
const cell = cells[29][name];
|
|
1797
|
+
if (cell === undefined) {
|
|
1798
|
+
throw new ReferenceError(`Cannot import name ${name}`);
|
|
1799
|
+
}
|
|
1800
|
+
for (const observer of observers) {
|
|
1801
|
+
cell.observe(observer);
|
|
1802
|
+
}
|
|
1730
1803
|
}
|
|
1731
1804
|
for (const [name, observers] of map.get("./global-object.js")) {
|
|
1732
1805
|
const cell = cells[15][name];
|
|
@@ -1738,7 +1811,7 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1738
1811
|
}
|
|
1739
1812
|
}
|
|
1740
1813
|
for (const [name, observers] of map.get("./intrinsics.js")) {
|
|
1741
|
-
const cell = cells[
|
|
1814
|
+
const cell = cells[21][name];
|
|
1742
1815
|
if (cell === undefined) {
|
|
1743
1816
|
throw new ReferenceError(`Cannot import name ${name}`);
|
|
1744
1817
|
}
|
|
@@ -1747,7 +1820,7 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1747
1820
|
}
|
|
1748
1821
|
}
|
|
1749
1822
|
for (const [name, observers] of map.get("./make-hardener.js")) {
|
|
1750
|
-
const cell = cells[
|
|
1823
|
+
const cell = cells[30][name];
|
|
1751
1824
|
if (cell === undefined) {
|
|
1752
1825
|
throw new ReferenceError(`Cannot import name ${name}`);
|
|
1753
1826
|
}
|
|
@@ -1765,7 +1838,7 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1765
1838
|
}
|
|
1766
1839
|
}
|
|
1767
1840
|
for (const [name, observers] of map.get("./tame-date-constructor.js")) {
|
|
1768
|
-
const cell = cells[
|
|
1841
|
+
const cell = cells[31][name];
|
|
1769
1842
|
if (cell === undefined) {
|
|
1770
1843
|
throw new ReferenceError(`Cannot import name ${name}`);
|
|
1771
1844
|
}
|
|
@@ -1774,7 +1847,7 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1774
1847
|
}
|
|
1775
1848
|
}
|
|
1776
1849
|
for (const [name, observers] of map.get("./tame-domains.js")) {
|
|
1777
|
-
const cell = cells[
|
|
1850
|
+
const cell = cells[32][name];
|
|
1778
1851
|
if (cell === undefined) {
|
|
1779
1852
|
throw new ReferenceError(`Cannot import name ${name}`);
|
|
1780
1853
|
}
|
|
@@ -1783,7 +1856,7 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1783
1856
|
}
|
|
1784
1857
|
}
|
|
1785
1858
|
for (const [name, observers] of map.get("./tame-function-constructors.js")) {
|
|
1786
|
-
const cell = cells[
|
|
1859
|
+
const cell = cells[33][name];
|
|
1787
1860
|
if (cell === undefined) {
|
|
1788
1861
|
throw new ReferenceError(`Cannot import name ${name}`);
|
|
1789
1862
|
}
|
|
@@ -1792,7 +1865,7 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1792
1865
|
}
|
|
1793
1866
|
}
|
|
1794
1867
|
for (const [name, observers] of map.get("./tame-function-tostring.js")) {
|
|
1795
|
-
const cell = cells[
|
|
1868
|
+
const cell = cells[34][name];
|
|
1796
1869
|
if (cell === undefined) {
|
|
1797
1870
|
throw new ReferenceError(`Cannot import name ${name}`);
|
|
1798
1871
|
}
|
|
@@ -1801,7 +1874,7 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1801
1874
|
}
|
|
1802
1875
|
}
|
|
1803
1876
|
for (const [name, observers] of map.get("./tame-locale-methods.js")) {
|
|
1804
|
-
const cell = cells[
|
|
1877
|
+
const cell = cells[35][name];
|
|
1805
1878
|
if (cell === undefined) {
|
|
1806
1879
|
throw new ReferenceError(`Cannot import name ${name}`);
|
|
1807
1880
|
}
|
|
@@ -1810,7 +1883,7 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1810
1883
|
}
|
|
1811
1884
|
}
|
|
1812
1885
|
for (const [name, observers] of map.get("./tame-math-object.js")) {
|
|
1813
|
-
const cell = cells[
|
|
1886
|
+
const cell = cells[36][name];
|
|
1814
1887
|
if (cell === undefined) {
|
|
1815
1888
|
throw new ReferenceError(`Cannot import name ${name}`);
|
|
1816
1889
|
}
|
|
@@ -1819,7 +1892,7 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1819
1892
|
}
|
|
1820
1893
|
}
|
|
1821
1894
|
for (const [name, observers] of map.get("./tame-regexp-constructor.js")) {
|
|
1822
|
-
const cell = cells[
|
|
1895
|
+
const cell = cells[37][name];
|
|
1823
1896
|
if (cell === undefined) {
|
|
1824
1897
|
throw new ReferenceError(`Cannot import name ${name}`);
|
|
1825
1898
|
}
|
|
@@ -1828,7 +1901,7 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1828
1901
|
}
|
|
1829
1902
|
}
|
|
1830
1903
|
for (const [name, observers] of map.get("./whitelist-intrinsics.js")) {
|
|
1831
|
-
const cell = cells[
|
|
1904
|
+
const cell = cells[38][name];
|
|
1832
1905
|
if (cell === undefined) {
|
|
1833
1906
|
throw new ReferenceError(`Cannot import name ${name}`);
|
|
1834
1907
|
}
|
|
@@ -1851,12 +1924,12 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1851
1924
|
|
|
1852
1925
|
},
|
|
1853
1926
|
onceVar: {
|
|
1854
|
-
repairIntrinsics: cells[
|
|
1855
|
-
|
|
1927
|
+
repairIntrinsics: cells[39].repairIntrinsics.set,
|
|
1928
|
+
lockdown: cells[39].lockdown.set,
|
|
1856
1929
|
|
|
1857
1930
|
},
|
|
1858
1931
|
});
|
|
1859
|
-
functors[
|
|
1932
|
+
functors[40]({
|
|
1860
1933
|
imports(entries) {
|
|
1861
1934
|
const map = new Map(entries);
|
|
1862
1935
|
for (const [name, observers] of map.get("./src/commons.js")) {
|
|
@@ -1885,18 +1958,9 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1885
1958
|
for (const observer of observers) {
|
|
1886
1959
|
cell.observe(observer);
|
|
1887
1960
|
}
|
|
1888
|
-
}
|
|
1889
|
-
for (const [name, observers] of map.get("./src/get-anonymous-intrinsics.js")) {
|
|
1890
|
-
const cell = cells[21][name];
|
|
1891
|
-
if (cell === undefined) {
|
|
1892
|
-
throw new ReferenceError(`Cannot import name ${name}`);
|
|
1893
|
-
}
|
|
1894
|
-
for (const observer of observers) {
|
|
1895
|
-
cell.observe(observer);
|
|
1896
|
-
}
|
|
1897
1961
|
}
|
|
1898
1962
|
for (const [name, observers] of map.get("./src/intrinsics.js")) {
|
|
1899
|
-
const cell = cells[
|
|
1963
|
+
const cell = cells[21][name];
|
|
1900
1964
|
if (cell === undefined) {
|
|
1901
1965
|
throw new ReferenceError(`Cannot import name ${name}`);
|
|
1902
1966
|
}
|
|
@@ -1905,7 +1969,7 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1905
1969
|
}
|
|
1906
1970
|
}
|
|
1907
1971
|
for (const [name, observers] of map.get("./src/lockdown-shim.js")) {
|
|
1908
|
-
const cell = cells[
|
|
1972
|
+
const cell = cells[39][name];
|
|
1909
1973
|
if (cell === undefined) {
|
|
1910
1974
|
throw new ReferenceError(`Cannot import name ${name}`);
|
|
1911
1975
|
}
|
|
@@ -1914,7 +1978,7 @@ makeLockdown: cell("makeLockdown"),
|
|
|
1914
1978
|
}
|
|
1915
1979
|
}
|
|
1916
1980
|
for (const [name, observers] of map.get("./src/tame-function-tostring.js")) {
|
|
1917
|
-
const cell = cells[
|
|
1981
|
+
const cell = cells[34][name];
|
|
1918
1982
|
if (cell === undefined) {
|
|
1919
1983
|
throw new ReferenceError(`Cannot import name ${name}`);
|
|
1920
1984
|
}
|
|
@@ -2296,7 +2360,9 @@ $h_once.FERAL_EVAL(FERAL_EVAL);const FERAL_FUNCTION = Function;$h_once.FER
|
|
|
2296
2360
|
})
|
|
2297
2361
|
|
|
2298
2362
|
,
|
|
2299
|
-
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let Set,String,freeze,is,isError,setAdd,setHas,stringStartsWith,
|
|
2363
|
+
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let Set,String,arrayJoin,arraySlice,freeze,is,isError,setAdd,setHas,stringIncludes,stringStartsWith,stringifyJson,toStringTagSymbol;$h_imports([["../commons.js", [["Set", [$h_a => (Set = $h_a)]],["String", [$h_a => (String = $h_a)]],["arrayJoin", [$h_a => (arrayJoin = $h_a)]],["arraySlice", [$h_a => (arraySlice = $h_a)]],["freeze", [$h_a => (freeze = $h_a)]],["is", [$h_a => (is = $h_a)]],["isError", [$h_a => (isError = $h_a)]],["setAdd", [$h_a => (setAdd = $h_a)]],["setHas", [$h_a => (setHas = $h_a)]],["stringIncludes", [$h_a => (stringIncludes = $h_a)]],["stringStartsWith", [$h_a => (stringStartsWith = $h_a)]],["stringifyJson", [$h_a => (stringifyJson = $h_a)]],["toStringTagSymbol", [$h_a => (toStringTagSymbol = $h_a)]]]]]);
|
|
2364
|
+
|
|
2365
|
+
|
|
2300
2366
|
|
|
2301
2367
|
|
|
2302
2368
|
|
|
@@ -2312,13 +2378,34 @@ $h_once.FERAL_EVAL(FERAL_EVAL);const FERAL_FUNCTION = Function;$h_once.FER
|
|
|
2312
2378
|
|
|
2313
2379
|
|
|
2314
2380
|
|
|
2381
|
+
/**
|
|
2382
|
+
* Joins English terms with commas and an optional conjunction.
|
|
2383
|
+
*
|
|
2384
|
+
* @param {string[]} terms
|
|
2385
|
+
* @param {"and" | "or"} conjunction
|
|
2386
|
+
*/
|
|
2387
|
+
const enJoin = (terms, conjunction) => {
|
|
2388
|
+
if (terms.length === 0) {
|
|
2389
|
+
return '(none)';
|
|
2390
|
+
} else if (terms.length === 1) {
|
|
2391
|
+
return terms[0];
|
|
2392
|
+
} else if (terms.length === 2) {
|
|
2393
|
+
const [first, second] = terms;
|
|
2394
|
+
return `${first} ${conjunction} ${second}`;
|
|
2395
|
+
} else {
|
|
2396
|
+
return `${arrayJoin(arraySlice(terms, 0, -1), ', ')}, ${conjunction} ${
|
|
2397
|
+
terms[terms.length - 1]
|
|
2398
|
+
}`;
|
|
2399
|
+
}
|
|
2400
|
+
};
|
|
2401
|
+
|
|
2315
2402
|
/**
|
|
2316
2403
|
* Prepend the correct indefinite article onto a noun, typically a typeof
|
|
2317
2404
|
* result, e.g., "an object" vs. "a number"
|
|
2318
2405
|
*
|
|
2319
2406
|
* @param {string} str The noun to prepend
|
|
2320
2407
|
* @returns {string} The noun prepended with a/an
|
|
2321
|
-
|
|
2408
|
+
*/$h_once.enJoin(enJoin);
|
|
2322
2409
|
const an = (str) => {
|
|
2323
2410
|
str = `${str}`;
|
|
2324
2411
|
if (str.length >= 1 && stringIncludes('aeiouAEIOU', str[0])) {
|
|
@@ -7282,8 +7369,7 @@ markVirtualizedNativeFunction) =>
|
|
|
7282
7369
|
})
|
|
7283
7370
|
|
|
7284
7371
|
,
|
|
7285
|
-
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let
|
|
7286
|
-
|
|
7372
|
+
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let TypeError,WeakSet,arrayFilter,defineProperty,entries,freeze,getOwnPropertyDescriptor,getOwnPropertyDescriptors,globalThis,is,isObject,objectHasOwnProperty,values,weaksetHas,constantProperties,sharedGlobalPropertyNames,universalPropertyNames,whitelist;$h_imports([["./commons.js", [["TypeError", [$h_a => (TypeError = $h_a)]],["WeakSet", [$h_a => (WeakSet = $h_a)]],["arrayFilter", [$h_a => (arrayFilter = $h_a)]],["defineProperty", [$h_a => (defineProperty = $h_a)]],["entries", [$h_a => (entries = $h_a)]],["freeze", [$h_a => (freeze = $h_a)]],["getOwnPropertyDescriptor", [$h_a => (getOwnPropertyDescriptor = $h_a)]],["getOwnPropertyDescriptors", [$h_a => (getOwnPropertyDescriptors = $h_a)]],["globalThis", [$h_a => (globalThis = $h_a)]],["is", [$h_a => (is = $h_a)]],["isObject", [$h_a => (isObject = $h_a)]],["objectHasOwnProperty", [$h_a => (objectHasOwnProperty = $h_a)]],["values", [$h_a => (values = $h_a)]],["weaksetHas", [$h_a => (weaksetHas = $h_a)]]]],["./whitelist.js", [["constantProperties", [$h_a => (constantProperties = $h_a)]],["sharedGlobalPropertyNames", [$h_a => (sharedGlobalPropertyNames = $h_a)]],["universalPropertyNames", [$h_a => (universalPropertyNames = $h_a)]],["whitelist", [$h_a => (whitelist = $h_a)]]]]]);
|
|
7287
7373
|
|
|
7288
7374
|
|
|
7289
7375
|
|
|
@@ -7300,199 +7386,59 @@ markVirtualizedNativeFunction) =>
|
|
|
7300
7386
|
|
|
7301
7387
|
|
|
7302
7388
|
|
|
7303
|
-
/**
|
|
7304
|
-
* Object.getConstructorOf()
|
|
7305
|
-
* Helper function to improve readability, similar to Object.getPrototypeOf().
|
|
7306
|
-
*
|
|
7307
|
-
* @param {Object} obj
|
|
7308
|
-
*/
|
|
7309
|
-
function getConstructorOf(obj) {
|
|
7310
|
-
return getPrototypeOf(obj).constructor;
|
|
7311
|
-
}
|
|
7312
7389
|
|
|
7313
|
-
// getAnonymousIntrinsics uses a utility function to construct an arguments
|
|
7314
|
-
// object, since it cannot have one of its own and also be a const export.
|
|
7315
|
-
function makeArguments() {
|
|
7316
|
-
// eslint-disable-next-line prefer-rest-params
|
|
7317
|
-
return arguments;
|
|
7318
|
-
}
|
|
7319
7390
|
|
|
7320
|
-
/**
|
|
7321
|
-
* getAnonymousIntrinsics()
|
|
7322
|
-
* Get the intrinsics not otherwise reachable by named own property
|
|
7323
|
-
* traversal from the global object.
|
|
7324
|
-
*
|
|
7325
|
-
* @returns {Object}
|
|
7326
|
-
*/
|
|
7327
|
-
const getAnonymousIntrinsics = () => {
|
|
7328
|
-
const InertFunction = FERAL_FUNCTION.prototype.constructor;
|
|
7329
7391
|
|
|
7330
|
-
// 9.2.4.1 %ThrowTypeError%
|
|
7331
7392
|
|
|
7332
|
-
const ThrowTypeError = getOwnPropertyDescriptor(makeArguments(), 'callee').
|
|
7333
|
-
get;
|
|
7334
7393
|
|
|
7335
|
-
// 21.1.5.2 The %StringIteratorPrototype% Object
|
|
7336
7394
|
|
|
7337
|
-
// eslint-disable-next-line no-new-wrappers
|
|
7338
|
-
const StringIteratorObject = iterateString(new String());
|
|
7339
|
-
const StringIteratorPrototype = getPrototypeOf(StringIteratorObject);
|
|
7340
7395
|
|
|
7341
|
-
|
|
7342
|
-
const RegExpStringIterator =
|
|
7343
|
-
regexpPrototype[matchAllSymbol] && matchAllRegExp(/./);
|
|
7344
|
-
const RegExpStringIteratorPrototype =
|
|
7345
|
-
RegExpStringIterator && getPrototypeOf(RegExpStringIterator);
|
|
7396
|
+
const isFunction = (obj) => typeof obj === 'function';
|
|
7346
7397
|
|
|
7347
|
-
|
|
7398
|
+
// Like defineProperty, but throws if it would modify an existing property.
|
|
7399
|
+
// We use this to ensure that two conflicting attempts to define the same
|
|
7400
|
+
// property throws, causing SES initialization to fail. Otherwise, a
|
|
7401
|
+
// conflict between, for example, two of SES's internal whitelists might
|
|
7402
|
+
// get masked as one overwrites the other. Accordingly, the thrown error
|
|
7403
|
+
// complains of a "Conflicting definition".
|
|
7404
|
+
function initProperty(obj, name, desc) {
|
|
7405
|
+
if (objectHasOwnProperty(obj, name)) {
|
|
7406
|
+
const preDesc = getOwnPropertyDescriptor(obj, name);
|
|
7407
|
+
if (
|
|
7408
|
+
!is(preDesc.value, desc.value) ||
|
|
7409
|
+
preDesc.get !== desc.get ||
|
|
7410
|
+
preDesc.set !== desc.set ||
|
|
7411
|
+
preDesc.writable !== desc.writable ||
|
|
7412
|
+
preDesc.enumerable !== desc.enumerable ||
|
|
7413
|
+
preDesc.configurable !== desc.configurable)
|
|
7414
|
+
{
|
|
7415
|
+
throw new TypeError(`Conflicting definitions of ${name}`);
|
|
7416
|
+
}
|
|
7417
|
+
}
|
|
7418
|
+
defineProperty(obj, name, desc);
|
|
7419
|
+
}
|
|
7348
7420
|
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7421
|
+
// Like defineProperties, but throws if it would modify an existing property.
|
|
7422
|
+
// This ensures that the intrinsics added to the intrinsics collector object
|
|
7423
|
+
// graph do not overlap.
|
|
7424
|
+
function initProperties(obj, descs) {
|
|
7425
|
+
for (const [name, desc] of entries(descs)) {
|
|
7426
|
+
initProperty(obj, name, desc);
|
|
7427
|
+
}
|
|
7428
|
+
}
|
|
7352
7429
|
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
|
|
7361
|
-
|
|
7362
|
-
|
|
7363
|
-
|
|
7364
|
-
|
|
7365
|
-
const SetIteratorPrototype = getPrototypeOf(SetIteratorObject);
|
|
7366
|
-
|
|
7367
|
-
// 25.1.2 The %IteratorPrototype% Object
|
|
7368
|
-
|
|
7369
|
-
const IteratorPrototype = getPrototypeOf(ArrayIteratorPrototype);
|
|
7370
|
-
|
|
7371
|
-
// 25.2.1 The GeneratorFunction Constructor
|
|
7372
|
-
|
|
7373
|
-
// eslint-disable-next-line no-empty-function
|
|
7374
|
-
function* GeneratorFunctionInstance() {}
|
|
7375
|
-
const GeneratorFunction = getConstructorOf(GeneratorFunctionInstance);
|
|
7376
|
-
|
|
7377
|
-
// 25.2.3 Properties of the GeneratorFunction Prototype Object
|
|
7378
|
-
|
|
7379
|
-
const Generator = GeneratorFunction.prototype;
|
|
7380
|
-
|
|
7381
|
-
// 25.3.1 The AsyncGeneratorFunction Constructor
|
|
7382
|
-
|
|
7383
|
-
// eslint-disable-next-line no-empty-function
|
|
7384
|
-
async function* AsyncGeneratorFunctionInstance() {}
|
|
7385
|
-
const AsyncGeneratorFunction = getConstructorOf(
|
|
7386
|
-
AsyncGeneratorFunctionInstance);
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
// 25.3.2.2 AsyncGeneratorFunction.prototype
|
|
7390
|
-
const AsyncGenerator = AsyncGeneratorFunction.prototype;
|
|
7391
|
-
// 25.5.1 Properties of the AsyncGenerator Prototype Object
|
|
7392
|
-
const AsyncGeneratorPrototype = AsyncGenerator.prototype;
|
|
7393
|
-
const AsyncIteratorPrototype = getPrototypeOf(AsyncGeneratorPrototype);
|
|
7394
|
-
|
|
7395
|
-
// 25.7.1 The AsyncFunction Constructor
|
|
7396
|
-
|
|
7397
|
-
// eslint-disable-next-line no-empty-function
|
|
7398
|
-
async function AsyncFunctionInstance() {}
|
|
7399
|
-
const AsyncFunction = getConstructorOf(AsyncFunctionInstance);
|
|
7400
|
-
|
|
7401
|
-
const intrinsics = {
|
|
7402
|
-
'%InertFunction%': InertFunction,
|
|
7403
|
-
'%ArrayIteratorPrototype%': ArrayIteratorPrototype,
|
|
7404
|
-
'%InertAsyncFunction%': AsyncFunction,
|
|
7405
|
-
'%AsyncGenerator%': AsyncGenerator,
|
|
7406
|
-
'%InertAsyncGeneratorFunction%': AsyncGeneratorFunction,
|
|
7407
|
-
'%AsyncGeneratorPrototype%': AsyncGeneratorPrototype,
|
|
7408
|
-
'%AsyncIteratorPrototype%': AsyncIteratorPrototype,
|
|
7409
|
-
'%Generator%': Generator,
|
|
7410
|
-
'%InertGeneratorFunction%': GeneratorFunction,
|
|
7411
|
-
'%IteratorPrototype%': IteratorPrototype,
|
|
7412
|
-
'%MapIteratorPrototype%': MapIteratorPrototype,
|
|
7413
|
-
'%RegExpStringIteratorPrototype%': RegExpStringIteratorPrototype,
|
|
7414
|
-
'%SetIteratorPrototype%': SetIteratorPrototype,
|
|
7415
|
-
'%StringIteratorPrototype%': StringIteratorPrototype,
|
|
7416
|
-
'%ThrowTypeError%': ThrowTypeError,
|
|
7417
|
-
'%TypedArray%': TypedArray,
|
|
7418
|
-
'%InertCompartment%': InertCompartment };
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
return intrinsics;
|
|
7422
|
-
};$h_once.getAnonymousIntrinsics(getAnonymousIntrinsics);
|
|
7423
|
-
})
|
|
7424
|
-
|
|
7425
|
-
,
|
|
7426
|
-
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let TypeError,WeakSet,arrayFilter,defineProperty,entries,freeze,getOwnPropertyDescriptor,getOwnPropertyDescriptors,globalThis,is,isObject,objectHasOwnProperty,values,weaksetHas,constantProperties,sharedGlobalPropertyNames,universalPropertyNames,whitelist;$h_imports([["./commons.js", [["TypeError", [$h_a => (TypeError = $h_a)]],["WeakSet", [$h_a => (WeakSet = $h_a)]],["arrayFilter", [$h_a => (arrayFilter = $h_a)]],["defineProperty", [$h_a => (defineProperty = $h_a)]],["entries", [$h_a => (entries = $h_a)]],["freeze", [$h_a => (freeze = $h_a)]],["getOwnPropertyDescriptor", [$h_a => (getOwnPropertyDescriptor = $h_a)]],["getOwnPropertyDescriptors", [$h_a => (getOwnPropertyDescriptors = $h_a)]],["globalThis", [$h_a => (globalThis = $h_a)]],["is", [$h_a => (is = $h_a)]],["isObject", [$h_a => (isObject = $h_a)]],["objectHasOwnProperty", [$h_a => (objectHasOwnProperty = $h_a)]],["values", [$h_a => (values = $h_a)]],["weaksetHas", [$h_a => (weaksetHas = $h_a)]]]],["./whitelist.js", [["constantProperties", [$h_a => (constantProperties = $h_a)]],["sharedGlobalPropertyNames", [$h_a => (sharedGlobalPropertyNames = $h_a)]],["universalPropertyNames", [$h_a => (universalPropertyNames = $h_a)]],["whitelist", [$h_a => (whitelist = $h_a)]]]]]);
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
const isFunction = (obj) => typeof obj === 'function';
|
|
7451
|
-
|
|
7452
|
-
// Like defineProperty, but throws if it would modify an existing property.
|
|
7453
|
-
// We use this to ensure that two conflicting attempts to define the same
|
|
7454
|
-
// property throws, causing SES initialization to fail. Otherwise, a
|
|
7455
|
-
// conflict between, for example, two of SES's internal whitelists might
|
|
7456
|
-
// get masked as one overwrites the other. Accordingly, the thrown error
|
|
7457
|
-
// complains of a "Conflicting definition".
|
|
7458
|
-
function initProperty(obj, name, desc) {
|
|
7459
|
-
if (objectHasOwnProperty(obj, name)) {
|
|
7460
|
-
const preDesc = getOwnPropertyDescriptor(obj, name);
|
|
7461
|
-
if (
|
|
7462
|
-
!is(preDesc.value, desc.value) ||
|
|
7463
|
-
preDesc.get !== desc.get ||
|
|
7464
|
-
preDesc.set !== desc.set ||
|
|
7465
|
-
preDesc.writable !== desc.writable ||
|
|
7466
|
-
preDesc.enumerable !== desc.enumerable ||
|
|
7467
|
-
preDesc.configurable !== desc.configurable)
|
|
7468
|
-
{
|
|
7469
|
-
throw new TypeError(`Conflicting definitions of ${name}`);
|
|
7470
|
-
}
|
|
7471
|
-
}
|
|
7472
|
-
defineProperty(obj, name, desc);
|
|
7473
|
-
}
|
|
7474
|
-
|
|
7475
|
-
// Like defineProperties, but throws if it would modify an existing property.
|
|
7476
|
-
// This ensures that the intrinsics added to the intrinsics collector object
|
|
7477
|
-
// graph do not overlap.
|
|
7478
|
-
function initProperties(obj, descs) {
|
|
7479
|
-
for (const [name, desc] of entries(descs)) {
|
|
7480
|
-
initProperty(obj, name, desc);
|
|
7481
|
-
}
|
|
7482
|
-
}
|
|
7483
|
-
|
|
7484
|
-
// sampleGlobals creates an intrinsics object, suitable for
|
|
7485
|
-
// interinsicsCollector.addIntrinsics, from the named properties of a global
|
|
7486
|
-
// object.
|
|
7487
|
-
function sampleGlobals(globalObject, newPropertyNames) {
|
|
7488
|
-
const newIntrinsics = { __proto__: null };
|
|
7489
|
-
for (const [globalName, intrinsicName] of entries(newPropertyNames)) {
|
|
7490
|
-
if (objectHasOwnProperty(globalObject, globalName)) {
|
|
7491
|
-
newIntrinsics[intrinsicName] = globalObject[globalName];
|
|
7492
|
-
}
|
|
7493
|
-
}
|
|
7494
|
-
return newIntrinsics;
|
|
7495
|
-
}
|
|
7430
|
+
// sampleGlobals creates an intrinsics object, suitable for
|
|
7431
|
+
// interinsicsCollector.addIntrinsics, from the named properties of a global
|
|
7432
|
+
// object.
|
|
7433
|
+
function sampleGlobals(globalObject, newPropertyNames) {
|
|
7434
|
+
const newIntrinsics = { __proto__: null };
|
|
7435
|
+
for (const [globalName, intrinsicName] of entries(newPropertyNames)) {
|
|
7436
|
+
if (objectHasOwnProperty(globalObject, globalName)) {
|
|
7437
|
+
newIntrinsics[intrinsicName] = globalObject[globalName];
|
|
7438
|
+
}
|
|
7439
|
+
}
|
|
7440
|
+
return newIntrinsics;
|
|
7441
|
+
}
|
|
7496
7442
|
|
|
7497
7443
|
const makeIntrinsicsCollector = () => {
|
|
7498
7444
|
const intrinsics = { __proto__: null };
|
|
@@ -8009,6 +7955,134 @@ overrideDebug = [])
|
|
|
8009
7955
|
}$h_once.default(enablePropertyOverrides);
|
|
8010
7956
|
})
|
|
8011
7957
|
|
|
7958
|
+
,
|
|
7959
|
+
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let arrayPush,arraySlice,freeze,assert;$h_imports([["./commons.js", [["arrayPush", [$h_a => (arrayPush = $h_a)]],["arraySlice", [$h_a => (arraySlice = $h_a)]],["freeze", [$h_a => (freeze = $h_a)]]]],["./error/assert.js", [["assert", [$h_a => (assert = $h_a)]]]]]);
|
|
7960
|
+
|
|
7961
|
+
|
|
7962
|
+
|
|
7963
|
+
|
|
7964
|
+
|
|
7965
|
+
|
|
7966
|
+
const { details: X, quote: q } = assert;
|
|
7967
|
+
|
|
7968
|
+
/**
|
|
7969
|
+
* JavaScript module semantics resists attempts to parameterize a module's
|
|
7970
|
+
* initialization behavior. A module initializes in order according to
|
|
7971
|
+
* the path by which it is first imported, and then the initialized module
|
|
7972
|
+
* is reused by all the other times it is imported. Compartments give us
|
|
7973
|
+
* the opportunity to bind the same import name to different imported
|
|
7974
|
+
* modules, depending on the package/compartment doing the import. Compartments
|
|
7975
|
+
* also address the difficulty of parameterizing a module's initialization
|
|
7976
|
+
* logic, but not in a pleasant manner.
|
|
7977
|
+
*
|
|
7978
|
+
* A pleasant parameterization would be for a static module to be function-like
|
|
7979
|
+
* with explicit parameters, and for the parameterization to be like
|
|
7980
|
+
* calling the static module with parameters in order to derive from it a
|
|
7981
|
+
* module instance. Compartments instead lets us parameterize the meaning
|
|
7982
|
+
* of a module instance derived from a static module according to the
|
|
7983
|
+
* three namespaces provided by the JavaScript semantics, affecting the
|
|
7984
|
+
* meaning of a module instance.
|
|
7985
|
+
* * The global variable namespaces.
|
|
7986
|
+
* * The global scope, aliased to properties of the global object.
|
|
7987
|
+
* This is necessarily compartment-wide, and therefore in our
|
|
7988
|
+
* recommened usage pattern, package-wide.
|
|
7989
|
+
* * The global lexical scope. The SES-shim compartments support
|
|
7990
|
+
* these both compartment-wide as well as per-module. But it is
|
|
7991
|
+
* not yet clear what we will propose in the Compartment proposal.
|
|
7992
|
+
* * The import namespace.
|
|
7993
|
+
* * The host hooks.
|
|
7994
|
+
*
|
|
7995
|
+
* This `environment-options.js` module looks for a setting of an
|
|
7996
|
+
* `optionName` parameter rooted in the global scope. If follows the Node
|
|
7997
|
+
* precedent for finding Unix environment variable settings, looking for a
|
|
7998
|
+
* global `process` object holding an `env` object,
|
|
7999
|
+
* optionally holding a property named for the `optionName` whose value is the
|
|
8000
|
+
* configuration setting of that option. For example, for the optionName
|
|
8001
|
+
* `ALLOW_IMPLICIT_REMOTABLES` it would look in
|
|
8002
|
+
* `globalThis.process.env.ALLOW_IMPLICIT_REMOTABLES`.
|
|
8003
|
+
*
|
|
8004
|
+
* If setting is either absent or `undefined`, that indicates that
|
|
8005
|
+
* this configuration option should have its default behavior, whatever that is.
|
|
8006
|
+
* Otherwise, reflecting Unix environment variables, the setting must be a
|
|
8007
|
+
* string. This also helps ensure that this channel is used only to pass data,
|
|
8008
|
+
* not authority beyond the ability to read this global state.
|
|
8009
|
+
*/
|
|
8010
|
+
|
|
8011
|
+
/**
|
|
8012
|
+
* makeEnvironmentCaptor provides a mechanism for getting environment
|
|
8013
|
+
* variables, if they are needed, and a way to catalog the names of all
|
|
8014
|
+
* the environment variables that were captured.
|
|
8015
|
+
*
|
|
8016
|
+
* @param {Object} aGlobal
|
|
8017
|
+
*/
|
|
8018
|
+
const makeEnvironmentCaptor = (aGlobal) => {
|
|
8019
|
+
const capturedEnvironmentOptionNames = [];
|
|
8020
|
+
|
|
8021
|
+
/**
|
|
8022
|
+
* Gets an environment option by name and returns the option value or the
|
|
8023
|
+
* given default.
|
|
8024
|
+
*
|
|
8025
|
+
* @param {string} optionName
|
|
8026
|
+
* @param {string} defaultSetting
|
|
8027
|
+
* @returns {string}
|
|
8028
|
+
*/
|
|
8029
|
+
const getEnvironmentOption = (optionName, defaultSetting) => {
|
|
8030
|
+
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
8031
|
+
assert.typeof(
|
|
8032
|
+
optionName,
|
|
8033
|
+
'string',
|
|
8034
|
+
X`Environment option name ${q(optionName)} must be a string.`);
|
|
8035
|
+
|
|
8036
|
+
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
8037
|
+
assert.typeof(
|
|
8038
|
+
defaultSetting,
|
|
8039
|
+
'string',
|
|
8040
|
+
X`Environment option default setting ${q(
|
|
8041
|
+
defaultSetting)
|
|
8042
|
+
} must be a string.`);
|
|
8043
|
+
|
|
8044
|
+
|
|
8045
|
+
/** @type {string} */
|
|
8046
|
+
let setting = defaultSetting;
|
|
8047
|
+
const globalProcess = aGlobal.process;
|
|
8048
|
+
if (globalProcess && typeof globalProcess === 'object') {
|
|
8049
|
+
const globalEnv = globalProcess.env;
|
|
8050
|
+
if (globalEnv && typeof globalEnv === 'object') {
|
|
8051
|
+
if (optionName in globalEnv) {
|
|
8052
|
+
arrayPush(capturedEnvironmentOptionNames, optionName);
|
|
8053
|
+
const optionValue = globalEnv[optionName];
|
|
8054
|
+
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
8055
|
+
assert.typeof(
|
|
8056
|
+
optionValue,
|
|
8057
|
+
'string',
|
|
8058
|
+
X`Environment option named ${q(
|
|
8059
|
+
optionName)
|
|
8060
|
+
}, if present, must have a corresponding string value, got ${q(
|
|
8061
|
+
optionValue)
|
|
8062
|
+
}`);
|
|
8063
|
+
|
|
8064
|
+
setting = optionValue;
|
|
8065
|
+
}
|
|
8066
|
+
}
|
|
8067
|
+
}
|
|
8068
|
+
assert(
|
|
8069
|
+
setting === undefined || typeof setting === 'string',
|
|
8070
|
+
X`Environment option value ${q(setting)}, if present, must be a string.`);
|
|
8071
|
+
|
|
8072
|
+
return setting;
|
|
8073
|
+
};
|
|
8074
|
+
freeze(getEnvironmentOption);
|
|
8075
|
+
|
|
8076
|
+
const getCapturedEnvironmentOptionNames = () => {
|
|
8077
|
+
return freeze(arraySlice(capturedEnvironmentOptionNames));
|
|
8078
|
+
};
|
|
8079
|
+
freeze(getCapturedEnvironmentOptionNames);
|
|
8080
|
+
|
|
8081
|
+
return { getEnvironmentOption, getCapturedEnvironmentOptionNames };
|
|
8082
|
+
};$h_once.makeEnvironmentCaptor(makeEnvironmentCaptor);
|
|
8083
|
+
freeze(makeEnvironmentCaptor);
|
|
8084
|
+
})
|
|
8085
|
+
|
|
8012
8086
|
,
|
|
8013
8087
|
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let WeakSet,arrayFilter,arrayMap,arrayPush,defineProperty,freeze,fromEntries,isError,stringEndsWith,weaksetAdd,weaksetHas;$h_imports([["../commons.js", [["WeakSet", [$h_a => (WeakSet = $h_a)]],["arrayFilter", [$h_a => (arrayFilter = $h_a)]],["arrayMap", [$h_a => (arrayMap = $h_a)]],["arrayPush", [$h_a => (arrayPush = $h_a)]],["defineProperty", [$h_a => (defineProperty = $h_a)]],["freeze", [$h_a => (freeze = $h_a)]],["fromEntries", [$h_a => (fromEntries = $h_a)]],["isError", [$h_a => (isError = $h_a)]],["stringEndsWith", [$h_a => (stringEndsWith = $h_a)]],["weaksetAdd", [$h_a => (weaksetAdd = $h_a)]],["weaksetHas", [$h_a => (weaksetHas = $h_a)]]]],["./types.js", []],["./internal-types.js", []]]);
|
|
8014
8088
|
|
|
@@ -8957,6 +9031,147 @@ stackFiltering = 'concise')
|
|
|
8957
9031
|
}$h_once.default(tameErrorConstructor);
|
|
8958
9032
|
})
|
|
8959
9033
|
|
|
9034
|
+
,
|
|
9035
|
+
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let FERAL_FUNCTION,Float32Array,Map,Set,String,getOwnPropertyDescriptor,getPrototypeOf,iterateArray,iterateMap,iterateSet,iterateString,matchAllRegExp,matchAllSymbol,regexpPrototype,InertCompartment;$h_imports([["./commons.js", [["FERAL_FUNCTION", [$h_a => (FERAL_FUNCTION = $h_a)]],["Float32Array", [$h_a => (Float32Array = $h_a)]],["Map", [$h_a => (Map = $h_a)]],["Set", [$h_a => (Set = $h_a)]],["String", [$h_a => (String = $h_a)]],["getOwnPropertyDescriptor", [$h_a => (getOwnPropertyDescriptor = $h_a)]],["getPrototypeOf", [$h_a => (getPrototypeOf = $h_a)]],["iterateArray", [$h_a => (iterateArray = $h_a)]],["iterateMap", [$h_a => (iterateMap = $h_a)]],["iterateSet", [$h_a => (iterateSet = $h_a)]],["iterateString", [$h_a => (iterateString = $h_a)]],["matchAllRegExp", [$h_a => (matchAllRegExp = $h_a)]],["matchAllSymbol", [$h_a => (matchAllSymbol = $h_a)]],["regexpPrototype", [$h_a => (regexpPrototype = $h_a)]]]],["./compartment-shim.js", [["InertCompartment", [$h_a => (InertCompartment = $h_a)]]]]]);
|
|
9036
|
+
|
|
9037
|
+
|
|
9038
|
+
|
|
9039
|
+
|
|
9040
|
+
|
|
9041
|
+
|
|
9042
|
+
|
|
9043
|
+
|
|
9044
|
+
|
|
9045
|
+
|
|
9046
|
+
|
|
9047
|
+
|
|
9048
|
+
|
|
9049
|
+
|
|
9050
|
+
|
|
9051
|
+
|
|
9052
|
+
|
|
9053
|
+
/**
|
|
9054
|
+
* Object.getConstructorOf()
|
|
9055
|
+
* Helper function to improve readability, similar to Object.getPrototypeOf().
|
|
9056
|
+
*
|
|
9057
|
+
* @param {Object} obj
|
|
9058
|
+
*/
|
|
9059
|
+
function getConstructorOf(obj) {
|
|
9060
|
+
return getPrototypeOf(obj).constructor;
|
|
9061
|
+
}
|
|
9062
|
+
|
|
9063
|
+
// getAnonymousIntrinsics uses a utility function to construct an arguments
|
|
9064
|
+
// object, since it cannot have one of its own and also be a const export.
|
|
9065
|
+
function makeArguments() {
|
|
9066
|
+
// eslint-disable-next-line prefer-rest-params
|
|
9067
|
+
return arguments;
|
|
9068
|
+
}
|
|
9069
|
+
|
|
9070
|
+
/**
|
|
9071
|
+
* getAnonymousIntrinsics()
|
|
9072
|
+
* Get the intrinsics not otherwise reachable by named own property
|
|
9073
|
+
* traversal from the global object.
|
|
9074
|
+
*
|
|
9075
|
+
* @returns {Object}
|
|
9076
|
+
*/
|
|
9077
|
+
const getAnonymousIntrinsics = () => {
|
|
9078
|
+
const InertFunction = FERAL_FUNCTION.prototype.constructor;
|
|
9079
|
+
|
|
9080
|
+
// 9.2.4.1 %ThrowTypeError%
|
|
9081
|
+
|
|
9082
|
+
const ThrowTypeError = getOwnPropertyDescriptor(makeArguments(), 'callee').
|
|
9083
|
+
get;
|
|
9084
|
+
|
|
9085
|
+
// 21.1.5.2 The %StringIteratorPrototype% Object
|
|
9086
|
+
|
|
9087
|
+
// eslint-disable-next-line no-new-wrappers
|
|
9088
|
+
const StringIteratorObject = iterateString(new String());
|
|
9089
|
+
const StringIteratorPrototype = getPrototypeOf(StringIteratorObject);
|
|
9090
|
+
|
|
9091
|
+
// 21.2.7.1 The %RegExpStringIteratorPrototype% Object
|
|
9092
|
+
const RegExpStringIterator =
|
|
9093
|
+
regexpPrototype[matchAllSymbol] && matchAllRegExp(/./);
|
|
9094
|
+
const RegExpStringIteratorPrototype =
|
|
9095
|
+
RegExpStringIterator && getPrototypeOf(RegExpStringIterator);
|
|
9096
|
+
|
|
9097
|
+
// 22.1.5.2 The %ArrayIteratorPrototype% Object
|
|
9098
|
+
|
|
9099
|
+
// eslint-disable-next-line no-array-constructor
|
|
9100
|
+
const ArrayIteratorObject = iterateArray([]);
|
|
9101
|
+
const ArrayIteratorPrototype = getPrototypeOf(ArrayIteratorObject);
|
|
9102
|
+
|
|
9103
|
+
// 22.2.1 The %TypedArray% Intrinsic Object
|
|
9104
|
+
|
|
9105
|
+
const TypedArray = getPrototypeOf(Float32Array);
|
|
9106
|
+
|
|
9107
|
+
// 23.1.5.2 The %MapIteratorPrototype% Object
|
|
9108
|
+
|
|
9109
|
+
const MapIteratorObject = iterateMap(new Map());
|
|
9110
|
+
const MapIteratorPrototype = getPrototypeOf(MapIteratorObject);
|
|
9111
|
+
|
|
9112
|
+
// 23.2.5.2 The %SetIteratorPrototype% Object
|
|
9113
|
+
|
|
9114
|
+
const SetIteratorObject = iterateSet(new Set());
|
|
9115
|
+
const SetIteratorPrototype = getPrototypeOf(SetIteratorObject);
|
|
9116
|
+
|
|
9117
|
+
// 25.1.2 The %IteratorPrototype% Object
|
|
9118
|
+
|
|
9119
|
+
const IteratorPrototype = getPrototypeOf(ArrayIteratorPrototype);
|
|
9120
|
+
|
|
9121
|
+
// 25.2.1 The GeneratorFunction Constructor
|
|
9122
|
+
|
|
9123
|
+
// eslint-disable-next-line no-empty-function
|
|
9124
|
+
function* GeneratorFunctionInstance() {}
|
|
9125
|
+
const GeneratorFunction = getConstructorOf(GeneratorFunctionInstance);
|
|
9126
|
+
|
|
9127
|
+
// 25.2.3 Properties of the GeneratorFunction Prototype Object
|
|
9128
|
+
|
|
9129
|
+
const Generator = GeneratorFunction.prototype;
|
|
9130
|
+
|
|
9131
|
+
// 25.3.1 The AsyncGeneratorFunction Constructor
|
|
9132
|
+
|
|
9133
|
+
// eslint-disable-next-line no-empty-function
|
|
9134
|
+
async function* AsyncGeneratorFunctionInstance() {}
|
|
9135
|
+
const AsyncGeneratorFunction = getConstructorOf(
|
|
9136
|
+
AsyncGeneratorFunctionInstance);
|
|
9137
|
+
|
|
9138
|
+
|
|
9139
|
+
// 25.3.2.2 AsyncGeneratorFunction.prototype
|
|
9140
|
+
const AsyncGenerator = AsyncGeneratorFunction.prototype;
|
|
9141
|
+
// 25.5.1 Properties of the AsyncGenerator Prototype Object
|
|
9142
|
+
const AsyncGeneratorPrototype = AsyncGenerator.prototype;
|
|
9143
|
+
const AsyncIteratorPrototype = getPrototypeOf(AsyncGeneratorPrototype);
|
|
9144
|
+
|
|
9145
|
+
// 25.7.1 The AsyncFunction Constructor
|
|
9146
|
+
|
|
9147
|
+
// eslint-disable-next-line no-empty-function
|
|
9148
|
+
async function AsyncFunctionInstance() {}
|
|
9149
|
+
const AsyncFunction = getConstructorOf(AsyncFunctionInstance);
|
|
9150
|
+
|
|
9151
|
+
const intrinsics = {
|
|
9152
|
+
'%InertFunction%': InertFunction,
|
|
9153
|
+
'%ArrayIteratorPrototype%': ArrayIteratorPrototype,
|
|
9154
|
+
'%InertAsyncFunction%': AsyncFunction,
|
|
9155
|
+
'%AsyncGenerator%': AsyncGenerator,
|
|
9156
|
+
'%InertAsyncGeneratorFunction%': AsyncGeneratorFunction,
|
|
9157
|
+
'%AsyncGeneratorPrototype%': AsyncGeneratorPrototype,
|
|
9158
|
+
'%AsyncIteratorPrototype%': AsyncIteratorPrototype,
|
|
9159
|
+
'%Generator%': Generator,
|
|
9160
|
+
'%InertGeneratorFunction%': GeneratorFunction,
|
|
9161
|
+
'%IteratorPrototype%': IteratorPrototype,
|
|
9162
|
+
'%MapIteratorPrototype%': MapIteratorPrototype,
|
|
9163
|
+
'%RegExpStringIteratorPrototype%': RegExpStringIteratorPrototype,
|
|
9164
|
+
'%SetIteratorPrototype%': SetIteratorPrototype,
|
|
9165
|
+
'%StringIteratorPrototype%': StringIteratorPrototype,
|
|
9166
|
+
'%ThrowTypeError%': ThrowTypeError,
|
|
9167
|
+
'%TypedArray%': TypedArray,
|
|
9168
|
+
'%InertCompartment%': InertCompartment };
|
|
9169
|
+
|
|
9170
|
+
|
|
9171
|
+
return intrinsics;
|
|
9172
|
+
};$h_once.getAnonymousIntrinsics(getAnonymousIntrinsics);
|
|
9173
|
+
})
|
|
9174
|
+
|
|
8960
9175
|
,
|
|
8961
9176
|
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let Set,String,TypeError,WeakMap,WeakSet,arrayForEach,freeze,getOwnPropertyDescriptors,getPrototypeOf,isObject,objectHasOwnProperty,ownKeys,setAdd,setForEach,setHas,weakmapGet,weakmapSet,weaksetAdd,weaksetHas;$h_imports([["./commons.js", [["Set", [$h_a => (Set = $h_a)]],["String", [$h_a => (String = $h_a)]],["TypeError", [$h_a => (TypeError = $h_a)]],["WeakMap", [$h_a => (WeakMap = $h_a)]],["WeakSet", [$h_a => (WeakSet = $h_a)]],["arrayForEach", [$h_a => (arrayForEach = $h_a)]],["freeze", [$h_a => (freeze = $h_a)]],["getOwnPropertyDescriptors", [$h_a => (getOwnPropertyDescriptors = $h_a)]],["getPrototypeOf", [$h_a => (getPrototypeOf = $h_a)]],["isObject", [$h_a => (isObject = $h_a)]],["objectHasOwnProperty", [$h_a => (objectHasOwnProperty = $h_a)]],["ownKeys", [$h_a => (ownKeys = $h_a)]],["setAdd", [$h_a => (setAdd = $h_a)]],["setForEach", [$h_a => (setForEach = $h_a)]],["setHas", [$h_a => (setHas = $h_a)]],["weakmapGet", [$h_a => (weakmapGet = $h_a)]],["weakmapSet", [$h_a => (weakmapSet = $h_a)]],["weaksetAdd", [$h_a => (weaksetAdd = $h_a)]],["weaksetHas", [$h_a => (weaksetHas = $h_a)]]]]]);
|
|
8962
9177
|
|
|
@@ -9914,7 +10129,19 @@ markVirtualizedNativeFunction)
|
|
|
9914
10129
|
})
|
|
9915
10130
|
|
|
9916
10131
|
,
|
|
9917
|
-
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let globalThis,is,
|
|
10132
|
+
(({ 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)]]]]]);
|
|
10133
|
+
|
|
10134
|
+
|
|
10135
|
+
|
|
10136
|
+
|
|
10137
|
+
|
|
10138
|
+
|
|
10139
|
+
|
|
10140
|
+
|
|
10141
|
+
|
|
10142
|
+
|
|
10143
|
+
|
|
10144
|
+
|
|
9918
10145
|
|
|
9919
10146
|
|
|
9920
10147
|
|
|
@@ -9957,7 +10184,8 @@ markVirtualizedNativeFunction)
|
|
|
9957
10184
|
|
|
9958
10185
|
const { details: d, quote: q } = assert;
|
|
9959
10186
|
|
|
9960
|
-
|
|
10187
|
+
/** @type {Error=} */
|
|
10188
|
+
let priorLockdown;
|
|
9961
10189
|
|
|
9962
10190
|
// Build a harden() with an empty fringe.
|
|
9963
10191
|
// Gate it on lockdown.
|
|
@@ -9968,8 +10196,6 @@ let firstOptions;
|
|
|
9968
10196
|
*/
|
|
9969
10197
|
const harden = makeHardener();
|
|
9970
10198
|
|
|
9971
|
-
const alreadyHardenedIntrinsics = () => false;
|
|
9972
|
-
|
|
9973
10199
|
/**
|
|
9974
10200
|
* @callback Transform
|
|
9975
10201
|
* @param {string} source
|
|
@@ -9986,44 +10212,17 @@ const alreadyHardenedIntrinsics = () => false;
|
|
|
9986
10212
|
* @param {Object} [options.globalLexicals]
|
|
9987
10213
|
*/
|
|
9988
10214
|
|
|
9989
|
-
/**
|
|
9990
|
-
* @callback CompartmentConstructorMaker
|
|
9991
|
-
* @param {CompartmentConstructorMaker} targetMakeCompartmentConstructor
|
|
9992
|
-
* @param {Object} intrinsics
|
|
9993
|
-
* @param {(func: Function) => void} markVirtualizedNativeFunction
|
|
9994
|
-
* @returns {CompartmentConstructor}
|
|
9995
|
-
*/
|
|
9996
|
-
|
|
9997
10215
|
// TODO https://github.com/endojs/endo/issues/814
|
|
9998
10216
|
// Lockdown currently allows multiple calls provided that the specified options
|
|
9999
10217
|
// of every call agree. With experience, we have observed that lockdown should
|
|
10000
10218
|
// only ever need to be called once and that simplifying lockdown will improve
|
|
10001
10219
|
// the quality of audits.
|
|
10002
10220
|
|
|
10003
|
-
// TODO https://github.com/endojs/endo/issues/815
|
|
10004
|
-
// Lockdown receives makeCompartmentConstructor and compartmentPrototype.
|
|
10005
|
-
// This is a vestige of an earlier version of SES where makeLockdown was called
|
|
10006
|
-
// from two different entry points: one for a layer of SES that had a
|
|
10007
|
-
// Compartment that only supported evaluating programs, and a second layer that
|
|
10008
|
-
// extended Compartment to support modules, but at the expense of entraining a
|
|
10009
|
-
// dependency on Babel.
|
|
10010
|
-
// SES currently externalizes the dependency on Babel and one version of
|
|
10011
|
-
// makeCompartmentConstructor is sufficient for all uses, so this can be
|
|
10012
|
-
// simplified.
|
|
10013
|
-
|
|
10014
10221
|
/**
|
|
10015
|
-
* @param {CompartmentConstructorMaker} makeCompartmentConstructor
|
|
10016
|
-
* @param {Object} compartmentPrototype
|
|
10017
|
-
* @param {() => Object} getAnonymousIntrinsics
|
|
10018
10222
|
* @param {LockdownOptions} [options]
|
|
10019
|
-
* @returns {() =>
|
|
10223
|
+
* @returns {() => void} repairIntrinsics
|
|
10020
10224
|
*/
|
|
10021
|
-
const repairIntrinsics = (
|
|
10022
|
-
makeCompartmentConstructor,
|
|
10023
|
-
compartmentPrototype,
|
|
10024
|
-
getAnonymousIntrinsics,
|
|
10025
|
-
options = {}) =>
|
|
10026
|
-
{
|
|
10225
|
+
const repairIntrinsics = (options = {}) => {
|
|
10027
10226
|
// First time, absent options default to 'safe'.
|
|
10028
10227
|
// Subsequent times, absent options default to first options.
|
|
10029
10228
|
// Thus, all present options must agree with first options.
|
|
@@ -10048,24 +10247,46 @@ options = {}) =>
|
|
|
10048
10247
|
// is useful. See
|
|
10049
10248
|
// [`stackFiltering` options](https://github.com/Agoric/SES-shim/blob/master/packages/ses/lockdown-options.md#stackfiltering-options)
|
|
10050
10249
|
// for an explanation.
|
|
10051
|
-
|
|
10250
|
+
|
|
10251
|
+
const {
|
|
10252
|
+
getEnvironmentOption: getenv,
|
|
10253
|
+
getCapturedEnvironmentOptionNames } =
|
|
10254
|
+
makeEnvironmentCaptor(globalThis);
|
|
10255
|
+
|
|
10052
10256
|
const {
|
|
10257
|
+
errorTaming = getenv('LOCKDOWN_ERROR_TAMING', 'safe'),
|
|
10258
|
+
errorTrapping = getenv('LOCKDOWN_ERROR_TRAPPING', 'platform'),
|
|
10259
|
+
regExpTaming = getenv('LOCKDOWN_REGEXP_TAMING', 'safe'),
|
|
10260
|
+
localeTaming = getenv('LOCKDOWN_LOCALE_TAMING', 'safe'),
|
|
10261
|
+
consoleTaming = getenv('LOCKDOWN_CONSOLE_TAMING', 'safe'),
|
|
10262
|
+
overrideTaming = getenv('LOCKDOWN_OVERRIDE_TAMING', 'moderate'),
|
|
10263
|
+
stackFiltering = getenv('LOCKDOWN_STACK_FILTERING', 'concise'),
|
|
10264
|
+
domainTaming = getenv('LOCKDOWN_DOMAIN_TAMING', 'safe'),
|
|
10265
|
+
overrideDebug = arrayFilter(
|
|
10266
|
+
stringSplit(getenv('LOCKDOWN_OVERRIDE_DEBUG', ''), ','),
|
|
10267
|
+
/** @param {string} debugName */
|
|
10268
|
+
(debugName) => debugName !== ''),
|
|
10269
|
+
|
|
10270
|
+
__allowUnsafeMonkeyPatching__ = getenv(
|
|
10271
|
+
'__LOCKDOWN_ALLOW_UNSAFE_MONKEY_PATCHING__',
|
|
10272
|
+
'safe'),
|
|
10273
|
+
|
|
10053
10274
|
dateTaming = 'safe', // deprecated
|
|
10054
|
-
errorTaming = 'safe',
|
|
10055
10275
|
mathTaming = 'safe', // deprecated
|
|
10056
|
-
errorTrapping = 'platform',
|
|
10057
|
-
regExpTaming = 'safe',
|
|
10058
|
-
localeTaming = 'safe',
|
|
10059
|
-
consoleTaming = 'safe',
|
|
10060
|
-
overrideTaming = 'moderate',
|
|
10061
|
-
overrideDebug = [],
|
|
10062
|
-
stackFiltering = 'concise',
|
|
10063
|
-
domainTaming = 'unsafe', // TODO become 'safe' by default in next-breaking-release.
|
|
10064
|
-
__allowUnsafeMonkeyPatching__ = 'safe',
|
|
10065
|
-
|
|
10066
10276
|
...extraOptions } =
|
|
10067
10277
|
options;
|
|
10068
10278
|
|
|
10279
|
+
const capturedEnvironmentOptionNames = getCapturedEnvironmentOptionNames();
|
|
10280
|
+
if (capturedEnvironmentOptionNames.length > 0) {
|
|
10281
|
+
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
10282
|
+
console.warn(
|
|
10283
|
+
`SES Lockdown using options from environment variables ${enJoin(
|
|
10284
|
+
arrayMap(capturedEnvironmentOptionNames, q),
|
|
10285
|
+
'and')
|
|
10286
|
+
}`);
|
|
10287
|
+
|
|
10288
|
+
}
|
|
10289
|
+
|
|
10069
10290
|
// Assert that only supported options were passed.
|
|
10070
10291
|
// Use Reflect.ownKeys to reject symbol-named properties as well.
|
|
10071
10292
|
const extraOptionsNames = ownKeys(extraOptions);
|
|
@@ -10074,36 +10295,21 @@ options = {}) =>
|
|
|
10074
10295
|
d`lockdown(): non supported option ${q(extraOptionsNames)}`);
|
|
10075
10296
|
|
|
10076
10297
|
|
|
10077
|
-
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
|
-
|
|
10081
|
-
options[name] === firstOptions[name],
|
|
10082
|
-
d`lockdown(): cannot re-invoke with different option ${q(name)}`);
|
|
10083
|
-
|
|
10084
|
-
}
|
|
10085
|
-
return alreadyHardenedIntrinsics;
|
|
10086
|
-
}
|
|
10087
|
-
|
|
10088
|
-
firstOptions = {
|
|
10089
|
-
dateTaming, // deprecated
|
|
10090
|
-
errorTaming,
|
|
10091
|
-
mathTaming, // deprecated
|
|
10092
|
-
regExpTaming,
|
|
10093
|
-
localeTaming,
|
|
10094
|
-
consoleTaming,
|
|
10095
|
-
overrideTaming,
|
|
10096
|
-
overrideDebug,
|
|
10097
|
-
stackFiltering,
|
|
10098
|
-
domainTaming,
|
|
10099
|
-
__allowUnsafeMonkeyPatching__ };
|
|
10298
|
+
assert(
|
|
10299
|
+
priorLockdown === undefined,
|
|
10300
|
+
`Already locked down at ${priorLockdown} (SES_ALREADY_LOCKED_DOWN)`,
|
|
10301
|
+
TypeError);
|
|
10100
10302
|
|
|
10303
|
+
priorLockdown = new TypeError('Prior lockdown (SES_ALREADY_LOCKED_DOWN)');
|
|
10304
|
+
// Tease V8 to generate the stack string and release the closures the stack
|
|
10305
|
+
// trace retained:
|
|
10306
|
+
priorLockdown.stack;
|
|
10101
10307
|
|
|
10102
10308
|
/**
|
|
10103
10309
|
* Because of packagers and bundlers, etc, multiple invocations of lockdown
|
|
10104
10310
|
* might happen in separate instantiations of the source of this module.
|
|
10105
10311
|
* In that case, each one sees its own `firstOptions` variable, so the test
|
|
10106
|
-
* above will not detect that lockdown has already happened.
|
|
10312
|
+
* above will not detect that lockdown has already happened. We
|
|
10107
10313
|
* unreliably test some telltale signs that lockdown has run, to avoid
|
|
10108
10314
|
* trying to lock down a locked down environment. Although the test is
|
|
10109
10315
|
* unreliable, this is consistent with the SES threat model. SES provides
|
|
@@ -10114,12 +10320,7 @@ options = {}) =>
|
|
|
10114
10320
|
* tests without actually locking down counts as corrupting code.
|
|
10115
10321
|
*
|
|
10116
10322
|
* The specifics of what this tests for may change over time, but it
|
|
10117
|
-
* should be consistent with any setting of the lockdown options.
|
|
10118
|
-
* do no checking that the state is consistent with current lockdown
|
|
10119
|
-
* options. So a call to lockdown with one set of options may silently
|
|
10120
|
-
* succeed with a state not reflecting those options, but only
|
|
10121
|
-
* if a previous lockdown happened from something other than this
|
|
10122
|
-
* instance of this module.
|
|
10323
|
+
* should be consistent with any setting of the lockdown options.
|
|
10123
10324
|
*/
|
|
10124
10325
|
const seemsToBeLockedDown = () => {
|
|
10125
10326
|
return (
|
|
@@ -10136,8 +10337,9 @@ options = {}) =>
|
|
|
10136
10337
|
|
|
10137
10338
|
if (seemsToBeLockedDown()) {
|
|
10138
10339
|
// eslint-disable-next-line @endo/no-polymorphic-call
|
|
10139
|
-
|
|
10140
|
-
|
|
10340
|
+
throw new TypeError(
|
|
10341
|
+
`Already locked down but not by this SES instance (SES_MULTIPLE_INSTANCES)`);
|
|
10342
|
+
|
|
10141
10343
|
}
|
|
10142
10344
|
|
|
10143
10345
|
/**
|
|
@@ -10176,6 +10378,7 @@ options = {}) =>
|
|
|
10176
10378
|
optGetStackString = intrinsics['%InitialGetStackString%'];
|
|
10177
10379
|
}
|
|
10178
10380
|
const consoleRecord = tameConsole(
|
|
10381
|
+
// @ts-ignore tameConsole does its own input validation
|
|
10179
10382
|
consoleTaming,
|
|
10180
10383
|
errorTrapping,
|
|
10181
10384
|
optGetStackString);
|
|
@@ -10224,6 +10427,11 @@ options = {}) =>
|
|
|
10224
10427
|
|
|
10225
10428
|
/**
|
|
10226
10429
|
* 3. HARDEN to share the intrinsics.
|
|
10430
|
+
*
|
|
10431
|
+
* We define hardenIntrinsics here so that options are in scope, but return
|
|
10432
|
+
* it to the caller because we intend to eventually allow vetted shims to run
|
|
10433
|
+
* between repairs and the hardening of intrinsics and so we can benchmark
|
|
10434
|
+
* repair separately from hardening.
|
|
10227
10435
|
*/
|
|
10228
10436
|
|
|
10229
10437
|
function hardenIntrinsics() {
|
|
@@ -10231,6 +10439,7 @@ options = {}) =>
|
|
|
10231
10439
|
// TODO consider moving this to the end of the repair phase, and
|
|
10232
10440
|
// therefore before vetted shims rather than afterwards. It is not
|
|
10233
10441
|
// clear yet which is better.
|
|
10442
|
+
// @ts-ignore enablePropertyOverrides does its own input validation
|
|
10234
10443
|
enablePropertyOverrides(intrinsics, overrideTaming, overrideDebug);
|
|
10235
10444
|
|
|
10236
10445
|
if (__allowUnsafeMonkeyPatching__ !== 'unsafe') {
|
|
@@ -10256,38 +10465,16 @@ options = {}) =>
|
|
|
10256
10465
|
};
|
|
10257
10466
|
|
|
10258
10467
|
/**
|
|
10259
|
-
* @param {
|
|
10260
|
-
* @param {Object} compartmentPrototype
|
|
10261
|
-
* @param {() => Object} getAnonymousIntrinsics
|
|
10262
|
-
* @returns {import('../index.js').Lockdown}
|
|
10468
|
+
* @param {LockdownOptions} [options]
|
|
10263
10469
|
*/$h_once.repairIntrinsics(repairIntrinsics);
|
|
10264
|
-
const
|
|
10265
|
-
|
|
10266
|
-
|
|
10267
|
-
|
|
10268
|
-
{
|
|
10269
|
-
/**
|
|
10270
|
-
* @param {LockdownOptions} [options]
|
|
10271
|
-
*/
|
|
10272
|
-
const lockdown = (options = {}) => {
|
|
10273
|
-
const maybeHardenIntrinsics = repairIntrinsics(
|
|
10274
|
-
makeCompartmentConstructor,
|
|
10275
|
-
compartmentPrototype,
|
|
10276
|
-
getAnonymousIntrinsics,
|
|
10277
|
-
options);
|
|
10278
|
-
|
|
10279
|
-
return maybeHardenIntrinsics();
|
|
10280
|
-
};
|
|
10281
|
-
return lockdown;
|
|
10282
|
-
};$h_once.makeLockdown(makeLockdown);
|
|
10470
|
+
const lockdown = (options = {}) => {
|
|
10471
|
+
const hardenIntrinsics = repairIntrinsics(options);
|
|
10472
|
+
hardenIntrinsics();
|
|
10473
|
+
};$h_once.lockdown(lockdown);
|
|
10283
10474
|
})
|
|
10284
10475
|
|
|
10285
10476
|
,
|
|
10286
|
-
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let globalThis,TypeError,assign,tameFunctionToString,getGlobalIntrinsics,
|
|
10287
|
-
|
|
10288
|
-
|
|
10289
|
-
|
|
10290
|
-
|
|
10477
|
+
(({ imports: $h_imports, liveVar: $h_live, onceVar: $h_once, }) => { let globalThis,TypeError,assign,tameFunctionToString,getGlobalIntrinsics,lockdown,makeCompartmentConstructor,assert;$h_imports([["./src/commons.js", [["globalThis", [$h_a => (globalThis = $h_a)]],["TypeError", [$h_a => (TypeError = $h_a)]],["assign", [$h_a => (assign = $h_a)]]]],["./src/tame-function-tostring.js", [["tameFunctionToString", [$h_a => (tameFunctionToString = $h_a)]]]],["./src/intrinsics.js", [["getGlobalIntrinsics", [$h_a => (getGlobalIntrinsics = $h_a)]]]],["./src/lockdown-shim.js", [["lockdown", [$h_a => (lockdown = $h_a)]]]],["./src/compartment-shim.js", [["makeCompartmentConstructor", [$h_a => (makeCompartmentConstructor = $h_a)]]]],["./src/error/assert.js", [["assert", [$h_a => (assert = $h_a)]]]]]);
|
|
10291
10478
|
|
|
10292
10479
|
|
|
10293
10480
|
|
|
@@ -10327,11 +10514,7 @@ markVirtualizedNativeFunction);
|
|
|
10327
10514
|
|
|
10328
10515
|
|
|
10329
10516
|
assign(globalThis, {
|
|
10330
|
-
lockdown
|
|
10331
|
-
makeCompartmentConstructor,
|
|
10332
|
-
CompartmentPrototype,
|
|
10333
|
-
getAnonymousIntrinsics),
|
|
10334
|
-
|
|
10517
|
+
lockdown,
|
|
10335
10518
|
Compartment,
|
|
10336
10519
|
assert });
|
|
10337
10520
|
})
|