@locker/cli 0.28.7 → 0.29.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/dist/index.cjs.js +1 -1
- package/dist/index.mjs.js +1 -1
- package/dist/lws-sandbox.js +2027 -167
- package/package.json +5 -5
package/dist/lws-sandbox.js
CHANGED
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
const {
|
|
29
29
|
assign: ObjectAssign$LWS$1,
|
|
30
30
|
freeze: ObjectFreeze$LWS$1,
|
|
31
|
+
defineProperty: ObjectDefineProperty$LWS,
|
|
31
32
|
defineProperties: ObjectDefineProperties$LWS,
|
|
32
33
|
getOwnPropertyDescriptors: ObjectGetOwnPropertyDescriptors$LWS,
|
|
33
34
|
getOwnPropertySymbols: ObjectGetOwnPropertySymbols$LWS,
|
|
@@ -1369,7 +1370,7 @@
|
|
|
1369
1370
|
// reads identically to what isGaterEnabledFeature stores (register and
|
|
1370
1371
|
// deregister also accept the short form via fullName above). Frozen so a
|
|
1371
1372
|
// consumer cannot mutate the shared array.
|
|
1372
|
-
Object.freeze([`${FEATURE_NAME_PREFIX$LWS}changesSince.260`, `${FEATURE_NAME_PREFIX$LWS}changesSince.262`, `${FEATURE_NAME_PREFIX$LWS}changesSince.264`, `${FEATURE_NAME_PREFIX$LWS}htmlAnchorElementHrefValidation`, `${FEATURE_NAME_PREFIX$LWS}enableSandboxedSameOriginIframe`, `${FEATURE_NAME_PREFIX$LWS}xmlEntityAttackPrologScan`]);
|
|
1373
|
+
Object.freeze([`${FEATURE_NAME_PREFIX$LWS}changesSince.260`, `${FEATURE_NAME_PREFIX$LWS}changesSince.262`, `${FEATURE_NAME_PREFIX$LWS}changesSince.264`, `${FEATURE_NAME_PREFIX$LWS}changesSince.266`, `${FEATURE_NAME_PREFIX$LWS}htmlAnchorElementHrefValidation`, `${FEATURE_NAME_PREFIX$LWS}enableSandboxedSameOriginIframe`, `${FEATURE_NAME_PREFIX$LWS}xmlEntityAttackPrologScan`]);
|
|
1373
1374
|
function registerGaterEnabledFeatures$LWS(lockerGaterEnabledFeatures$LWS) {
|
|
1374
1375
|
if (ArrayIsArray$LWS$1(lockerGaterEnabledFeatures$LWS)) {
|
|
1375
1376
|
lockerGaterEnabledFeatures$LWS.forEach(feature$LWS => gaterEnabledFeatures$LWS.add(fullName$LWS(feature$LWS)));
|
|
@@ -1436,7 +1437,22 @@
|
|
|
1436
1437
|
if (constructor$LWS === ObjectCtor$LWS$1) {
|
|
1437
1438
|
// If the constructor, own or inherited, points to `Object`
|
|
1438
1439
|
// then `target` is not likely a prototype object.
|
|
1439
|
-
|
|
1440
|
+
//
|
|
1441
|
+
// `constructor` is read by prototype-walking destructuring, so
|
|
1442
|
+
// it reflects any writable `constructor` data property anywhere
|
|
1443
|
+
// on the chain, including one owned entirely by sandboxed code.
|
|
1444
|
+
// A genuine plain object (`{}`) reaches `Object` because its
|
|
1445
|
+
// *immediate* prototype IS `Object.prototype`; a real host node
|
|
1446
|
+
// whose `[[Prototype]]` runs through a sandboxed subclass merely
|
|
1447
|
+
// *inherits* a `constructor` the sandbox can repoint to the
|
|
1448
|
+
// captured `Object` (e.g. `Carrier.prototype.constructor = Object`
|
|
1449
|
+
// on a custom element). Requiring the immediate prototype to be
|
|
1450
|
+
// `Object.prototype` keeps `{}` live while denying the forged
|
|
1451
|
+
// signal to such nodes. Failing this check errs toward "static",
|
|
1452
|
+
// the fully-distorted path, so it cannot open a new bypass.
|
|
1453
|
+
if (!isGaterEnabledFeature$LWS('changesSince.266') || ReflectGetPrototypeOf$LWS$1(target$LWS) === ObjectProto$LWS$1) {
|
|
1454
|
+
return true;
|
|
1455
|
+
}
|
|
1440
1456
|
}
|
|
1441
1457
|
// eslint-disable-next-line no-empty
|
|
1442
1458
|
} catch (_unused16$LWS) {}
|
|
@@ -1539,7 +1555,7 @@
|
|
|
1539
1555
|
const PromiseResolve$LWS = PromiseCtor$LWS.resolve.bind(PromiseCtor$LWS);
|
|
1540
1556
|
const PromiseReject$LWS = PromiseCtor$LWS.reject.bind(PromiseCtor$LWS);
|
|
1541
1557
|
toSafeSet$LWS(new SetCtor$LWS$1());
|
|
1542
|
-
/*! version: 0.
|
|
1558
|
+
/*! version: 0.29.0 */
|
|
1543
1559
|
|
|
1544
1560
|
/*!
|
|
1545
1561
|
* Copyright (C) 2019 salesforce.com, inc.
|
|
@@ -1562,6 +1578,24 @@
|
|
|
1562
1578
|
get: AttrProtoValueGetter$LWS,
|
|
1563
1579
|
set: AttrProtoValueSetter$LWS
|
|
1564
1580
|
} = ReflectGetOwnPropertyDescriptor$LWS(AttrProto$LWS, 'value');
|
|
1581
|
+
// Realm-generic structural check for a genuine `Attr` instance: recognizes an
|
|
1582
|
+
// `Attr` minted from ANY realm (e.g. a same-origin iframe's document), unlike
|
|
1583
|
+
// `instanceof Attr`, which only matches instances from the realm that
|
|
1584
|
+
// captured the `Attr` constructor. A real `Attr`, from any realm, carries the
|
|
1585
|
+
// internal slot backing `AttrProtoNameGetter` and the call succeeds; anything
|
|
1586
|
+
// else (including a same-realm impostor with a forged prototype chain)
|
|
1587
|
+
// throws a TypeError ("Illegal invocation").
|
|
1588
|
+
function isAttr$LWS(value$LWS) {
|
|
1589
|
+
if (value$LWS === null || typeof value$LWS !== 'object' && typeof value$LWS !== 'function') {
|
|
1590
|
+
return false;
|
|
1591
|
+
}
|
|
1592
|
+
try {
|
|
1593
|
+
ReflectApply$LWS$1(AttrProtoNameGetter$LWS, value$LWS, []);
|
|
1594
|
+
return true;
|
|
1595
|
+
} catch (_unused$LWS) {
|
|
1596
|
+
return false;
|
|
1597
|
+
}
|
|
1598
|
+
}
|
|
1565
1599
|
function normalizeNamespacedAttributeName$LWS(attrName$LWS) {
|
|
1566
1600
|
const href$LWS = 'href';
|
|
1567
1601
|
// Prevent arbitrary:href from being treated like a valid namespaced href value
|
|
@@ -1595,6 +1629,7 @@
|
|
|
1595
1629
|
get: DocumentProtoCookieGetter$LWS,
|
|
1596
1630
|
set: DocumentProtoCookieSetter$LWS
|
|
1597
1631
|
} = ReflectGetOwnPropertyDescriptor$LWS(DocumentProto$LWS$1, 'cookie');
|
|
1632
|
+
const DocumentProtoCurrentScriptGetter$LWS = ObjectLookupOwnGetter$LWS$1(DocumentProto$LWS$1, 'currentScript');
|
|
1598
1633
|
const DocumentProtoDefaultViewGetter$LWS = ObjectLookupOwnGetter$LWS$1(DocumentProto$LWS$1, 'defaultView');
|
|
1599
1634
|
const DocumentProtoDocumentElementGetter$LWS = ObjectLookupOwnGetter$LWS$1(DocumentProto$LWS$1, 'documentElement');
|
|
1600
1635
|
const DocumentProtoHeadGetter$LWS = ObjectLookupOwnGetter$LWS$1(DocumentProto$LWS$1, 'head');
|
|
@@ -1685,7 +1720,7 @@
|
|
|
1685
1720
|
location$LWS.replace(url$LWS);
|
|
1686
1721
|
}
|
|
1687
1722
|
// eslint-disable-next-line no-empty
|
|
1688
|
-
} catch (
|
|
1723
|
+
} catch (_unused2$LWS) {}
|
|
1689
1724
|
}
|
|
1690
1725
|
return win$LWS;
|
|
1691
1726
|
}
|
|
@@ -1738,7 +1773,7 @@
|
|
|
1738
1773
|
ReflectApply$LWS$1(WindowLocationGetter$LWS, value$LWS, []);
|
|
1739
1774
|
return true;
|
|
1740
1775
|
// eslint-disable-next-line no-empty
|
|
1741
|
-
} catch (
|
|
1776
|
+
} catch (_unused3$LWS) {}
|
|
1742
1777
|
}
|
|
1743
1778
|
return false;
|
|
1744
1779
|
}
|
|
@@ -1920,6 +1955,118 @@
|
|
|
1920
1955
|
get: ElementProtoOuterHTMLGetter$LWS
|
|
1921
1956
|
} = ReflectGetOwnPropertyDescriptor$LWS(ElementProto$LWS, 'outerHTML');
|
|
1922
1957
|
const ElementProtoTagNameGetter$LWS = ObjectLookupOwnGetter$LWS$1(ElementProto$LWS, 'tagName');
|
|
1958
|
+
// Realm-generic structural check for a genuine `Element` instance: recognizes
|
|
1959
|
+
// an `Element` minted from ANY realm (e.g. a same-origin iframe's document),
|
|
1960
|
+
// unlike `instanceof Element`, which only matches instances from the realm
|
|
1961
|
+
// that captured the `Element` constructor. A real `Element`, from any realm,
|
|
1962
|
+
// carries the internal slot backing `ElementProtoTagNameGetter` and the call
|
|
1963
|
+
// succeeds; anything else (including an `Attr` or a same-realm impostor with a
|
|
1964
|
+
// forged prototype chain) throws a TypeError ("Illegal invocation").
|
|
1965
|
+
function isElement$LWS(value$LWS) {
|
|
1966
|
+
if (value$LWS === null || typeof value$LWS !== 'object' && typeof value$LWS !== 'function') {
|
|
1967
|
+
return false;
|
|
1968
|
+
}
|
|
1969
|
+
try {
|
|
1970
|
+
ReflectApply$LWS$1(ElementProtoTagNameGetter$LWS, value$LWS, []);
|
|
1971
|
+
return true;
|
|
1972
|
+
} catch (_unused4$LWS) {
|
|
1973
|
+
return false;
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
// Bounded set of IDL-reflected, slot-backed accessor names from which a
|
|
1977
|
+
// realm-generic WebIDL "brand" witness is derived for an element interface. For
|
|
1978
|
+
// every element interface LWS registers an attribute distortion against, at
|
|
1979
|
+
// least one of these names resolves -- on the interface's own prototype, or a
|
|
1980
|
+
// nearer ancestor than the shared Element/Node bases -- to a native accessor
|
|
1981
|
+
// whose getter reads an internal slot and throws ("Illegal invocation") when
|
|
1982
|
+
// applied to a receiver lacking that slot. 'targetElement' covers the SMIL
|
|
1983
|
+
// animation interfaces (SVGAnimateElement/SVGSetElement), whose own prototypes
|
|
1984
|
+
// expose no slot-backed accessor of their own (it lives on their shared
|
|
1985
|
+
// SVGAnimationElement ancestor). Extend this list when a new distortion targets
|
|
1986
|
+
// an interface none of these accessors reaches.
|
|
1987
|
+
const INTERFACE_BRAND_WITNESS_NAMES$LWS = ['src', 'href', 'data', 'action', 'formAction', 'targetElement'];
|
|
1988
|
+
// A non-instance sentinel. Applying a genuine slot-backed interface accessor to
|
|
1989
|
+
// it must throw; that is how a candidate witness is validated to actually
|
|
1990
|
+
// brand-check, rejecting any lenient accessor that would return undefined
|
|
1991
|
+
// instead of throwing (a lenient witness would match every value and select the
|
|
1992
|
+
// wrong distortion).
|
|
1993
|
+
const BRAND_WITNESS_SENTINEL$LWS = {
|
|
1994
|
+
__proto__: null
|
|
1995
|
+
};
|
|
1996
|
+
const interfaceBrandWitnessCache$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
|
|
1997
|
+
// Sibling-subtype caveat: when the witness is found on an ANCESTOR rather than
|
|
1998
|
+
// on `Ctor.prototype` itself, it is shared by every sibling subtype of that
|
|
1999
|
+
// ancestor. `targetElement` lives on `SVGAnimationElement`, so it witnesses
|
|
2000
|
+
// both `SVGAnimateElement` and `SVGSetElement`, and `isElementOfInterface`
|
|
2001
|
+
// cannot tell those two apart. This is only observable once `instanceof` has
|
|
2002
|
+
// already missed (a repointed-prototype or cross-realm element) AND two such
|
|
2003
|
+
// siblings are registered under the same attribute; today the only overlap is
|
|
2004
|
+
// the SMIL 'attributeName'/'to' distortions, whose sibling implementations are
|
|
2005
|
+
// equivalent, so a substituted sibling applies the same sanitization. Every
|
|
2006
|
+
// HTML interface here has an OWN slot-backed accessor and so is witnessed
|
|
2007
|
+
// exactly. If a future SMIL distortion diverges between siblings, give that
|
|
2008
|
+
// interface an own-prototype witness rather than relying on the shared
|
|
2009
|
+
// ancestor.
|
|
2010
|
+
function deriveInterfaceBrandWitness$LWS(Ctor$LWS) {
|
|
2011
|
+
const proto$LWS = Ctor$LWS === null || Ctor$LWS === undefined ? undefined : Ctor$LWS.prototype;
|
|
2012
|
+
if (proto$LWS === null || typeof proto$LWS !== 'object' && typeof proto$LWS !== 'function') {
|
|
2013
|
+
return null;
|
|
2014
|
+
}
|
|
2015
|
+
for (let i$LWS = 0, {
|
|
2016
|
+
length: length$LWS
|
|
2017
|
+
} = INTERFACE_BRAND_WITNESS_NAMES$LWS; i$LWS < length$LWS; i$LWS += 1) {
|
|
2018
|
+
const name$LWS = INTERFACE_BRAND_WITNESS_NAMES$LWS[i$LWS];
|
|
2019
|
+
let current$LWS = proto$LWS;
|
|
2020
|
+
while (current$LWS !== null && current$LWS !== undefined) {
|
|
2021
|
+
const getter$LWS = ObjectLookupOwnGetter$LWS$1(current$LWS, name$LWS);
|
|
2022
|
+
if (getter$LWS !== undefined) {
|
|
2023
|
+
let brandChecks$LWS = false;
|
|
2024
|
+
try {
|
|
2025
|
+
ReflectApply$LWS$1(getter$LWS, BRAND_WITNESS_SENTINEL$LWS, []);
|
|
2026
|
+
} catch (_unused5$LWS) {
|
|
2027
|
+
brandChecks$LWS = true;
|
|
2028
|
+
}
|
|
2029
|
+
if (brandChecks$LWS) {
|
|
2030
|
+
return getter$LWS;
|
|
2031
|
+
}
|
|
2032
|
+
}
|
|
2033
|
+
current$LWS = ReflectGetPrototypeOf$LWS$1(current$LWS);
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
return null;
|
|
2037
|
+
}
|
|
2038
|
+
// Realm-generic replacement for `value instanceof Ctor` when `Ctor` is a DOM
|
|
2039
|
+
// element-interface constructor. `instanceof` only recognizes instances minted
|
|
2040
|
+
// by the realm that captured `Ctor`; a genuine element created in another realm
|
|
2041
|
+
// -- a same-origin iframe's document, or a detached `createHTMLDocument()`
|
|
2042
|
+
// document owned by another realm -- carries the interface's internal slots yet
|
|
2043
|
+
// fails `instanceof`. This applies one of the interface's own slot-backed
|
|
2044
|
+
// accessors to `value`: a genuine instance of `Ctor`'s interface (or a
|
|
2045
|
+
// subclass), from ANY realm, carries the backing slot and the call succeeds;
|
|
2046
|
+
// anything else (a different interface, or a forged prototype chain a la
|
|
2047
|
+
// `Reflect.construct(Audio, [], HTMLScriptElement)`) throws and is rejected.
|
|
2048
|
+
//
|
|
2049
|
+
// Returns false when no slot-backed witness can be derived for `Ctor`, so a
|
|
2050
|
+
// caller keeps its realm-bound `instanceof` fast path for that entry.
|
|
2051
|
+
function isElementOfInterface$LWS(value$LWS, Ctor$LWS) {
|
|
2052
|
+
if (value$LWS === null || typeof value$LWS !== 'object' && typeof value$LWS !== 'function') {
|
|
2053
|
+
return false;
|
|
2054
|
+
}
|
|
2055
|
+
let witness$LWS = interfaceBrandWitnessCache$LWS.get(Ctor$LWS);
|
|
2056
|
+
if (witness$LWS === undefined) {
|
|
2057
|
+
witness$LWS = deriveInterfaceBrandWitness$LWS(Ctor$LWS);
|
|
2058
|
+
interfaceBrandWitnessCache$LWS.set(Ctor$LWS, witness$LWS);
|
|
2059
|
+
}
|
|
2060
|
+
if (witness$LWS === null) {
|
|
2061
|
+
return false;
|
|
2062
|
+
}
|
|
2063
|
+
try {
|
|
2064
|
+
ReflectApply$LWS$1(witness$LWS, value$LWS, []);
|
|
2065
|
+
return true;
|
|
2066
|
+
} catch (_unused6$LWS) {
|
|
2067
|
+
return false;
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
1923
2070
|
/**
|
|
1924
2071
|
* Removes CSP nonce patterns from a string.
|
|
1925
2072
|
*
|
|
@@ -2024,17 +2171,6 @@
|
|
|
2024
2171
|
// bounded the token but left the regex free to roam the whole 30 KB–2 MB slice.)
|
|
2025
2172
|
const PROLOG_DOCTYPE_INTERNAL_SUBSET_REGEX$LWS = /^<!doctype\s+[^>\s]+\s*\[/;
|
|
2026
2173
|
const PROLOG_DOCTYPE_EXTERNAL_ENTITY_REGEX$LWS = /^<!doctype\s+[^>\s]+\s+(?:system|public)\s/;
|
|
2027
|
-
// Regex to detect a namespaced <script> whose start tag carries an xmlns
|
|
2028
|
-
// declaration. Matches <script or <prefix:script (the leading [<:]), then a
|
|
2029
|
-
// whitespace or `/` separator so decoy tags like <scripting> or <scriptx> are
|
|
2030
|
-
// not matched, then scans the start tag up to xmlns. The gap alternation treats
|
|
2031
|
-
// quoted attribute values as opaque ("[^"]*" and '[^']*') so a `>` inside an
|
|
2032
|
-
// attribute value (e.g. title=">") cannot prematurely end the start tag and let
|
|
2033
|
-
// the real xmlns escape the scan. Requiring xmlns inside the script start tag —
|
|
2034
|
-
// rather than anywhere in the body — is what distinguishes the executable XML
|
|
2035
|
-
// namespaced-script vector from benign HTML that merely mentions "xmlns"
|
|
2036
|
-
// elsewhere (e.g. a sanitizer's attribute allowlist).
|
|
2037
|
-
const NAMESPACED_SCRIPT_XMLNS_REGEX$LWS = /[<:]script[\s/](?:[^>"']|"[^"]*"|'[^']*')*xmlns/;
|
|
2038
2174
|
const DOCTYPE_OPENER$LWS = '<!doctype';
|
|
2039
2175
|
const PI_OPENER$LWS = '<?';
|
|
2040
2176
|
const PI_CLOSER$LWS = '?>';
|
|
@@ -2144,18 +2280,10 @@
|
|
|
2144
2280
|
// when the namespace is XHTML or SVG. The namespace URL itself can be
|
|
2145
2281
|
// obfuscated with XML character entities in attribute values, but the
|
|
2146
2282
|
// xmlns attribute name cannot, so checking for "xmlns" is reliable.
|
|
2147
|
-
//
|
|
2148
|
-
// The xmlns must appear inside the script start tag for the namespace to
|
|
2149
|
-
// apply to that script. An earlier form only checked for a <script> tag and
|
|
2150
|
-
// the substring "xmlns" anywhere in the body; that false-positived on benign
|
|
2151
|
-
// HTML that carries a plain <script> and also mentions "xmlns" in an
|
|
2152
|
-
// unrelated place (a sanitizer's attribute allowlist, an SVG child element,
|
|
2153
|
-
// a string literal). NAMESPACED_SCRIPT_XMLNS_REGEX ties the two together by
|
|
2154
|
-
// scanning from the script start tag to xmlns within the same tag.
|
|
2155
2283
|
// eslint-disable-next-line class-methods-use-this
|
|
2156
2284
|
this.isXMLNamespacedScriptAttack = input$LWS => {
|
|
2157
|
-
const normalizedInput$LWS =
|
|
2158
|
-
return ReflectApply$LWS$1(
|
|
2285
|
+
const normalizedInput$LWS = normalizeInput$LWS(input$LWS);
|
|
2286
|
+
return hasTag$LWS(normalizedInput$LWS, 'script') && ReflectApply$LWS$1(StringProtoIncludes$LWS, normalizedInput$LWS, ['xmlns']);
|
|
2159
2287
|
};
|
|
2160
2288
|
// Detects the iframe+srcdoc substring combination in raw input.
|
|
2161
2289
|
// Any HTML or XML containing both <iframe> and the substring
|
|
@@ -2436,6 +2564,10 @@
|
|
|
2436
2564
|
prototype: HTMLMediaElementProto$LWS
|
|
2437
2565
|
} = HTMLMediaElement;
|
|
2438
2566
|
const HTMLMediaElementProtoSrcSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLMediaElementProto$LWS, 'src');
|
|
2567
|
+
const {
|
|
2568
|
+
get: SVGScriptElementProtoHrefGetter$LWS,
|
|
2569
|
+
set: SVGScriptElementProtoHrefSetter$LWS
|
|
2570
|
+
} = ReflectGetOwnPropertyDescriptor$LWS(SVGScriptElement.prototype, 'href');
|
|
2439
2571
|
const HTMLScriptElementCtor$LWS = HTMLScriptElement;
|
|
2440
2572
|
const {
|
|
2441
2573
|
prototype: HTMLScriptElementProto$LWS
|
|
@@ -2444,6 +2576,34 @@
|
|
|
2444
2576
|
get: HTMLScriptElementProtoSrcGetter$LWS,
|
|
2445
2577
|
set: HTMLScriptElementProtoSrcSetter$LWS
|
|
2446
2578
|
} = ReflectGetOwnPropertyDescriptor$LWS(HTMLScriptElementProto$LWS, 'src');
|
|
2579
|
+
// Realm-generic structural check for a genuine script element (HTML or SVG):
|
|
2580
|
+
// recognizes a real `<script>`/SVG `<script>` minted from ANY realm, unlike
|
|
2581
|
+
// `instanceof HTMLScriptElement`, which is both realm-bound AND forgeable via an
|
|
2582
|
+
// attacker-controlled `newTarget` (e.g. `Reflect.construct(Audio, [],
|
|
2583
|
+
// HTMLScriptElement)` yields a real `<audio>` whose prototype is
|
|
2584
|
+
// `HTMLScriptElement.prototype`, so `instanceof` reports `true` while the object
|
|
2585
|
+
// parses markup like the `<audio>` it truly is). A genuine script element
|
|
2586
|
+
// carries the internal slot backing the native `src`/`href` accessor, so the
|
|
2587
|
+
// call succeeds; a forged element (or any other object) throws a TypeError
|
|
2588
|
+
// ("Illegal invocation") because the WebIDL brand check keys on the real
|
|
2589
|
+
// interface, not the prototype chain.
|
|
2590
|
+
function isScriptElement$LWS(value$LWS) {
|
|
2591
|
+
if (value$LWS === null || typeof value$LWS !== 'object' && typeof value$LWS !== 'function') {
|
|
2592
|
+
return false;
|
|
2593
|
+
}
|
|
2594
|
+
try {
|
|
2595
|
+
ReflectApply$LWS$1(HTMLScriptElementProtoSrcGetter$LWS, value$LWS, []);
|
|
2596
|
+
return true;
|
|
2597
|
+
} catch (_unused7$LWS) {
|
|
2598
|
+
// Not a genuine HTMLScriptElement; fall through to the SVG check.
|
|
2599
|
+
}
|
|
2600
|
+
try {
|
|
2601
|
+
ReflectApply$LWS$1(SVGScriptElementProtoHrefGetter$LWS, value$LWS, []);
|
|
2602
|
+
return true;
|
|
2603
|
+
} catch (_unused8$LWS) {
|
|
2604
|
+
return false;
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2447
2607
|
const {
|
|
2448
2608
|
prototype: HTMLSourceElementProto$LWS
|
|
2449
2609
|
} = HTMLSourceElement;
|
|
@@ -2502,11 +2662,30 @@
|
|
|
2502
2662
|
configurable: true,
|
|
2503
2663
|
// Create a bound function to obscure the getter source as "[native code]".
|
|
2504
2664
|
get: ReflectApply$LWS$1(FunctionProtoBind$LWS, () => {
|
|
2665
|
+
const ownerDoc$LWS = ReflectApply$LWS$1(NodeProtoOwnerDocumentGetter$LWS, script$LWS, []);
|
|
2666
|
+
// W-23527275: this getter is the one-shot trigger LWS arms on the
|
|
2667
|
+
// raw script node; our injected trampoline source
|
|
2668
|
+
// (`document.currentScript.$evaluator$`) reads it when the browser
|
|
2669
|
+
// runs the script at insertion time. Sandboxed code that borrows a
|
|
2670
|
+
// native `text`/`src` setter via `descriptor.set.call(node, value)`
|
|
2671
|
+
// never trips the near-membrane `[[Set]]` trap, so the node's
|
|
2672
|
+
// proxy never goes static and keeps forwarding `has`/`get` to the
|
|
2673
|
+
// live raw node — letting that code poll `'$evaluator$' in node`
|
|
2674
|
+
// and read the property to pull the trigger EARLY, before the
|
|
2675
|
+
// genuine insertion. Only the real trampoline runs with the node
|
|
2676
|
+
// as `document.currentScript`; an early sandbox-side read sees a
|
|
2677
|
+
// different (or null) current script. Reject the read without
|
|
2678
|
+
// evaluating or disarming so the legitimate insertion still fires.
|
|
2679
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
2680
|
+
const currentScript$LWS = ReflectApply$LWS$1(DocumentProtoCurrentScriptGetter$LWS, ownerDoc$LWS, []);
|
|
2681
|
+
if (currentScript$LWS !== script$LWS) {
|
|
2682
|
+
return;
|
|
2683
|
+
}
|
|
2684
|
+
}
|
|
2505
2685
|
// Track the script element evaluation to ensure the element
|
|
2506
2686
|
// is evaluated only once.
|
|
2507
2687
|
evaluatedScriptElements$LWS.add(script$LWS);
|
|
2508
2688
|
deleteScriptEvaluatorProperty$LWS(script$LWS);
|
|
2509
|
-
const ownerDoc$LWS = ReflectApply$LWS$1(NodeProtoOwnerDocumentGetter$LWS, script$LWS, []);
|
|
2510
2689
|
const defaultView$LWS = ReflectApply$LWS$1(DocumentProtoDefaultViewGetter$LWS, ownerDoc$LWS, []);
|
|
2511
2690
|
// We don't need to use something like `WindowLocationGetter()`
|
|
2512
2691
|
// because the 'location' and 'top' property are non-configurable.
|
|
@@ -2637,7 +2816,6 @@
|
|
|
2637
2816
|
removeItem: StorageProtoRemoveItem$LWS,
|
|
2638
2817
|
setItem: StorageProtoSetItem$LWS
|
|
2639
2818
|
} = Storage.prototype;
|
|
2640
|
-
ReflectGetOwnPropertyDescriptor$LWS(SVGScriptElement.prototype, 'href');
|
|
2641
2819
|
|
|
2642
2820
|
// This has to be done 1-by-1 because putting a full file ignore in this file
|
|
2643
2821
|
// will result in dist/index.mjs.js containing the directive and subsequently being
|
|
@@ -2655,7 +2833,7 @@
|
|
|
2655
2833
|
const XhrProtoResponseTextGetter$LWS = ObjectLookupOwnGetter$LWS$1(XhrProto$LWS, 'responseText');
|
|
2656
2834
|
const XhrProtoStatusGetter$LWS = ObjectLookupOwnGetter$LWS$1(XhrProto$LWS, 'status');
|
|
2657
2835
|
ObjectLookupOwnSetter$LWS(XhrProto$LWS, 'withCredentials');
|
|
2658
|
-
/*! version: 0.
|
|
2836
|
+
/*! version: 0.29.0 */
|
|
2659
2837
|
|
|
2660
2838
|
/*!
|
|
2661
2839
|
* Copyright (C) 2019 salesforce.com, inc.
|
|
@@ -2677,6 +2855,36 @@
|
|
|
2677
2855
|
return false;
|
|
2678
2856
|
}
|
|
2679
2857
|
const DISALLOWED_ENDPOINTS_LIST$LWS = ['/aura', '/webruntime'];
|
|
2858
|
+
// Same-origin-only denylist (gated on changesSince.262). These platform-internal
|
|
2859
|
+
// endpoints are blocked only for same-origin requests: a cross-origin request
|
|
2860
|
+
// cannot carry the user's session credentials to this instance's internal
|
|
2861
|
+
// endpoints (W-23009170), so blocking them cross-origin would serve no purpose.
|
|
2862
|
+
// Kept as its own static list — iterated in place, never appended onto
|
|
2863
|
+
// DISALLOWED_ENDPOINTS_LIST — so repeated isAllowedEndpointURL() calls don't grow
|
|
2864
|
+
// the array.
|
|
2865
|
+
const DISALLOWED_SAME_ORIGIN_ENDPOINTS_LIST$LWS = ['/_nc_external', '/force', '/setup'];
|
|
2866
|
+
// Same-origin-only denylist gated on changesSince.266. Blocked same-origin for
|
|
2867
|
+
// the same credential-scoping reason as the 262 list above.
|
|
2868
|
+
//
|
|
2869
|
+
// /webconsole (Platform Web IDE / Web Console) embeds the session sid in a
|
|
2870
|
+
// DOM-readable property; a sandboxed component could open a same-origin iframe
|
|
2871
|
+
// to it (or fetch it) and walk the contentDocument to recover the sid
|
|
2872
|
+
// (W-23508868).
|
|
2873
|
+
//
|
|
2874
|
+
// /auraanalytics is an alias that reaches the same AuraServlet as the always-on
|
|
2875
|
+
// /aura entry, but the /aura string match ('/auraanalytics'.endsWith('/aura')
|
|
2876
|
+
// is false) never catches it. A sandboxed fetch/XHR to it mints a valid session
|
|
2877
|
+
// sid the same way /aura would (W-23858870). Lowercase because matching is done
|
|
2878
|
+
// against the lowercased pathname.
|
|
2879
|
+
//
|
|
2880
|
+
// /005 is the classic User object key-prefix. Its legacy same-origin UI routes
|
|
2881
|
+
// (the /005 list view and the /005/e create/edit form) hand a sandboxed
|
|
2882
|
+
// component a session-bound confirmation token and accept an authenticated POST
|
|
2883
|
+
// that can create an active Salesforce User (W-23891007). No modern LWC uses the
|
|
2884
|
+
// classic key-prefix UI, and the endsWith('/005') || includes('/005/') match
|
|
2885
|
+
// never touches a bare record-id path like /005B00000029kKc, so the
|
|
2886
|
+
// false-positive surface is nil.
|
|
2887
|
+
const DISALLOWED_SAME_ORIGIN_ENDPOINTS_LIST_266$LWS = ['/webconsole', '/auraanalytics', '/005'];
|
|
2680
2888
|
// Endpoints that should not be used as browsing context targets (window.open, iframe.src)
|
|
2681
2889
|
// because they return manipulable content. Unlike fetch/XHR which just return data,
|
|
2682
2890
|
// browsing contexts can be manipulated by attackers to inject malicious DOM.
|
|
@@ -2721,24 +2929,42 @@
|
|
|
2721
2929
|
const locationHref$LWS = rootWindow$LWS$1.location.href;
|
|
2722
2930
|
return loweredResourceValue$LWS === '/' || loweredResourceValue$LWS[0] === '#' || loweredResourceValue$LWS[0] === '?' || ReflectApply$LWS$1(StringProtoStartsWith$LWS, loweredResourceValue$LWS, [`${locationHref$LWS}#`]) || ReflectApply$LWS$1(StringProtoStartsWith$LWS, loweredResourceValue$LWS, [`${locationHref$LWS}?`]);
|
|
2723
2931
|
}
|
|
2932
|
+
// Returns true if loweredPathname targets any endpoint in the list, matching
|
|
2933
|
+
// either an exact tail (`.../aura`) or a subpath (`.../aura/...`).
|
|
2934
|
+
function pathnameTargetsDisallowedEndpoint$LWS(loweredPathname$LWS, disallowedEndpoints$LWS) {
|
|
2935
|
+
for (let i$LWS = 0, {
|
|
2936
|
+
length: length$LWS
|
|
2937
|
+
} = disallowedEndpoints$LWS; i$LWS < length$LWS; i$LWS += 1) {
|
|
2938
|
+
if (ReflectApply$LWS$1(StringProtoEndsWith$LWS, loweredPathname$LWS, [disallowedEndpoints$LWS[i$LWS]]) || ReflectApply$LWS$1(StringProtoIncludes$LWS, loweredPathname$LWS, [`${disallowedEndpoints$LWS[i$LWS]}/`])) {
|
|
2939
|
+
return true;
|
|
2940
|
+
}
|
|
2941
|
+
}
|
|
2942
|
+
return false;
|
|
2943
|
+
}
|
|
2724
2944
|
// Validates that a URL doesn't target disallowed endpoints.
|
|
2725
2945
|
// @TODO: W-7302311 Make paths and domains configurable.
|
|
2726
2946
|
function isAllowedEndpointURL$LWS(parsedURL$LWS) {
|
|
2727
2947
|
const loweredPathname$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, parsedURL$LWS.pathname, []);
|
|
2728
|
-
//
|
|
2729
|
-
// module code is loaded and evaluated (as would be the case for test environments)
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2948
|
+
// The gate checks MUST be done inside the function because the gate may not be enabled
|
|
2949
|
+
// when the module code is loaded and evaluated (as would be the case for test environments).
|
|
2950
|
+
const isSince262Enabled$LWS = isGaterEnabledFeature$LWS('changesSince.262');
|
|
2951
|
+
// Under changesSince.262, cross-origin URLs bypass the denylist entirely — they cannot
|
|
2952
|
+
// carry the user's session credentials to this instance's platform-internal endpoints
|
|
2953
|
+
// (W-23009170). This short-circuit must run before the base denylist so cross-origin
|
|
2954
|
+
// requests to base-list endpoints stay allowed under the gate, matching prior behavior.
|
|
2955
|
+
if (isSince262Enabled$LWS && !isSameOriginURL$LWS(parsedURL$LWS.normalizedURL)) {
|
|
2956
|
+
return true;
|
|
2737
2957
|
}
|
|
2738
|
-
for
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2958
|
+
// The always-on base denylist. Reached for every origin when the gate is off, and for
|
|
2959
|
+
// same-origin URLs when it is on.
|
|
2960
|
+
if (pathnameTargetsDisallowedEndpoint$LWS(loweredPathname$LWS, DISALLOWED_ENDPOINTS_LIST$LWS)) {
|
|
2961
|
+
return false;
|
|
2962
|
+
}
|
|
2963
|
+
if (isSince262Enabled$LWS) {
|
|
2964
|
+
if (pathnameTargetsDisallowedEndpoint$LWS(loweredPathname$LWS, DISALLOWED_SAME_ORIGIN_ENDPOINTS_LIST$LWS)) {
|
|
2965
|
+
return false;
|
|
2966
|
+
}
|
|
2967
|
+
if (isGaterEnabledFeature$LWS('changesSince.266') && pathnameTargetsDisallowedEndpoint$LWS(loweredPathname$LWS, DISALLOWED_SAME_ORIGIN_ENDPOINTS_LIST_266$LWS)) {
|
|
2742
2968
|
return false;
|
|
2743
2969
|
}
|
|
2744
2970
|
}
|
|
@@ -2823,7 +3049,7 @@
|
|
|
2823
3049
|
}
|
|
2824
3050
|
return sanitized$LWS;
|
|
2825
3051
|
}
|
|
2826
|
-
/*! version: 0.
|
|
3052
|
+
/*! version: 0.29.0 */
|
|
2827
3053
|
|
|
2828
3054
|
/*!
|
|
2829
3055
|
* Copyright (C) 2023 salesforce.com, inc.
|
|
@@ -2899,7 +3125,7 @@
|
|
|
2899
3125
|
// swallow
|
|
2900
3126
|
}
|
|
2901
3127
|
const trusted = createPolicy('trusted', policyOptions);
|
|
2902
|
-
/*! version: 0.
|
|
3128
|
+
/*! version: 0.29.0 */
|
|
2903
3129
|
|
|
2904
3130
|
/*!
|
|
2905
3131
|
* Copyright (C) 2019 salesforce.com, inc.
|
|
@@ -3208,7 +3434,7 @@
|
|
|
3208
3434
|
}
|
|
3209
3435
|
return getSanitizerForConfig$LWS(sandboxKey$LWS, 'STRING_BLOB_HTML');
|
|
3210
3436
|
}
|
|
3211
|
-
/*! version: 0.
|
|
3437
|
+
/*! version: 0.29.0 */
|
|
3212
3438
|
|
|
3213
3439
|
/*!
|
|
3214
3440
|
* Copyright (C) 2023 salesforce.com, inc.
|
|
@@ -3328,12 +3554,34 @@
|
|
|
3328
3554
|
const targetElementIsConnected$LWS = ReflectApply$LWS$1(NodeProtoIsConnectedGetter$LWS, targetElement$LWS, []);
|
|
3329
3555
|
const resolvedURL$LWS = resolveURL$LWS(dirty$LWS);
|
|
3330
3556
|
if (targetElementIsConnected$LWS) {
|
|
3331
|
-
//
|
|
3332
|
-
//
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3557
|
+
// changesSince.266 (W-23745390): the legacy passthrough below trusts
|
|
3558
|
+
// "connected + has a src attribute" as a proxy for HTML's unobservable
|
|
3559
|
+
// "already started" flag, i.e. "this script already ran and will never
|
|
3560
|
+
// run again, so passing its raw url straight through is safe". That proxy
|
|
3561
|
+
// is unsound. A script whose `type` is not a JavaScript MIME type bails
|
|
3562
|
+
// out of the "prepare the script element" algorithm BEFORE "already
|
|
3563
|
+
// started" is set, so it is connected and carries a src yet has never
|
|
3564
|
+
// run. Sandboxed code arms such a script (the async path below always
|
|
3565
|
+
// ends up calling setScriptURL), re-assigns .src to a raw url — this
|
|
3566
|
+
// branch then wrote that RAW url to the element and marked it evaluated —
|
|
3567
|
+
// then corrects the type and re-inserts, running the raw url natively in
|
|
3568
|
+
// the MAIN realm with an undistorted document.cookie. The authoritative
|
|
3569
|
+
// `evaluatedScripts.has(targetElement)` check above already short-circuits
|
|
3570
|
+
// every script LWS actually evaluated, so removing this branch only
|
|
3571
|
+
// reroutes scripts we did NOT evaluate through the safe async
|
|
3572
|
+
// sandbox-evaluator path (the attacker's source still runs, but sandboxed).
|
|
3573
|
+
//
|
|
3574
|
+
// The whole block is gated OFF so a mechanical gate-cleanup removes the
|
|
3575
|
+
// hole, not the guard: DELETE THIS ENTIRE `if (!isGaterEnabledFeature(...))`
|
|
3576
|
+
// BLOCK when changesSince.266 graduates.
|
|
3577
|
+
if (!isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
3578
|
+
// When the script is connected and has a .src value it is safe to let
|
|
3579
|
+
// the url passthrough because it will never be evaluated again.
|
|
3580
|
+
if (getURL$LWS(targetElement$LWS)) {
|
|
3581
|
+
evaluatedScripts$LWS.add(targetElement$LWS);
|
|
3582
|
+
setScriptURL$LWS(dirty$LWS);
|
|
3583
|
+
return dirty$LWS;
|
|
3584
|
+
}
|
|
3337
3585
|
}
|
|
3338
3586
|
// There is a small window while the source code is asynchronously fetched but the script may
|
|
3339
3587
|
// have already been placed in the DOM without having yet our blob URL set as the .src value.
|
|
@@ -3350,6 +3598,26 @@
|
|
|
3350
3598
|
__proto__: null,
|
|
3351
3599
|
configurable: true,
|
|
3352
3600
|
get: ReflectApply$LWS$1(FunctionProtoBind$LWS, () => {
|
|
3601
|
+
// W-23527275: this getter is the one-shot trigger armed on the
|
|
3602
|
+
// raw script node; our blob trampoline source
|
|
3603
|
+
// (`document.currentScript['$evaluator$']`) reads it when the
|
|
3604
|
+
// browser runs the injected script at insertion time.
|
|
3605
|
+
// Sandboxed code that borrows a native `src`/`text` setter via
|
|
3606
|
+
// `descriptor.set.call(node, value)` never trips the
|
|
3607
|
+
// near-membrane `[[Set]]` trap, so the node's proxy never goes
|
|
3608
|
+
// static and keeps forwarding `has`/`get` to the live raw node
|
|
3609
|
+
// — letting that code poll and read the property to pull the
|
|
3610
|
+
// trigger EARLY. Only the genuine trampoline runs with the node
|
|
3611
|
+
// as `document.currentScript`; reject an early sandbox-side
|
|
3612
|
+
// read without evaluating or disarming so the legitimate
|
|
3613
|
+
// insertion still fires.
|
|
3614
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
3615
|
+
const ownerDoc$LWS = ReflectApply$LWS$1(NodeProtoOwnerDocumentGetter$LWS, targetElement$LWS, []);
|
|
3616
|
+
const currentScript$LWS = ReflectApply$LWS$1(DocumentProtoCurrentScriptGetter$LWS, ownerDoc$LWS, []);
|
|
3617
|
+
if (currentScript$LWS !== targetElement$LWS) {
|
|
3618
|
+
return;
|
|
3619
|
+
}
|
|
3620
|
+
}
|
|
3353
3621
|
ReflectDeleteProperty$LWS$1(targetElement$LWS, EVALUATOR_PROPERTY_KEY$LWS);
|
|
3354
3622
|
URLRevokeObjectURL$LWS(safeURL$LWS);
|
|
3355
3623
|
const cachedURL$LWS = scriptURLsCache$LWS.get(targetElement$LWS);
|
|
@@ -3417,7 +3685,7 @@
|
|
|
3417
3685
|
ReflectApply$LWS$1(ElementProtoSetAttributeNS$LWS, targetElement$LWS, [attributeNamespaceURI$LWS, attributeName$LWS, src$LWS]);
|
|
3418
3686
|
};
|
|
3419
3687
|
}
|
|
3420
|
-
/*! version: 0.
|
|
3688
|
+
/*! version: 0.29.0 */
|
|
3421
3689
|
|
|
3422
3690
|
/*!
|
|
3423
3691
|
* Copyright (C) 2019 salesforce.com, inc.
|
|
@@ -3985,6 +4253,19 @@
|
|
|
3985
4253
|
}
|
|
3986
4254
|
return returnValue$LWS;
|
|
3987
4255
|
}, ElementProtoToggleAttribute$LWS);
|
|
4256
|
+
// These accessors resolve the reflected property against a prototype chain
|
|
4257
|
+
// (`ReflectGetPrototypeOf(...)`) and invoke the resolved getter/setter with
|
|
4258
|
+
// that same object as the receiver. Deriving that receiver from `this`
|
|
4259
|
+
// makes the accessor receiver-relative: because it is installed as an OWN
|
|
4260
|
+
// property on `instance`, sandbox code can lift it off the descriptor and
|
|
4261
|
+
// re-target it (`getter.call(document)`). The accessor then walks a foreign
|
|
4262
|
+
// object's prototype chain to a native, un-distorted getter — e.g.
|
|
4263
|
+
// `Document.prototype.cookie` — with that foreign object as the receiver,
|
|
4264
|
+
// returning the raw host value and bypassing the sandbox's distortion.
|
|
4265
|
+
// Pin the receiver to the `instance` the accessor was installed on so the
|
|
4266
|
+
// read/write can never be steered onto another host object. Gated so the
|
|
4267
|
+
// pre-existing behavior remains available while the change rolls out.
|
|
4268
|
+
const pinReceiverToInstance$LWS = isGaterEnabledFeature$LWS('changesSince.266');
|
|
3988
4269
|
// `observedAttributesDifference` is a safe Set.
|
|
3989
4270
|
for (const originalAttrName$LWS of observedAttributesDifference$LWS) {
|
|
3990
4271
|
// Here we're ensuring support for attributes which have very explicit
|
|
@@ -4003,24 +4284,26 @@
|
|
|
4003
4284
|
enumerable: true,
|
|
4004
4285
|
configurable: true,
|
|
4005
4286
|
get() {
|
|
4006
|
-
|
|
4287
|
+
const receiver$LWS = pinReceiverToInstance$LWS ? instance$LWS : this;
|
|
4288
|
+
return ReflectGet$LWS(ReflectGetPrototypeOf$LWS$1(receiver$LWS), attrPropName$LWS, receiver$LWS);
|
|
4007
4289
|
},
|
|
4008
4290
|
set(value$LWS) {
|
|
4291
|
+
const receiver$LWS = pinReceiverToInstance$LWS ? instance$LWS : this;
|
|
4009
4292
|
// This is necessary for both comparing the old attribute
|
|
4010
4293
|
// value to the new attribute value and then for use in the
|
|
4011
4294
|
// arguments that are passed to attributeChangedCallback.
|
|
4012
|
-
const oldValue$LWS = ReflectApply$LWS$1(ElementProtoGetAttribute$LWS,
|
|
4295
|
+
const oldValue$LWS = ReflectApply$LWS$1(ElementProtoGetAttribute$LWS, receiver$LWS, [originalAttrName$LWS]);
|
|
4013
4296
|
// Because property assignment to special built-in setters
|
|
4014
4297
|
// may have "magic" behavior to determine the actual value
|
|
4015
4298
|
// that gets set, we need to invoke the original setter,
|
|
4016
4299
|
// then get the new attribute value for comparison.
|
|
4017
4300
|
// If _that_ value is different from the old value, then we
|
|
4018
4301
|
// trigger the attributeChangedCallback
|
|
4019
|
-
// ReflectApply(originalSetter,
|
|
4020
|
-
ReflectSet$LWS(ReflectGetPrototypeOf$LWS$1(
|
|
4021
|
-
const newValue$LWS = ReflectApply$LWS$1(ElementProtoGetAttribute$LWS,
|
|
4302
|
+
// ReflectApply(originalSetter, receiver, [value]);
|
|
4303
|
+
ReflectSet$LWS(ReflectGetPrototypeOf$LWS$1(receiver$LWS), attrPropName$LWS, value$LWS, receiver$LWS);
|
|
4304
|
+
const newValue$LWS = ReflectApply$LWS$1(ElementProtoGetAttribute$LWS, receiver$LWS, [originalAttrName$LWS]);
|
|
4022
4305
|
if (oldValue$LWS !== newValue$LWS) {
|
|
4023
|
-
ReflectApply$LWS$1(attributeChangedCallback$LWS,
|
|
4306
|
+
ReflectApply$LWS$1(attributeChangedCallback$LWS, receiver$LWS, [originalAttrName$LWS, oldValue$LWS, newValue$LWS]);
|
|
4024
4307
|
}
|
|
4025
4308
|
}
|
|
4026
4309
|
});
|
|
@@ -4165,6 +4448,68 @@
|
|
|
4165
4448
|
const DataTransferProtoBlockedProperties$LWS = ['mozCursor', 'mozSourceNode', 'mozUserCancelled'];
|
|
4166
4449
|
const attributeDistortionFactoriesCache$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1());
|
|
4167
4450
|
const sandboxAttributeDistortionRegistryCache$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
|
|
4451
|
+
// =============================================================================
|
|
4452
|
+
// Prototype-independent, realm-generic element-kind matching
|
|
4453
|
+
// (W-23729707 + W-23768065)
|
|
4454
|
+
//
|
|
4455
|
+
// Attribute distortions are keyed by element constructor and were selected
|
|
4456
|
+
// purely via `element instanceof Ctor`, which walks the element's *live*
|
|
4457
|
+
// [[Prototype]] chain and is bound to the realm that captured `Ctor`. Two
|
|
4458
|
+
// distinct situations defeat that check while the browser still honors the
|
|
4459
|
+
// element's native internal slot, silently deselecting a security-relevant
|
|
4460
|
+
// distortion so the write/read falls through to the raw native accessor:
|
|
4461
|
+
//
|
|
4462
|
+
// 1. Repointed [[Prototype]] (W-23729707): a sandboxed caller repoints a
|
|
4463
|
+
// same-document native element's prototype (e.g. LWC's failed-hydration
|
|
4464
|
+
// recovery leaving a <script>'s prototype pointed at a component bridge,
|
|
4465
|
+
// W-23722850), so `instanceof` reports false for an element that still
|
|
4466
|
+
// lives in the sandbox's own document.
|
|
4467
|
+
// 2. Cross-realm orphan document (W-23768065): a genuine element minted in
|
|
4468
|
+
// another realm — e.g. a <script> from an iframe's
|
|
4469
|
+
// `document.implementation.createHTMLDocument()`, whose detached owner
|
|
4470
|
+
// document never receives an attribute-distortion registry — carries the
|
|
4471
|
+
// interface's internal slots but fails the sandbox realm's `instanceof`
|
|
4472
|
+
// and has no ownerDocument registry to fall back to.
|
|
4473
|
+
//
|
|
4474
|
+
// The internal slot cannot be moved by repointing [[Prototype]] and is not
|
|
4475
|
+
// realm-bound. `isElementOfInterface` (shared-dom) applies one of the
|
|
4476
|
+
// interface's own slot-backed accessors to the receiver: it succeeds for a
|
|
4477
|
+
// genuine instance of `Ctor`'s interface from ANY realm and throws for anything
|
|
4478
|
+
// lacking the slot (an unrelated interface, or a forged prototype chain).
|
|
4479
|
+
// `elementMatchesCtor` keeps `instanceof` as the fast path and, when the caller
|
|
4480
|
+
// opts in via `allowBrandCheck`, ADDS this brand-check as a fallback that only
|
|
4481
|
+
// ever grants additional matches — never removes one.
|
|
4482
|
+
//
|
|
4483
|
+
// The callers own where the fallback is allowed (see
|
|
4484
|
+
// getAttributeSetterDistortion / getAttributeGetterDistortion): a same-document
|
|
4485
|
+
// instanceof miss (case 1) and a cross-realm miss with no usable ownerDocument
|
|
4486
|
+
// registry (case 2). The established changesSince.262 cross-realm ownerDocument
|
|
4487
|
+
// fallback is still consulted first and unchanged, so navigated-iframe elements
|
|
4488
|
+
// keep selecting via their own document's registry exactly as before.
|
|
4489
|
+
//
|
|
4490
|
+
// Gated changesSince.266; when the gate is off the fallback is inert and
|
|
4491
|
+
// selection is byte-identical to the pre-fix instanceof-only behavior.
|
|
4492
|
+
// =============================================================================
|
|
4493
|
+
function elementMatchesCtor$LWS(element$LWS, Ctor$LWS, allowBrandCheck$LWS) {
|
|
4494
|
+
// Fast path (all gates): an intact prototype chain answers definitively and
|
|
4495
|
+
// matches the pre-fix behavior exactly.
|
|
4496
|
+
if (element$LWS instanceof Ctor$LWS) {
|
|
4497
|
+
return true;
|
|
4498
|
+
}
|
|
4499
|
+
// Brand-check fallback: consulted only when the caller opts in
|
|
4500
|
+
// (allowBrandCheck) and changesSince.266 is enabled. `isElementOfInterface`
|
|
4501
|
+
// is realm-generic and tamper-resistant — it applies one of the interface's
|
|
4502
|
+
// own slot-backed accessors to `element`, succeeding for a genuine instance
|
|
4503
|
+
// of Ctor's interface from ANY realm and throwing otherwise. This single
|
|
4504
|
+
// check covers both opt-in callers: a same-document element whose
|
|
4505
|
+
// [[Prototype]] was repointed (W-23729707) and a genuinely cross-realm
|
|
4506
|
+
// element whose owning document carries no distortion registry (W-23768065).
|
|
4507
|
+
// Gate OFF: returns false, so selection stays instanceof-only.
|
|
4508
|
+
if (!allowBrandCheck$LWS || !isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
4509
|
+
return false;
|
|
4510
|
+
}
|
|
4511
|
+
return isElementOfInterface$LWS(element$LWS, Ctor$LWS);
|
|
4512
|
+
}
|
|
4168
4513
|
function finalizeAttributeSetterDistortions$LWS(record$LWS) {
|
|
4169
4514
|
const attributeFactories$LWS = attributeDistortionFactoriesCache$LWS.get(record$LWS);
|
|
4170
4515
|
// istanbul ignore if: currently unreachable via tests
|
|
@@ -4193,7 +4538,7 @@
|
|
|
4193
4538
|
attributeFactories$LWS[i$LWS](attributeDistortionRegistry$LWS);
|
|
4194
4539
|
}
|
|
4195
4540
|
}
|
|
4196
|
-
function lookupAttributeDistortion$LWS(document$LWS, key$LWS, element$LWS, attrName$LWS, attributeNamespace$LWS) {
|
|
4541
|
+
function lookupAttributeDistortion$LWS(document$LWS, key$LWS, element$LWS, attrName$LWS, attributeNamespace$LWS, allowBrandCheck$LWS) {
|
|
4197
4542
|
const sandboxAttributeDistortionRegistry$LWS = sandboxAttributeDistortionRegistryCache$LWS.get(document$LWS);
|
|
4198
4543
|
// istanbul ignore if: currently unreachable via tests
|
|
4199
4544
|
if (sandboxAttributeDistortionRegistry$LWS === undefined) {
|
|
@@ -4219,7 +4564,11 @@
|
|
|
4219
4564
|
} of mapIterator$LWS) {
|
|
4220
4565
|
// Element can inherit from Ctor but Ctor may not be the first entry in
|
|
4221
4566
|
// the proto chain thus element.prototype checks are not sufficient.
|
|
4222
|
-
|
|
4567
|
+
// elementMatchesCtor uses instanceof as the fast path and, when
|
|
4568
|
+
// allowBrandCheck is set (same-document element, changesSince.266), a
|
|
4569
|
+
// tamper-resistant brand-check fallback so a repointed [[Prototype]]
|
|
4570
|
+
// cannot deselect this distortion.
|
|
4571
|
+
if (elementMatchesCtor$LWS(element$LWS, Ctor$LWS, allowBrandCheck$LWS)) {
|
|
4223
4572
|
return distortion$LWS;
|
|
4224
4573
|
}
|
|
4225
4574
|
}
|
|
@@ -4230,26 +4579,55 @@
|
|
|
4230
4579
|
document: document$LWS,
|
|
4231
4580
|
key: key$LWS
|
|
4232
4581
|
} = record$LWS;
|
|
4233
|
-
|
|
4582
|
+
// Fast path: instanceof-only selection in the sandbox document. Legitimate
|
|
4583
|
+
// elements match here without any extra work, so the common path is
|
|
4584
|
+
// unchanged from the pre-fix behavior.
|
|
4585
|
+
const result$LWS = lookupAttributeDistortion$LWS(document$LWS, key$LWS, element$LWS, attrName$LWS, attributeNamespace$LWS, false);
|
|
4234
4586
|
if (result$LWS !== undefined) {
|
|
4235
4587
|
return result$LWS;
|
|
4236
4588
|
}
|
|
4237
|
-
//
|
|
4238
|
-
//
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4589
|
+
// instanceof missed. Read the element's owning document (a tamper-resistant
|
|
4590
|
+
// Node getter) to distinguish the two ways that can happen:
|
|
4591
|
+
const elementDocument$LWS = ReflectApply$LWS$1(NodeProtoOwnerDocumentGetter$LWS, element$LWS, []);
|
|
4592
|
+
if (elementDocument$LWS === document$LWS) {
|
|
4593
|
+
// Same document: in the sandbox's own document the only way instanceof
|
|
4594
|
+
// fails is a repointed [[Prototype]] (W-23722850's hydrateComponent
|
|
4595
|
+
// brand-strip). Re-select with the tamper-resistant brand-check so the
|
|
4596
|
+
// security-relevant distortion still fires. Gated changesSince.266.
|
|
4597
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
4598
|
+
return lookupAttributeDistortion$LWS(document$LWS, key$LWS, element$LWS, attrName$LWS, attributeNamespace$LWS, true);
|
|
4599
|
+
}
|
|
4600
|
+
return undefined;
|
|
4601
|
+
}
|
|
4602
|
+
// Different document: the element was passed to a setAttribute function
|
|
4603
|
+
// from a different realm (e.g. cross-realm setAttribute obtained via a
|
|
4604
|
+
// navigated iframe); the instanceof check fails because the registry's
|
|
4605
|
+
// constructors belong to the function's realm, not the element's. Fall back
|
|
4606
|
+
// to the element's ownerDocument registry where constructors match the
|
|
4607
|
+
// element's prototype chain — instanceof-only, exactly as before.
|
|
4243
4608
|
//
|
|
4244
4609
|
// Gated changesSince.262 because the cross-realm fallback was introduced
|
|
4245
4610
|
// in the 262 train alongside the other cross-realm hardening; lowering
|
|
4246
4611
|
// the gate here would re-expose 262 sandboxes to the cross-realm
|
|
4247
4612
|
// bypass class this fallback closes.
|
|
4248
|
-
if (isGaterEnabledFeature$LWS('changesSince.262')) {
|
|
4249
|
-
const
|
|
4250
|
-
if (
|
|
4251
|
-
return
|
|
4252
|
-
}
|
|
4613
|
+
if (isGaterEnabledFeature$LWS('changesSince.262') && elementDocument$LWS) {
|
|
4614
|
+
const crossRealmResult$LWS = lookupAttributeDistortion$LWS(elementDocument$LWS, key$LWS, element$LWS, attrName$LWS, attributeNamespace$LWS, false);
|
|
4615
|
+
if (crossRealmResult$LWS !== undefined) {
|
|
4616
|
+
return crossRealmResult$LWS;
|
|
4617
|
+
}
|
|
4618
|
+
}
|
|
4619
|
+
// W-23768065: the cross-realm ownerDocument fallback found nothing — either
|
|
4620
|
+
// the element's owning document carries no distortion registry (an orphan
|
|
4621
|
+
// `createHTMLDocument()` document is never sandbox-registered) or its
|
|
4622
|
+
// instanceof-only lookup missed. Re-select against THIS sandbox document's
|
|
4623
|
+
// registry with the realm-generic brand-check so a genuine foreign-realm
|
|
4624
|
+
// element (e.g. that orphan document's <script>) still selects the
|
|
4625
|
+
// distortion instead of falling through to the raw native setter. Sound
|
|
4626
|
+
// because the brand witness is interface-specific and realm-agnostic (see
|
|
4627
|
+
// elementMatchesCtor). Gated changesSince.266; inert when off, leaving the
|
|
4628
|
+
// 262 behavior above unchanged.
|
|
4629
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
4630
|
+
return lookupAttributeDistortion$LWS(document$LWS, key$LWS, element$LWS, attrName$LWS, attributeNamespace$LWS, true);
|
|
4253
4631
|
}
|
|
4254
4632
|
return undefined;
|
|
4255
4633
|
}
|
|
@@ -4311,7 +4689,7 @@
|
|
|
4311
4689
|
factories$LWS[i$LWS](registry$LWS);
|
|
4312
4690
|
}
|
|
4313
4691
|
}
|
|
4314
|
-
function lookupAttributeGetterIn$LWS(document$LWS, key$LWS, element$LWS, attrName$LWS, attributeNamespace$LWS) {
|
|
4692
|
+
function lookupAttributeGetterIn$LWS(document$LWS, key$LWS, element$LWS, attrName$LWS, attributeNamespace$LWS, allowBrandCheck$LWS) {
|
|
4315
4693
|
const sandboxRegistry$LWS = sandboxAttributeGetterRegistryCache$LWS.get(document$LWS);
|
|
4316
4694
|
if (sandboxRegistry$LWS === undefined) {
|
|
4317
4695
|
return undefined;
|
|
@@ -4333,7 +4711,11 @@
|
|
|
4333
4711
|
0: Ctor$LWS,
|
|
4334
4712
|
1: getter$LWS
|
|
4335
4713
|
} of it$LWS) {
|
|
4336
|
-
|
|
4714
|
+
// Prototype-independent selection, mirroring the setter registry: a
|
|
4715
|
+
// repointed [[Prototype]] must not deselect a read-side (e.g. nonce)
|
|
4716
|
+
// getter distortion either. allowBrandCheck is scoped to same-document
|
|
4717
|
+
// elements by the caller. See elementMatchesCtor.
|
|
4718
|
+
if (elementMatchesCtor$LWS(element$LWS, Ctor$LWS, allowBrandCheck$LWS)) {
|
|
4337
4719
|
return getter$LWS;
|
|
4338
4720
|
}
|
|
4339
4721
|
}
|
|
@@ -4348,20 +4730,43 @@
|
|
|
4348
4730
|
document: document$LWS,
|
|
4349
4731
|
key: key$LWS
|
|
4350
4732
|
} = record$LWS;
|
|
4351
|
-
|
|
4733
|
+
// Fast path: instanceof-only selection in the sandbox document (unchanged).
|
|
4734
|
+
const direct$LWS = lookupAttributeGetterIn$LWS(document$LWS, key$LWS, element$LWS, normalizedName$LWS, attributeNamespace$LWS, false);
|
|
4352
4735
|
if (direct$LWS !== undefined) {
|
|
4353
4736
|
return direct$LWS;
|
|
4354
4737
|
}
|
|
4738
|
+
// instanceof missed. Distinguish a repointed same-document element from a
|
|
4739
|
+
// genuinely cross-realm one by comparing owning documents (see
|
|
4740
|
+
// getAttributeSetterDistortion for the full rationale).
|
|
4741
|
+
const elementDocument$LWS = ReflectApply$LWS$1(NodeProtoOwnerDocumentGetter$LWS, element$LWS, []);
|
|
4742
|
+
if (elementDocument$LWS === document$LWS) {
|
|
4743
|
+
// Same document: re-select with the tamper-resistant brand-check so a
|
|
4744
|
+
// repointed [[Prototype]] cannot deselect a read-side (e.g. nonce)
|
|
4745
|
+
// getter distortion. Gated changesSince.266.
|
|
4746
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
4747
|
+
return lookupAttributeGetterIn$LWS(document$LWS, key$LWS, element$LWS, normalizedName$LWS, attributeNamespace$LWS, true);
|
|
4748
|
+
}
|
|
4749
|
+
return undefined;
|
|
4750
|
+
}
|
|
4355
4751
|
// Cross-realm fallback: same shape as the setter registry's, gated 262
|
|
4356
4752
|
// for the same reason. Nonce protection on the getter side relies on
|
|
4357
4753
|
// this fallback firing for cross-realm reads at 262 sandboxes;
|
|
4358
4754
|
// raising this gate would re-leak nonce through cross-realm Element
|
|
4359
|
-
// instances on that gate.
|
|
4360
|
-
if (isGaterEnabledFeature$LWS('changesSince.262')) {
|
|
4361
|
-
const
|
|
4362
|
-
if (
|
|
4363
|
-
return
|
|
4364
|
-
}
|
|
4755
|
+
// instances on that gate. instanceof-only, exactly as before.
|
|
4756
|
+
if (isGaterEnabledFeature$LWS('changesSince.262') && elementDocument$LWS) {
|
|
4757
|
+
const crossRealmGetter$LWS = lookupAttributeGetterIn$LWS(elementDocument$LWS, key$LWS, element$LWS, normalizedName$LWS, attributeNamespace$LWS, false);
|
|
4758
|
+
if (crossRealmGetter$LWS !== undefined) {
|
|
4759
|
+
return crossRealmGetter$LWS;
|
|
4760
|
+
}
|
|
4761
|
+
}
|
|
4762
|
+
// W-23768065: mirror the setter side. When the cross-realm ownerDocument
|
|
4763
|
+
// fallback finds no getter (orphan/registry-less document), re-select
|
|
4764
|
+
// against THIS sandbox document's registry with the realm-generic
|
|
4765
|
+
// brand-check so read-side overrides (e.g. nonce masking, iframe pending
|
|
4766
|
+
// src) still fire for a genuine foreign-realm element. Gated
|
|
4767
|
+
// changesSince.266; inert when off.
|
|
4768
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
4769
|
+
return lookupAttributeGetterIn$LWS(document$LWS, key$LWS, element$LWS, normalizedName$LWS, attributeNamespace$LWS, true);
|
|
4365
4770
|
}
|
|
4366
4771
|
return undefined;
|
|
4367
4772
|
}
|
|
@@ -4867,6 +5272,7 @@
|
|
|
4867
5272
|
return false;
|
|
4868
5273
|
}
|
|
4869
5274
|
let possiblyRestrictedConstructor$LWS = getUnmaskedFunction$LWS(eventTarget$LWS.constructor);
|
|
5275
|
+
const restrictedCtors$LWS = restrictedEventTargetRegistry$LWS[eventName$LWS];
|
|
4870
5276
|
// Walk UP the proto chain to check if super classes have a restriction on this event.
|
|
4871
5277
|
// This can happen in cases where HTMLElement is the event target constructor, but
|
|
4872
5278
|
// the event listener is being added to HTMLDivElement. Since we obviously want to
|
|
@@ -4874,7 +5280,14 @@
|
|
|
4874
5280
|
// walk up from the HTMLDivElement until we find the constructor for which we
|
|
4875
5281
|
// registered a restriction.
|
|
4876
5282
|
while (possiblyRestrictedConstructor$LWS !== null) {
|
|
4877
|
-
|
|
5283
|
+
// A custom element (every LWC component) extends a pivot class whose base
|
|
5284
|
+
// constructor is sourced from the sandbox custom-element registry. That
|
|
5285
|
+
// constructor is a DIFFERENT object than the one registered here from the
|
|
5286
|
+
// sandbox record, so a constructor-identity match misses at the HTMLElement
|
|
5287
|
+
// hop and the walk climbs past it. The two constructors share the SAME
|
|
5288
|
+
// `prototype` object, so we also match on the constructor's prototype, which
|
|
5289
|
+
// is stable across that boundary.
|
|
5290
|
+
if (restrictedCtors$LWS.has(possiblyRestrictedConstructor$LWS) || restrictedCtors$LWS.has(possiblyRestrictedConstructor$LWS.prototype)) {
|
|
4878
5291
|
return true;
|
|
4879
5292
|
}
|
|
4880
5293
|
// eslint-disable-next-line no-proto
|
|
@@ -4900,6 +5313,16 @@
|
|
|
4900
5313
|
[eventName$LWS]: restrictedEventTargetCtors$LWS = toSafeWeakSet$LWS$1(new WeakSetCtor$LWS$1())
|
|
4901
5314
|
} = restrictedEventTargetRegistry$LWS;
|
|
4902
5315
|
restrictedEventTargetCtors$LWS.add(unmaskedEventTargetCtor$LWS);
|
|
5316
|
+
// Also register the constructor's `prototype`. A custom element (every LWC
|
|
5317
|
+
// component) extends a pivot class whose base constructor is sourced from the
|
|
5318
|
+
// sandbox custom-element registry, which is a DIFFERENT object than the one
|
|
5319
|
+
// registered here from the sandbox record. A constructor-identity match
|
|
5320
|
+
// therefore misses at the HTMLElement hop and the walk climbs past it. The
|
|
5321
|
+
// two constructors share the SAME `prototype` object, so registering the
|
|
5322
|
+
// prototype lets `isEventTargetRestricted` match a custom element's chain.
|
|
5323
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
5324
|
+
restrictedEventTargetCtors$LWS.add(unmaskedEventTargetCtor$LWS.prototype);
|
|
5325
|
+
}
|
|
4903
5326
|
restrictedEventTargetRegistry$LWS[eventName$LWS] = restrictedEventTargetCtors$LWS;
|
|
4904
5327
|
restrictedEventTargetRegistryBySandboxKeyRegistry$LWS[key$LWS] = restrictedEventTargetRegistry$LWS;
|
|
4905
5328
|
}
|
|
@@ -5820,6 +6243,28 @@
|
|
|
5820
6243
|
key: key$LWS
|
|
5821
6244
|
}) {
|
|
5822
6245
|
return [originalAttachShadow$LWS, function attachShadow$LWS(...args$LWS) {
|
|
6246
|
+
// W-23486662: the receiver is delegated to the wrapped
|
|
6247
|
+
// `attachShadow` unchecked. Native `attachShadow` brand-checks
|
|
6248
|
+
// it (a non-Element receiver throws "Illegal invocation"), but
|
|
6249
|
+
// on the platform LWC synthetic shadow replaces this method
|
|
6250
|
+
// with a variant that skips the brand-check when the internal
|
|
6251
|
+
// '$$lwc-synthetic-mode' option is set, so a non-Element (e.g.
|
|
6252
|
+
// a forged `srcdoc` Attr) can be made a synthetic shadow host
|
|
6253
|
+
// and used to write markup outside the Attr distortion. Enforce
|
|
6254
|
+
// the receiver invariant here so the guard holds regardless of
|
|
6255
|
+
// whether the wrapped method is native or synthetic. The check
|
|
6256
|
+
// is the structural `isElement` probe (an internal-slot brand
|
|
6257
|
+
// check), NOT `instanceof`: a genuine Element from any
|
|
6258
|
+
// same-origin realm passes, while an `Attr` or a same-realm
|
|
6259
|
+
// impostor with a forged `Element.prototype` chain is rejected
|
|
6260
|
+
// -- the latter would satisfy `instanceof Element` yet still
|
|
6261
|
+
// lacks the slot, so relying on `instanceof` would leave the
|
|
6262
|
+
// gap open.
|
|
6263
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
6264
|
+
if (!isElement$LWS(this)) {
|
|
6265
|
+
throw new LockerSecurityError$LWS('Failed to execute "attachShadow": the receiver is not an Element.');
|
|
6266
|
+
}
|
|
6267
|
+
}
|
|
5823
6268
|
const shadowRoot$LWS = ReflectApply$LWS$1(originalAttachShadow$LWS, this, args$LWS);
|
|
5824
6269
|
registerShadowRootInSandbox$LWS(key$LWS, shadowRoot$LWS);
|
|
5825
6270
|
return shadowRoot$LWS;
|
|
@@ -6126,6 +6571,22 @@
|
|
|
6126
6571
|
};
|
|
6127
6572
|
}
|
|
6128
6573
|
function scriptPropertySetters$LWS(incomingThis$LWS, property$LWS, valueAsTrustedString$LWS, originalScriptPropertyGetter$LWS, originalScriptPropertySetter$LWS, distortions$LWS, sandboxEvaluator$LWS, signedScriptHookSourceText$LWS) {
|
|
6574
|
+
// W-23593711: every caller reaches this fast path after an `instanceof
|
|
6575
|
+
// HTMLScriptElement || instanceof SVGScriptElement` check, but `instanceof`
|
|
6576
|
+
// is forgeable via an attacker-controlled `newTarget` (e.g.
|
|
6577
|
+
// `Reflect.construct(Audio, [], HTMLScriptElement)` produces a real
|
|
6578
|
+
// `<audio>` element whose prototype is `HTMLScriptElement.prototype`). This
|
|
6579
|
+
// fast path deliberately restores the raw value through the captured native
|
|
6580
|
+
// setter WITHOUT running it through the HTML sanitizer, on the assumption
|
|
6581
|
+
// that a real `<script>` never parses that value as markup. A forged
|
|
6582
|
+
// element is NOT a script, so it WOULD parse the raw string as live,
|
|
6583
|
+
// unsanitized DOM. Confirm the receiver is a genuine script element via an
|
|
6584
|
+
// unforgeable internal-slot brand check; if not, bail so the caller falls
|
|
6585
|
+
// through to its sanitizing path (`createHTML` for markup sinks, the native
|
|
6586
|
+
// text setter for text sinks).
|
|
6587
|
+
if (isGaterEnabledFeature$LWS('changesSince.266') && !isScriptElement$LWS(incomingThis$LWS)) {
|
|
6588
|
+
return false;
|
|
6589
|
+
}
|
|
6129
6590
|
const valueAsString$LWS = toSafeStringValue$LWS(valueAsTrustedString$LWS);
|
|
6130
6591
|
if (!isScriptPropertyEvaluatorHookDefined$LWS(incomingThis$LWS)) {
|
|
6131
6592
|
const distortedScriptPropertyGetter$LWS = distortions$LWS.get(originalScriptPropertyGetter$LWS);
|
|
@@ -6576,7 +7037,14 @@
|
|
|
6576
7037
|
return function distortionElementSetAttributeNode$LWS(record$LWS) {
|
|
6577
7038
|
return [originalSetAttributeNode$LWS, function setAttributeNode$LWS(...args$LWS) {
|
|
6578
7039
|
const attr$LWS = args$LWS.length ? args$LWS[0] : undefined;
|
|
6579
|
-
|
|
7040
|
+
// W-23439905: `instanceof Attr` only recognizes Attrs minted
|
|
7041
|
+
// in this realm. A genuine Attr from another same-origin
|
|
7042
|
+
// realm (e.g. a same-origin iframe's document) fails the
|
|
7043
|
+
// check and would otherwise fall through to the native
|
|
7044
|
+
// method with no interception. The structural fallback
|
|
7045
|
+
// recognizes a real Attr from any realm.
|
|
7046
|
+
const isRealAttr$LWS = attr$LWS instanceof Attr$LWS || isGaterEnabledFeature$LWS('changesSince.266') && isAttr$LWS(attr$LWS);
|
|
7047
|
+
if (!isRealAttr$LWS) {
|
|
6580
7048
|
// Handle non-Attr values using the native API.
|
|
6581
7049
|
return ReflectApply$LWS$1(originalSetAttributeNode$LWS, this, args$LWS);
|
|
6582
7050
|
}
|
|
@@ -6634,7 +7102,14 @@
|
|
|
6634
7102
|
return function distortionElementSetAttributeNodeNS$LWS(record$LWS) {
|
|
6635
7103
|
return [originalSetAttributeNodeNS$LWS, function setAttributeNodeNS$LWS(...args$LWS) {
|
|
6636
7104
|
const attr$LWS = args$LWS.length ? args$LWS[0] : undefined;
|
|
6637
|
-
|
|
7105
|
+
// W-23439905: `instanceof Attr` only recognizes Attrs minted
|
|
7106
|
+
// in this realm. A genuine Attr from another same-origin
|
|
7107
|
+
// realm (e.g. a same-origin iframe's document) fails the
|
|
7108
|
+
// check and would otherwise fall through to the native
|
|
7109
|
+
// method with no interception. The structural fallback
|
|
7110
|
+
// recognizes a real Attr from any realm.
|
|
7111
|
+
const isRealAttr$LWS = attr$LWS instanceof Attr$LWS || isGaterEnabledFeature$LWS('changesSince.266') && isAttr$LWS(attr$LWS);
|
|
7112
|
+
if (!isRealAttr$LWS) {
|
|
6638
7113
|
// Handle non-Attr values using the native API.
|
|
6639
7114
|
return ReflectApply$LWS$1(originalSetAttributeNodeNS$LWS, this, args$LWS);
|
|
6640
7115
|
}
|
|
@@ -7058,28 +7533,35 @@
|
|
|
7058
7533
|
|
|
7059
7534
|
// W-22602807: shared helper for distorting an iframe contentWindow realm's
|
|
7060
7535
|
// function-invocation primitives (Function.prototype.call/apply/bind,
|
|
7061
|
-
// Reflect.apply/construct)
|
|
7536
|
+
// Reflect.apply/construct) and, as of W-23748562, its CAPTURE primitives
|
|
7537
|
+
// (Proxy / Proxy.revocable — see Proxy/constructor-value.ts and
|
|
7538
|
+
// Proxy/revocable-value.ts) that mint a fresh identity around a callee
|
|
7539
|
+
// argument rather than invoking it directly.
|
|
7062
7540
|
//
|
|
7063
7541
|
// The cross-realm leak: sandbox code obtains a same-origin iframe's invocation
|
|
7064
7542
|
// primitive and uses it to invoke a constructor/evaluator. The callee can
|
|
7065
7543
|
// arrive as a RAW callable whose realm's `document` is undistorted, so
|
|
7066
7544
|
// `document.cookie` in a compiled body resolves to the native getter and leaks
|
|
7067
|
-
// the top-level cookie.
|
|
7545
|
+
// the top-level cookie. A capture primitive extends this: wrapping the callee
|
|
7546
|
+
// in a fresh Proxy identity BEFORE it reaches an invocation primitive defeats
|
|
7547
|
+
// the identity-keyed re-resolution below unless the wrapping itself is also
|
|
7548
|
+
// distorted (substitute the target at capture time, same as `bind` already
|
|
7549
|
+
// does for its callee).
|
|
7068
7550
|
//
|
|
7069
7551
|
// Containment tracks the OUTERMOST primitive actually invoked through the
|
|
7070
7552
|
// membrane (composition depth is irrelevant: in `apply.call(F, ...)` only the
|
|
7071
|
-
// outer `.call` is invoked). So every invocation
|
|
7072
|
-
// iframe realm must be distorted. Each re-resolves the
|
|
7073
|
-
//
|
|
7074
|
-
//
|
|
7075
|
-
//
|
|
7076
|
-
//
|
|
7077
|
-
//
|
|
7078
|
-
// ` is a same-origin iframe
|
|
7553
|
+
// outer `.call` is invoked). So every invocation AND capture primitive
|
|
7554
|
+
// reachable on the iframe realm must be distorted. Each re-resolves the
|
|
7555
|
+
// callee/target (the function or object being invoked or wrapped) to its
|
|
7556
|
+
// distorted counterpart in the ROOT record's map when one exists, then
|
|
7557
|
+
// delegates to the native primitive — so a raw native Function/eval reached
|
|
7558
|
+
// cross-realm (directly, or laundered through a Proxy) becomes the
|
|
7559
|
+
// sandbox-distorted version, while ordinary usage is an untouched passthrough.
|
|
7560
|
+
// Returns the host iframe element if `globalObject` is a same-origin iframe
|
|
7079
7561
|
// contentWindow realm (the only realm we distort), else undefined. Gated on
|
|
7080
7562
|
// changesSince.264: when the gate is off, no entry is installed and the
|
|
7081
|
-
// primitive keeps its native behavior. One check here covers
|
|
7082
|
-
// invocation-primitive
|
|
7563
|
+
// primitive keeps its native behavior. One check here covers every
|
|
7564
|
+
// invocation- and capture-primitive distortion in this family.
|
|
7083
7565
|
function getDistortableFrameElement$LWS(globalObject$LWS) {
|
|
7084
7566
|
if (!isGaterEnabledFeature$LWS('changesSince.264')) {
|
|
7085
7567
|
return undefined;
|
|
@@ -7101,12 +7583,19 @@
|
|
|
7101
7583
|
// foreign invocation primitive can deliver a callee (e.g. the sandbox `Function`
|
|
7102
7584
|
// ctor) that has crossed the membrane as a RAW reference, bypassing the
|
|
7103
7585
|
// distortion the membrane would normally apply on a direct call. Looking the
|
|
7104
|
-
// callee up in the map re-attaches that distortion.
|
|
7105
|
-
//
|
|
7106
|
-
//
|
|
7107
|
-
//
|
|
7108
|
-
//
|
|
7109
|
-
//
|
|
7586
|
+
// callee up in the map re-attaches that distortion. The `distorted !== callee`
|
|
7587
|
+
// check skips identity mappings (e.g. `document`, `location`, the global
|
|
7588
|
+
// object, which map to themselves), so a non-distorted target simply passes
|
|
7589
|
+
// through unchanged.
|
|
7590
|
+
//
|
|
7591
|
+
// Despite the parameter name, `callee` need not be callable: the Proxy
|
|
7592
|
+
// capture distortions (Proxy/constructor-value.ts, Proxy/revocable-value.ts,
|
|
7593
|
+
// W-23748562) reuse this helper to substitute a Proxy's TARGET before the
|
|
7594
|
+
// Proxy is built, and a Proxy target is not required to be callable
|
|
7595
|
+
// (`new cw.Proxy(document, {})` is valid). `root.distortions.get` is safe for
|
|
7596
|
+
// any object, callable or not, so the reuse is correct — this is a naming
|
|
7597
|
+
// artifact of the helper predating that second caller, not a constraint on
|
|
7598
|
+
// what may be passed.
|
|
7110
7599
|
function substituteDistortedCallee$LWS(root$LWS, callee$LWS) {
|
|
7111
7600
|
const distorted$LWS = root$LWS.distortions.get(callee$LWS);
|
|
7112
7601
|
if (distorted$LWS !== undefined && distorted$LWS !== callee$LWS) {
|
|
@@ -9395,7 +9884,14 @@
|
|
|
9395
9884
|
return function distortionNamedNodeMapSetNamedItem$LWS(record$LWS) {
|
|
9396
9885
|
return [originalSetNamedItem$LWS, function setNamedItem$LWS(...args$LWS) {
|
|
9397
9886
|
const attr$LWS = args$LWS.length ? args$LWS[0] : undefined;
|
|
9398
|
-
|
|
9887
|
+
// W-23439905: `instanceof Attr` only recognizes Attrs minted
|
|
9888
|
+
// in this realm. A genuine Attr from another same-origin
|
|
9889
|
+
// realm (e.g. a same-origin iframe's document) fails the
|
|
9890
|
+
// check and would otherwise fall through to the native
|
|
9891
|
+
// method with no interception. The structural fallback
|
|
9892
|
+
// recognizes a real Attr from any realm.
|
|
9893
|
+
const isRealAttr$LWS = attr$LWS && (attr$LWS instanceof Attr$LWS || isGaterEnabledFeature$LWS('changesSince.266') && isAttr$LWS(attr$LWS));
|
|
9894
|
+
if (isRealAttr$LWS) {
|
|
9399
9895
|
return setNamedItemWithAttr$LWS(record$LWS, originalSetNamedItem$LWS, this, attr$LWS);
|
|
9400
9896
|
}
|
|
9401
9897
|
return ReflectApply$LWS$1(originalSetNamedItem$LWS, this, args$LWS);
|
|
@@ -9415,7 +9911,14 @@
|
|
|
9415
9911
|
return function distortionNamedNodeMapSetNamedItemNS$LWS(record$LWS) {
|
|
9416
9912
|
return [originalSetNamedItemNS$LWS, function setNamedItemNS$LWS(...args$LWS) {
|
|
9417
9913
|
const attr$LWS = args$LWS.length ? args$LWS[0] : undefined;
|
|
9418
|
-
|
|
9914
|
+
// W-23439905: `instanceof Attr` only recognizes Attrs minted
|
|
9915
|
+
// in this realm. A genuine Attr from another same-origin
|
|
9916
|
+
// realm (e.g. a same-origin iframe's document) fails the
|
|
9917
|
+
// check and would otherwise fall through to the native
|
|
9918
|
+
// method with no interception. The structural fallback
|
|
9919
|
+
// recognizes a real Attr from any realm.
|
|
9920
|
+
const isRealAttr$LWS = attr$LWS && (attr$LWS instanceof Attr$LWS || isGaterEnabledFeature$LWS('changesSince.266') && isAttr$LWS(attr$LWS));
|
|
9921
|
+
if (isRealAttr$LWS) {
|
|
9419
9922
|
return setNamedItemWithAttr$LWS(record$LWS, originalSetNamedItemNS$LWS, this, attr$LWS);
|
|
9420
9923
|
}
|
|
9421
9924
|
return ReflectApply$LWS$1(originalSetNamedItemNS$LWS, this, args$LWS);
|
|
@@ -9780,58 +10283,507 @@
|
|
|
9780
10283
|
Notification: originalNotificationCtor$LWS
|
|
9781
10284
|
}
|
|
9782
10285
|
}) {
|
|
9783
|
-
// istanbul ignore if: needs default platform behavior test
|
|
9784
|
-
if (typeof originalNotificationCtor$LWS !== 'function') {
|
|
10286
|
+
// istanbul ignore if: needs default platform behavior test
|
|
10287
|
+
if (typeof originalNotificationCtor$LWS !== 'function') {
|
|
10288
|
+
return noop$LWS$1;
|
|
10289
|
+
}
|
|
10290
|
+
const distortionEntry$LWS = [originalNotificationCtor$LWS, function Notification$LWS(...args$LWS) {
|
|
10291
|
+
try {
|
|
10292
|
+
return ReflectConstruct$LWS(originalNotificationCtor$LWS, args$LWS);
|
|
10293
|
+
} catch (error) {
|
|
10294
|
+
if (args$LWS.length > 1 && error instanceof DOMException$LWS) {
|
|
10295
|
+
const providedOptions$LWS = args$LWS[1];
|
|
10296
|
+
if (isObjectLike$LWS(providedOptions$LWS)) {
|
|
10297
|
+
const {
|
|
10298
|
+
data: data$LWS
|
|
10299
|
+
} = providedOptions$LWS;
|
|
10300
|
+
if (isObject$LWS$1(data$LWS)) {
|
|
10301
|
+
args$LWS[1] = {
|
|
10302
|
+
// The Notification constructor accepts
|
|
10303
|
+
// inherited options property values.
|
|
10304
|
+
__proto__: providedOptions$LWS,
|
|
10305
|
+
// Shadow any inherited value.
|
|
10306
|
+
data: partialStructuredClone$LWS(data$LWS)
|
|
10307
|
+
};
|
|
10308
|
+
return ReflectConstruct$LWS(originalNotificationCtor$LWS, args$LWS);
|
|
10309
|
+
}
|
|
10310
|
+
}
|
|
10311
|
+
}
|
|
10312
|
+
throw error;
|
|
10313
|
+
}
|
|
10314
|
+
}];
|
|
10315
|
+
return function distortionNotificationCtor$LWS() {
|
|
10316
|
+
return distortionEntry$LWS;
|
|
10317
|
+
};
|
|
10318
|
+
}
|
|
10319
|
+
|
|
10320
|
+
// W-23748456 (Bug Bounty / H1): shared machinery for containing the V8-only
|
|
10321
|
+
// `Error.prepareStackTrace` cross-realm evaluator channel. See
|
|
10322
|
+
// Function/cross-realm-invocation.ts for the broader cross-realm threat model.
|
|
10323
|
+
//
|
|
10324
|
+
// `Error.prepareStackTrace` is a non-standard V8 hook: reading an error's
|
|
10325
|
+
// `.stack` makes V8 NATIVELY invoke whatever callable is stored in that slot as
|
|
10326
|
+
// `prepareStackTrace(error, structuredStackTrace)`. Sandbox code reaches a
|
|
10327
|
+
// same-origin iframe's `Error`, stores the sandbox's own `Function` there, and
|
|
10328
|
+
// crafts `error.name`/`message` plus a poisoned `Array.prototype.toString` so
|
|
10329
|
+
// the native invocation compiles `function <name>() { return document.cookie }`
|
|
10330
|
+
// whose ambient `document` resolves to the real top document -- leaking its
|
|
10331
|
+
// cookie. The escape is NOT that the iframe realm is undistorted (the multi-doc
|
|
10332
|
+
// patcher does distort a managed same-origin iframe's intrinsics); it is that
|
|
10333
|
+
// V8 invokes this hook INTERNALLY, so the compiled callee runs in a realm the
|
|
10334
|
+
// near-membrane never linked to the sandbox. Because that invocation is
|
|
10335
|
+
// internal, there is NO call site for an
|
|
10336
|
+
// invocation-primitive distortion (Reflect.apply/construct, Function.prototype
|
|
10337
|
+
// call/apply/bind -- the W-22602807 five) to intercept the callee: the only
|
|
10338
|
+
// observable seam is the STORE of the hook.
|
|
10339
|
+
//
|
|
10340
|
+
// Containment therefore guards the store rather than the (invisible) invocation.
|
|
10341
|
+
// `prepareStackTrace` is a debugging-only V8 extension with no legitimate
|
|
10342
|
+
// LWC/Aura use, so any attempt to (re)define it through a same-origin iframe
|
|
10343
|
+
// realm's property-definition primitives is BLOCKED outright -- by throwing,
|
|
10344
|
+
// never by silently dropping the value -- so the failure is an unmistakable
|
|
10345
|
+
// security refusal and can never be mistaken for ordinary platform behavior.
|
|
10346
|
+
// The distorted primitives live next to the objects they belong to:
|
|
10347
|
+
// Object/defineProperty-value.ts, Object/defineProperties-value.ts, and
|
|
10348
|
+
// Reflect/defineProperty-value.ts. Guarding the store primitives rather than
|
|
10349
|
+
// `Error` identity also covers the raw intrinsic reached via
|
|
10350
|
+
// `new Error().constructor`; the target object is irrelevant. Plain assignment
|
|
10351
|
+
// (`Error.prepareStackTrace = fn`) needs no entry: the membrane hands the setter
|
|
10352
|
+
// the raw iframe `Function`, which V8's hook rejects with a SyntaxError, so that
|
|
10353
|
+
// path is already inert.
|
|
10354
|
+
// The distortion entry KEY (the first element of the `[original, replacement]`
|
|
10355
|
+
// pair each value file returns) MUST be the iframe realm's OWN native, read off
|
|
10356
|
+
// `record.globalObject`. The membrane's distortion map is a WeakMap keyed by
|
|
10357
|
+
// object IDENTITY (see createDistortionEntries / createDistortionMap in
|
|
10358
|
+
// sandbox/src/util/distortion.ts), so the key must be the exact function object
|
|
10359
|
+
// that crosses the membrane at runtime -- which, for a same-origin iframe, is
|
|
10360
|
+
// `iframe.contentWindow.Object.defineProperty` (etc.). That is a DISTINCT object
|
|
10361
|
+
// from the system realm's `@locker/shared` copy: a same-origin iframe has its
|
|
10362
|
+
// own, un-distorted set of intrinsics, which is the whole basis of this vector.
|
|
10363
|
+
// Keying on the shared/system copy would never match what the sandbox pulls off
|
|
10364
|
+
// the iframe, so the substitution would never fire -- dead code. Hence each
|
|
10365
|
+
// value file reads the KEY off `globalObject` while using the pinned
|
|
10366
|
+
// `@locker/shared` reference for the pass-through INVOCATION: realm-native for
|
|
10367
|
+
// the KEY (identity match), shared-pinned for the WORK (tamper-proof).
|
|
10368
|
+
const PREPARE_STACK_TRACE$LWS = 'prepareStackTrace';
|
|
10369
|
+
// V8-ONLY capability check. `Error.prepareStackTrace` has no default property
|
|
10370
|
+
// (it is `undefined` even on V8), so it cannot be feature-detected directly;
|
|
10371
|
+
// its sibling static `Error.captureStackTrace` is the reliable V8 stack-trace
|
|
10372
|
+
// API marker. JavaScriptCore (Safari) and SpiderMonkey (Firefox) that never
|
|
10373
|
+
// invoke the hook are handled the same way -- when the marker is absent the
|
|
10374
|
+
// vector cannot exist, so each initializer returns `noop` and installs nothing.
|
|
10375
|
+
function platformSupportsPrepareStackTrace$LWS(ErrorCtor$LWS) {
|
|
10376
|
+
return typeof (ErrorCtor$LWS == null ? void 0 : ErrorCtor$LWS.captureStackTrace) === 'function';
|
|
10377
|
+
}
|
|
10378
|
+
// This cross-realm vector only exists on a same-origin iframe realm, and the
|
|
10379
|
+
// containment ships under changesSince.266. One predicate for all three
|
|
10380
|
+
// distorted store primitives; `getDistortableFrameElement` carries its own
|
|
10381
|
+
// changesSince.264 gate on the underlying cross-realm scoping helper.
|
|
10382
|
+
function isPrepareStackTraceStoreDistortable$LWS(globalObject$LWS) {
|
|
10383
|
+
return isGaterEnabledFeature$LWS('changesSince.266') && Boolean(getDistortableFrameElement$LWS(globalObject$LWS));
|
|
10384
|
+
}
|
|
10385
|
+
// Resolve `key` to a property key ONCE. Symbols are never our string key;
|
|
10386
|
+
// everything else is coerced with a single template read so an adversarial
|
|
10387
|
+
// `toString` cannot answer the equality check with a benign key and the native
|
|
10388
|
+
// pass-through with `prepareStackTrace` (a TOCTOU). Callers forward the resolved
|
|
10389
|
+
// value to the native primitive, so the two can never diverge.
|
|
10390
|
+
function resolvePropertyKey$LWS(key$LWS) {
|
|
10391
|
+
return typeof key$LWS === 'symbol' ? key$LWS : `${key$LWS}`;
|
|
10392
|
+
}
|
|
10393
|
+
// The refusal. A dedicated `never`-returning helper keeps the throw identical
|
|
10394
|
+
// across all three store primitives.
|
|
10395
|
+
function throwPrepareStackTraceBlocked$LWS() {
|
|
10396
|
+
throw new LockerSecurityError$LWS('Cannot redefine Error.prepareStackTrace');
|
|
10397
|
+
}
|
|
10398
|
+
|
|
10399
|
+
// W-23748456: block cross-realm redefinition of `Error.prepareStackTrace` via a
|
|
10400
|
+
// same-origin iframe realm's `Object.defineProperties` (the bulk form). Full
|
|
10401
|
+
// threat model and the KEY-identity reasoning live in
|
|
10402
|
+
// Error/prepareStackTrace-shared.ts.
|
|
10403
|
+
function initDistortionObjectDefineProperties$LWS({
|
|
10404
|
+
globalObject: {
|
|
10405
|
+
Error: ErrorCtor$LWS,
|
|
10406
|
+
Object: {
|
|
10407
|
+
defineProperties: originalObjectDefineProperties$LWS
|
|
10408
|
+
}
|
|
10409
|
+
}
|
|
10410
|
+
}) {
|
|
10411
|
+
// No V8 prepareStackTrace hook on this platform => nothing to contain.
|
|
10412
|
+
if (!platformSupportsPrepareStackTrace$LWS(ErrorCtor$LWS)) {
|
|
10413
|
+
return noop$LWS$1;
|
|
10414
|
+
}
|
|
10415
|
+
return function distortionObjectDefineProperties$LWS({
|
|
10416
|
+
globalObject: globalObject$LWS
|
|
10417
|
+
}) {
|
|
10418
|
+
if (!isPrepareStackTraceStoreDistortable$LWS(globalObject$LWS)) {
|
|
10419
|
+
return undefined;
|
|
10420
|
+
}
|
|
10421
|
+
return [
|
|
10422
|
+
// KEY: the iframe realm's OWN native, identity-matched across the
|
|
10423
|
+
// membrane. See Error/prepareStackTrace-shared.ts.
|
|
10424
|
+
originalObjectDefineProperties$LWS, function defineProperties$LWS(target$LWS, properties$LWS) {
|
|
10425
|
+
// The bulk form must not be a TOCTOU seam. A single up-front
|
|
10426
|
+
// key check (e.g. ObjectHasOwn) triggers ONE [[GetOwnProperty]]
|
|
10427
|
+
// trap, but then handing the SAME map to the native primitive
|
|
10428
|
+
// lets it RE-trap [[OwnPropertyKeys]]/[[GetOwnProperty]] to
|
|
10429
|
+
// decide what it defines -- so a stateful Proxy could report no
|
|
10430
|
+
// `prepareStackTrace` to the check and surface it to the native
|
|
10431
|
+
// pass, installing the hook without ever throwing. Instead,
|
|
10432
|
+
// materialize the map's own slots ONCE into a plain,
|
|
10433
|
+
// prototype-free snapshot and hand the native primitive the
|
|
10434
|
+
// SNAPSHOT, never the caller's (possibly exotic) map: the guard
|
|
10435
|
+
// decision and the native define now read from the same
|
|
10436
|
+
// immutable object, so no trap can diverge between them. This is
|
|
10437
|
+
// the bulk-form analogue of the singular guard's single-read
|
|
10438
|
+
// discipline (resolvePropertyKey in defineProperty-value.ts).
|
|
10439
|
+
if (isObjectLike$LWS(properties$LWS)) {
|
|
10440
|
+
const snapshot$LWS = {
|
|
10441
|
+
__proto__: null
|
|
10442
|
+
};
|
|
10443
|
+
const keys$LWS = ReflectOwnKeys$LWS$1(properties$LWS);
|
|
10444
|
+
for (let i$LWS = 0, {
|
|
10445
|
+
length: length$LWS
|
|
10446
|
+
} = keys$LWS; i$LWS < length$LWS; i$LWS += 1) {
|
|
10447
|
+
const key$LWS = keys$LWS[i$LWS];
|
|
10448
|
+
// Refuse the moment the hook key appears among the map's
|
|
10449
|
+
// OWN keys -- decided on the same single [[OwnPropertyKeys]]
|
|
10450
|
+
// read that feeds the snapshot, so there is no window for
|
|
10451
|
+
// a stateful `ownKeys` to hide it here and reveal it to
|
|
10452
|
+
// the native define. prepareStackTrace has no legitimate
|
|
10453
|
+
// LWC/Aura use, so failing closed on its mere presence is
|
|
10454
|
+
// correct.
|
|
10455
|
+
if (key$LWS === PREPARE_STACK_TRACE$LWS) {
|
|
10456
|
+
throwPrepareStackTraceBlocked$LWS();
|
|
10457
|
+
}
|
|
10458
|
+
const descriptor$LWS = ReflectGetOwnPropertyDescriptor$LWS(properties$LWS, key$LWS);
|
|
10459
|
+
// Object.defineProperties only consumes OWN ENUMERABLE
|
|
10460
|
+
// slots; mirror that exactly, reading each descriptor
|
|
10461
|
+
// object once and pinning it onto the snapshot as an own
|
|
10462
|
+
// enumerable data property.
|
|
10463
|
+
if (descriptor$LWS !== undefined && descriptor$LWS.enumerable) {
|
|
10464
|
+
snapshot$LWS[key$LWS] = ReflectGet$LWS(properties$LWS, key$LWS);
|
|
10465
|
+
}
|
|
10466
|
+
}
|
|
10467
|
+
return ObjectDefineProperties$LWS(target$LWS, snapshot$LWS);
|
|
10468
|
+
}
|
|
10469
|
+
// Non-object map: hand it straight to the pinned primitive so
|
|
10470
|
+
// callers still get the native TypeError (ToObject(null/undefined)
|
|
10471
|
+
// throws).
|
|
10472
|
+
return ObjectDefineProperties$LWS(target$LWS, properties$LWS);
|
|
10473
|
+
}];
|
|
10474
|
+
};
|
|
10475
|
+
}
|
|
10476
|
+
|
|
10477
|
+
// W-23748456: block cross-realm redefinition of `Error.prepareStackTrace` via a
|
|
10478
|
+
// same-origin iframe realm's `Object.defineProperty`. Full threat model and the
|
|
10479
|
+
// KEY-identity reasoning live in Error/prepareStackTrace-shared.ts.
|
|
10480
|
+
function initDistortionObjectDefineProperty$LWS({
|
|
10481
|
+
globalObject: {
|
|
10482
|
+
Error: ErrorCtor$LWS,
|
|
10483
|
+
Object: {
|
|
10484
|
+
defineProperty: originalObjectDefineProperty$LWS
|
|
10485
|
+
}
|
|
10486
|
+
}
|
|
10487
|
+
}) {
|
|
10488
|
+
// No V8 prepareStackTrace hook on this platform => nothing to contain.
|
|
10489
|
+
if (!platformSupportsPrepareStackTrace$LWS(ErrorCtor$LWS)) {
|
|
10490
|
+
return noop$LWS$1;
|
|
10491
|
+
}
|
|
10492
|
+
return function distortionObjectDefineProperty$LWS({
|
|
10493
|
+
globalObject: globalObject$LWS
|
|
10494
|
+
}) {
|
|
10495
|
+
if (!isPrepareStackTraceStoreDistortable$LWS(globalObject$LWS)) {
|
|
10496
|
+
return undefined;
|
|
10497
|
+
}
|
|
10498
|
+
return [
|
|
10499
|
+
// KEY: the iframe realm's OWN native, identity-matched across the
|
|
10500
|
+
// membrane. See Error/prepareStackTrace-shared.ts.
|
|
10501
|
+
originalObjectDefineProperty$LWS, function defineProperty$LWS(target$LWS, key$LWS, descriptor$LWS) {
|
|
10502
|
+
const resolvedKey$LWS = resolvePropertyKey$LWS(key$LWS);
|
|
10503
|
+
if (resolvedKey$LWS === PREPARE_STACK_TRACE$LWS) {
|
|
10504
|
+
throwPrepareStackTraceBlocked$LWS();
|
|
10505
|
+
}
|
|
10506
|
+
// Any other key: an ordinary define, via the pinned shared
|
|
10507
|
+
// primitive with the already-resolved key (TOCTOU-safe).
|
|
10508
|
+
return ObjectDefineProperty$LWS(target$LWS, resolvedKey$LWS, descriptor$LWS);
|
|
10509
|
+
}];
|
|
10510
|
+
};
|
|
10511
|
+
}
|
|
10512
|
+
function initDistortionObservableCatch$LWS({
|
|
10513
|
+
globalObject: {
|
|
10514
|
+
Observable: OriginalObservable$LWS
|
|
10515
|
+
}
|
|
10516
|
+
}) {
|
|
10517
|
+
var _OriginalObservable$p$LWS;
|
|
10518
|
+
// istanbul ignore next: optional chaining and nullish coalescing results in an expansion that contains an unreachable "void 0" branch for every occurrence of the operator
|
|
10519
|
+
const originalCatch$LWS = OriginalObservable$LWS == null || (_OriginalObservable$p$LWS = OriginalObservable$LWS.prototype) == null ? void 0 : _OriginalObservable$p$LWS.catch;
|
|
10520
|
+
// istanbul ignore if: Observable is always available in coverage environments
|
|
10521
|
+
if (typeof originalCatch$LWS !== 'function') {
|
|
10522
|
+
return noop$LWS$1;
|
|
10523
|
+
}
|
|
10524
|
+
const distortionEntry$LWS = [originalCatch$LWS,
|
|
10525
|
+
// `catch` is a reserved word, so the replacement is an anonymous
|
|
10526
|
+
// function expression (mirroring the Promise.prototype.catch distortion).
|
|
10527
|
+
function (...args$LWS) {
|
|
10528
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
10529
|
+
throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
|
|
10530
|
+
}
|
|
10531
|
+
return ReflectApply$LWS$1(originalCatch$LWS, this, args$LWS);
|
|
10532
|
+
}];
|
|
10533
|
+
return function distortionObservableCatch$LWS() {
|
|
10534
|
+
return distortionEntry$LWS;
|
|
10535
|
+
};
|
|
10536
|
+
}
|
|
10537
|
+
function initDistortionObservableEvery$LWS({
|
|
10538
|
+
globalObject: {
|
|
10539
|
+
Observable: OriginalObservable$LWS
|
|
10540
|
+
}
|
|
10541
|
+
}) {
|
|
10542
|
+
var _OriginalObservable$p2$LWS;
|
|
10543
|
+
// istanbul ignore next: optional chaining and nullish coalescing results in an expansion that contains an unreachable "void 0" branch for every occurrence of the operator
|
|
10544
|
+
const originalEvery$LWS = OriginalObservable$LWS == null || (_OriginalObservable$p2$LWS = OriginalObservable$LWS.prototype) == null ? void 0 : _OriginalObservable$p2$LWS.every;
|
|
10545
|
+
// istanbul ignore if: Observable is always available in coverage environments
|
|
10546
|
+
if (typeof originalEvery$LWS !== 'function') {
|
|
10547
|
+
return noop$LWS$1;
|
|
10548
|
+
}
|
|
10549
|
+
const distortionEntry$LWS = [originalEvery$LWS, function every$LWS(...args$LWS) {
|
|
10550
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
10551
|
+
throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
|
|
10552
|
+
}
|
|
10553
|
+
return ReflectApply$LWS$1(originalEvery$LWS, this, args$LWS);
|
|
10554
|
+
}];
|
|
10555
|
+
return function distortionObservableEvery$LWS() {
|
|
10556
|
+
return distortionEntry$LWS;
|
|
10557
|
+
};
|
|
10558
|
+
}
|
|
10559
|
+
function initDistortionObservableFilter$LWS({
|
|
10560
|
+
globalObject: {
|
|
10561
|
+
Observable: OriginalObservable$LWS
|
|
10562
|
+
}
|
|
10563
|
+
}) {
|
|
10564
|
+
var _OriginalObservable$p3$LWS;
|
|
10565
|
+
// istanbul ignore next: optional chaining and nullish coalescing results in an expansion that contains an unreachable "void 0" branch for every occurrence of the operator
|
|
10566
|
+
const originalFilter$LWS = OriginalObservable$LWS == null || (_OriginalObservable$p3$LWS = OriginalObservable$LWS.prototype) == null ? void 0 : _OriginalObservable$p3$LWS.filter;
|
|
10567
|
+
// istanbul ignore if: Observable is always available in coverage environments
|
|
10568
|
+
if (typeof originalFilter$LWS !== 'function') {
|
|
10569
|
+
return noop$LWS$1;
|
|
10570
|
+
}
|
|
10571
|
+
const distortionEntry$LWS = [originalFilter$LWS, function filter$LWS(...args$LWS) {
|
|
10572
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
10573
|
+
throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
|
|
10574
|
+
}
|
|
10575
|
+
return ReflectApply$LWS$1(originalFilter$LWS, this, args$LWS);
|
|
10576
|
+
}];
|
|
10577
|
+
return function distortionObservableFilter$LWS() {
|
|
10578
|
+
return distortionEntry$LWS;
|
|
10579
|
+
};
|
|
10580
|
+
}
|
|
10581
|
+
function initDistortionObservableFinally$LWS({
|
|
10582
|
+
globalObject: {
|
|
10583
|
+
Observable: OriginalObservable$LWS
|
|
10584
|
+
}
|
|
10585
|
+
}) {
|
|
10586
|
+
var _OriginalObservable$p4$LWS;
|
|
10587
|
+
// istanbul ignore next: optional chaining and nullish coalescing results in an expansion that contains an unreachable "void 0" branch for every occurrence of the operator
|
|
10588
|
+
const originalFinally$LWS = OriginalObservable$LWS == null || (_OriginalObservable$p4$LWS = OriginalObservable$LWS.prototype) == null ? void 0 : _OriginalObservable$p4$LWS.finally;
|
|
10589
|
+
// istanbul ignore if: Observable is always available in coverage environments
|
|
10590
|
+
if (typeof originalFinally$LWS !== 'function') {
|
|
10591
|
+
return noop$LWS$1;
|
|
10592
|
+
}
|
|
10593
|
+
const distortionEntry$LWS = [originalFinally$LWS,
|
|
10594
|
+
// `finally` is a reserved word, so the replacement is an anonymous
|
|
10595
|
+
// function expression (mirroring the Promise.prototype.finally distortion).
|
|
10596
|
+
function (...args$LWS) {
|
|
10597
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
10598
|
+
throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
|
|
10599
|
+
}
|
|
10600
|
+
return ReflectApply$LWS$1(originalFinally$LWS, this, args$LWS);
|
|
10601
|
+
}];
|
|
10602
|
+
return function distortionObservableFinally$LWS() {
|
|
10603
|
+
return distortionEntry$LWS;
|
|
10604
|
+
};
|
|
10605
|
+
}
|
|
10606
|
+
function initDistortionObservableFind$LWS({
|
|
10607
|
+
globalObject: {
|
|
10608
|
+
Observable: OriginalObservable$LWS
|
|
10609
|
+
}
|
|
10610
|
+
}) {
|
|
10611
|
+
var _OriginalObservable$p5$LWS;
|
|
10612
|
+
// istanbul ignore next: optional chaining and nullish coalescing results in an expansion that contains an unreachable "void 0" branch for every occurrence of the operator
|
|
10613
|
+
const originalFind$LWS = OriginalObservable$LWS == null || (_OriginalObservable$p5$LWS = OriginalObservable$LWS.prototype) == null ? void 0 : _OriginalObservable$p5$LWS.find;
|
|
10614
|
+
// istanbul ignore if: Observable is always available in coverage environments
|
|
10615
|
+
if (typeof originalFind$LWS !== 'function') {
|
|
10616
|
+
return noop$LWS$1;
|
|
10617
|
+
}
|
|
10618
|
+
const distortionEntry$LWS = [originalFind$LWS, function find$LWS(...args$LWS) {
|
|
10619
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
10620
|
+
throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
|
|
10621
|
+
}
|
|
10622
|
+
return ReflectApply$LWS$1(originalFind$LWS, this, args$LWS);
|
|
10623
|
+
}];
|
|
10624
|
+
return function distortionObservableFind$LWS() {
|
|
10625
|
+
return distortionEntry$LWS;
|
|
10626
|
+
};
|
|
10627
|
+
}
|
|
10628
|
+
function initDistortionObservableFlatMap$LWS({
|
|
10629
|
+
globalObject: {
|
|
10630
|
+
Observable: OriginalObservable$LWS
|
|
10631
|
+
}
|
|
10632
|
+
}) {
|
|
10633
|
+
var _OriginalObservable$p6$LWS;
|
|
10634
|
+
// istanbul ignore next: optional chaining and nullish coalescing results in an expansion that contains an unreachable "void 0" branch for every occurrence of the operator
|
|
10635
|
+
const originalFlatMap$LWS = OriginalObservable$LWS == null || (_OriginalObservable$p6$LWS = OriginalObservable$LWS.prototype) == null ? void 0 : _OriginalObservable$p6$LWS.flatMap;
|
|
10636
|
+
// istanbul ignore if: Observable is always available in coverage environments
|
|
10637
|
+
if (typeof originalFlatMap$LWS !== 'function') {
|
|
10638
|
+
return noop$LWS$1;
|
|
10639
|
+
}
|
|
10640
|
+
const distortionEntry$LWS = [originalFlatMap$LWS, function flatMap$LWS(...args$LWS) {
|
|
10641
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
10642
|
+
throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
|
|
10643
|
+
}
|
|
10644
|
+
return ReflectApply$LWS$1(originalFlatMap$LWS, this, args$LWS);
|
|
10645
|
+
}];
|
|
10646
|
+
return function distortionObservableFlatMap$LWS() {
|
|
10647
|
+
return distortionEntry$LWS;
|
|
10648
|
+
};
|
|
10649
|
+
}
|
|
10650
|
+
function initDistortionObservableForEach$LWS({
|
|
10651
|
+
globalObject: {
|
|
10652
|
+
Observable: OriginalObservable$LWS
|
|
10653
|
+
}
|
|
10654
|
+
}) {
|
|
10655
|
+
var _OriginalObservable$p7$LWS;
|
|
10656
|
+
// istanbul ignore next: optional chaining and nullish coalescing results in an expansion that contains an unreachable "void 0" branch for every occurrence of the operator
|
|
10657
|
+
const originalForEach$LWS = OriginalObservable$LWS == null || (_OriginalObservable$p7$LWS = OriginalObservable$LWS.prototype) == null ? void 0 : _OriginalObservable$p7$LWS.forEach;
|
|
10658
|
+
// istanbul ignore if: Observable is always available in coverage environments
|
|
10659
|
+
if (typeof originalForEach$LWS !== 'function') {
|
|
10660
|
+
return noop$LWS$1;
|
|
10661
|
+
}
|
|
10662
|
+
const distortionEntry$LWS = [originalForEach$LWS, function forEach$LWS(...args$LWS) {
|
|
10663
|
+
if (isGaterEnabledFeature$LWS('changesSince.262')) {
|
|
10664
|
+
throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
|
|
10665
|
+
}
|
|
10666
|
+
return ReflectApply$LWS$1(originalForEach$LWS, this, args$LWS);
|
|
10667
|
+
}];
|
|
10668
|
+
return function distortionObservableForEach$LWS() {
|
|
10669
|
+
return distortionEntry$LWS;
|
|
10670
|
+
};
|
|
10671
|
+
}
|
|
10672
|
+
function initDistortionObservableInspect$LWS({
|
|
10673
|
+
globalObject: {
|
|
10674
|
+
Observable: OriginalObservable$LWS
|
|
10675
|
+
}
|
|
10676
|
+
}) {
|
|
10677
|
+
var _OriginalObservable$p8$LWS;
|
|
10678
|
+
// istanbul ignore next: optional chaining and nullish coalescing results in an expansion that contains an unreachable "void 0" branch for every occurrence of the operator
|
|
10679
|
+
const originalInspect$LWS = OriginalObservable$LWS == null || (_OriginalObservable$p8$LWS = OriginalObservable$LWS.prototype) == null ? void 0 : _OriginalObservable$p8$LWS.inspect;
|
|
10680
|
+
// istanbul ignore if: Observable is always available in coverage environments
|
|
10681
|
+
if (typeof originalInspect$LWS !== 'function') {
|
|
10682
|
+
return noop$LWS$1;
|
|
10683
|
+
}
|
|
10684
|
+
const distortionEntry$LWS = [originalInspect$LWS,
|
|
10685
|
+
// `inspect` accepts either a plain function or an observer object with
|
|
10686
|
+
// `next`/`error`/`complete` callbacks, mirroring `subscribe`.
|
|
10687
|
+
function inspect$LWS(...args$LWS) {
|
|
10688
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
10689
|
+
const {
|
|
10690
|
+
0: observerOrCallback$LWS
|
|
10691
|
+
} = args$LWS;
|
|
10692
|
+
if (observerOrCallback$LWS !== null && observerOrCallback$LWS !== undefined) {
|
|
10693
|
+
if (typeof observerOrCallback$LWS === 'function') {
|
|
10694
|
+
throwIfUnsafeCallbackReference$LWS(observerOrCallback$LWS);
|
|
10695
|
+
} else if (typeof observerOrCallback$LWS === 'object') {
|
|
10696
|
+
// Snapshot properties to prevent TOCTOU: attacker-controlled
|
|
10697
|
+
// getters could return a safe value during the check but
|
|
10698
|
+
// return Function when Observable reads them internally.
|
|
10699
|
+
const {
|
|
10700
|
+
next: next$LWS,
|
|
10701
|
+
error,
|
|
10702
|
+
complete: complete$LWS
|
|
10703
|
+
} = observerOrCallback$LWS;
|
|
10704
|
+
throwIfUnsafeCallbackReference$LWS(next$LWS);
|
|
10705
|
+
throwIfUnsafeCallbackReference$LWS(error);
|
|
10706
|
+
throwIfUnsafeCallbackReference$LWS(complete$LWS);
|
|
10707
|
+
args$LWS[0] = {
|
|
10708
|
+
next: next$LWS,
|
|
10709
|
+
error,
|
|
10710
|
+
complete: complete$LWS
|
|
10711
|
+
};
|
|
10712
|
+
}
|
|
10713
|
+
}
|
|
10714
|
+
}
|
|
10715
|
+
return ReflectApply$LWS$1(originalInspect$LWS, this, args$LWS);
|
|
10716
|
+
}];
|
|
10717
|
+
return function distortionObservableInspect$LWS() {
|
|
10718
|
+
return distortionEntry$LWS;
|
|
10719
|
+
};
|
|
10720
|
+
}
|
|
10721
|
+
function initDistortionObservableMap$LWS({
|
|
10722
|
+
globalObject: {
|
|
10723
|
+
Observable: OriginalObservable$LWS
|
|
10724
|
+
}
|
|
10725
|
+
}) {
|
|
10726
|
+
var _OriginalObservable$p9$LWS;
|
|
10727
|
+
// istanbul ignore next: optional chaining and nullish coalescing results in an expansion that contains an unreachable "void 0" branch for every occurrence of the operator
|
|
10728
|
+
const originalMap$LWS = OriginalObservable$LWS == null || (_OriginalObservable$p9$LWS = OriginalObservable$LWS.prototype) == null ? void 0 : _OriginalObservable$p9$LWS.map;
|
|
10729
|
+
// istanbul ignore if: Observable is always available in coverage environments
|
|
10730
|
+
if (typeof originalMap$LWS !== 'function') {
|
|
10731
|
+
return noop$LWS$1;
|
|
10732
|
+
}
|
|
10733
|
+
const distortionEntry$LWS = [originalMap$LWS, function map$LWS(...args$LWS) {
|
|
10734
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
10735
|
+
throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
|
|
10736
|
+
}
|
|
10737
|
+
return ReflectApply$LWS$1(originalMap$LWS, this, args$LWS);
|
|
10738
|
+
}];
|
|
10739
|
+
return function distortionObservableMap$LWS() {
|
|
10740
|
+
return distortionEntry$LWS;
|
|
10741
|
+
};
|
|
10742
|
+
}
|
|
10743
|
+
function initDistortionObservableReduce$LWS({
|
|
10744
|
+
globalObject: {
|
|
10745
|
+
Observable: OriginalObservable$LWS
|
|
10746
|
+
}
|
|
10747
|
+
}) {
|
|
10748
|
+
var _OriginalObservable$p0$LWS;
|
|
10749
|
+
// istanbul ignore next: optional chaining and nullish coalescing results in an expansion that contains an unreachable "void 0" branch for every occurrence of the operator
|
|
10750
|
+
const originalReduce$LWS = OriginalObservable$LWS == null || (_OriginalObservable$p0$LWS = OriginalObservable$LWS.prototype) == null ? void 0 : _OriginalObservable$p0$LWS.reduce;
|
|
10751
|
+
// istanbul ignore if: Observable is always available in coverage environments
|
|
10752
|
+
if (typeof originalReduce$LWS !== 'function') {
|
|
9785
10753
|
return noop$LWS$1;
|
|
9786
10754
|
}
|
|
9787
|
-
const distortionEntry$LWS = [
|
|
9788
|
-
|
|
9789
|
-
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
-
if (isObjectLike$LWS(providedOptions$LWS)) {
|
|
9794
|
-
const {
|
|
9795
|
-
data: data$LWS
|
|
9796
|
-
} = providedOptions$LWS;
|
|
9797
|
-
if (isObject$LWS$1(data$LWS)) {
|
|
9798
|
-
args$LWS[1] = {
|
|
9799
|
-
// The Notification constructor accepts
|
|
9800
|
-
// inherited options property values.
|
|
9801
|
-
__proto__: providedOptions$LWS,
|
|
9802
|
-
// Shadow any inherited value.
|
|
9803
|
-
data: partialStructuredClone$LWS(data$LWS)
|
|
9804
|
-
};
|
|
9805
|
-
return ReflectConstruct$LWS(originalNotificationCtor$LWS, args$LWS);
|
|
9806
|
-
}
|
|
9807
|
-
}
|
|
9808
|
-
}
|
|
9809
|
-
throw error;
|
|
10755
|
+
const distortionEntry$LWS = [originalReduce$LWS,
|
|
10756
|
+
// The reducer callback is args[0]; args[1] is the optional seed value
|
|
10757
|
+
// and is never invoked, so only args[0] needs the identity check.
|
|
10758
|
+
function reduce$LWS(...args$LWS) {
|
|
10759
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
10760
|
+
throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
|
|
9810
10761
|
}
|
|
10762
|
+
return ReflectApply$LWS$1(originalReduce$LWS, this, args$LWS);
|
|
9811
10763
|
}];
|
|
9812
|
-
return function
|
|
10764
|
+
return function distortionObservableReduce$LWS() {
|
|
9813
10765
|
return distortionEntry$LWS;
|
|
9814
10766
|
};
|
|
9815
10767
|
}
|
|
9816
|
-
function
|
|
10768
|
+
function initDistortionObservableSome$LWS({
|
|
9817
10769
|
globalObject: {
|
|
9818
10770
|
Observable: OriginalObservable$LWS
|
|
9819
10771
|
}
|
|
9820
10772
|
}) {
|
|
9821
|
-
var _OriginalObservable$
|
|
10773
|
+
var _OriginalObservable$p1$LWS;
|
|
9822
10774
|
// istanbul ignore next: optional chaining and nullish coalescing results in an expansion that contains an unreachable "void 0" branch for every occurrence of the operator
|
|
9823
|
-
const
|
|
10775
|
+
const originalSome$LWS = OriginalObservable$LWS == null || (_OriginalObservable$p1$LWS = OriginalObservable$LWS.prototype) == null ? void 0 : _OriginalObservable$p1$LWS.some;
|
|
9824
10776
|
// istanbul ignore if: Observable is always available in coverage environments
|
|
9825
|
-
if (typeof
|
|
10777
|
+
if (typeof originalSome$LWS !== 'function') {
|
|
9826
10778
|
return noop$LWS$1;
|
|
9827
10779
|
}
|
|
9828
|
-
const distortionEntry$LWS = [
|
|
9829
|
-
if (isGaterEnabledFeature$LWS('changesSince.
|
|
10780
|
+
const distortionEntry$LWS = [originalSome$LWS, function some$LWS(...args$LWS) {
|
|
10781
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
9830
10782
|
throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
|
|
9831
10783
|
}
|
|
9832
|
-
return ReflectApply$LWS$1(
|
|
10784
|
+
return ReflectApply$LWS$1(originalSome$LWS, this, args$LWS);
|
|
9833
10785
|
}];
|
|
9834
|
-
return function
|
|
10786
|
+
return function distortionObservableSome$LWS() {
|
|
9835
10787
|
return distortionEntry$LWS;
|
|
9836
10788
|
};
|
|
9837
10789
|
}
|
|
@@ -9840,9 +10792,9 @@
|
|
|
9840
10792
|
Observable: OriginalObservable$LWS
|
|
9841
10793
|
}
|
|
9842
10794
|
}) {
|
|
9843
|
-
var _OriginalObservable$
|
|
10795
|
+
var _OriginalObservable$p10$LWS;
|
|
9844
10796
|
// istanbul ignore next: optional chaining and nullish coalescing results in an expansion that contains an unreachable "void 0" branch for every occurrence of the operator
|
|
9845
|
-
const originalSubscribe$LWS = OriginalObservable$LWS == null || (_OriginalObservable$
|
|
10797
|
+
const originalSubscribe$LWS = OriginalObservable$LWS == null || (_OriginalObservable$p10$LWS = OriginalObservable$LWS.prototype) == null ? void 0 : _OriginalObservable$p10$LWS.subscribe;
|
|
9846
10798
|
// istanbul ignore if: Observable is always available in coverage environments
|
|
9847
10799
|
if (typeof originalSubscribe$LWS !== 'function') {
|
|
9848
10800
|
return noop$LWS$1;
|
|
@@ -9881,6 +10833,28 @@
|
|
|
9881
10833
|
return distortionEntry$LWS;
|
|
9882
10834
|
};
|
|
9883
10835
|
}
|
|
10836
|
+
function initDistortionObservableSwitchMap$LWS({
|
|
10837
|
+
globalObject: {
|
|
10838
|
+
Observable: OriginalObservable$LWS
|
|
10839
|
+
}
|
|
10840
|
+
}) {
|
|
10841
|
+
var _OriginalObservable$p11$LWS;
|
|
10842
|
+
// istanbul ignore next: optional chaining and nullish coalescing results in an expansion that contains an unreachable "void 0" branch for every occurrence of the operator
|
|
10843
|
+
const originalSwitchMap$LWS = OriginalObservable$LWS == null || (_OriginalObservable$p11$LWS = OriginalObservable$LWS.prototype) == null ? void 0 : _OriginalObservable$p11$LWS.switchMap;
|
|
10844
|
+
// istanbul ignore if: Observable is always available in coverage environments
|
|
10845
|
+
if (typeof originalSwitchMap$LWS !== 'function') {
|
|
10846
|
+
return noop$LWS$1;
|
|
10847
|
+
}
|
|
10848
|
+
const distortionEntry$LWS = [originalSwitchMap$LWS, function switchMap$LWS(...args$LWS) {
|
|
10849
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
10850
|
+
throwIfUnsafeCallbackReference$LWS(args$LWS[0]);
|
|
10851
|
+
}
|
|
10852
|
+
return ReflectApply$LWS$1(originalSwitchMap$LWS, this, args$LWS);
|
|
10853
|
+
}];
|
|
10854
|
+
return function distortionObservableSwitchMap$LWS() {
|
|
10855
|
+
return distortionEntry$LWS;
|
|
10856
|
+
};
|
|
10857
|
+
}
|
|
9884
10858
|
function initDistortionPerformanceMark$LWS({
|
|
9885
10859
|
globalObject: {
|
|
9886
10860
|
Performance: {
|
|
@@ -10316,6 +11290,80 @@
|
|
|
10316
11290
|
return distortionEntry$LWS;
|
|
10317
11291
|
};
|
|
10318
11292
|
}
|
|
11293
|
+
|
|
11294
|
+
// W-23748562: distort an iframe contentWindow realm's Proxy constructor.
|
|
11295
|
+
// See Function/cross-realm-invocation.ts for the threat model.
|
|
11296
|
+
//
|
|
11297
|
+
// Proxy is a CAPTURE primitive, in the same family as Function.prototype.bind
|
|
11298
|
+
// (Function/bind-value.ts): it mints a fresh object identity around whatever
|
|
11299
|
+
// `target` it is given, and that identity is opaque to script from then on
|
|
11300
|
+
// ([[ProxyTarget]] is not observable). Once a dangerous callee (e.g. the
|
|
11301
|
+
// sandbox Function ctor) is wrapped this way, the identity-keyed lookup in
|
|
11302
|
+
// substituteDistortedCallee can no longer recognize it when it later reaches
|
|
11303
|
+
// Reflect.construct / .call / .apply — the map misses on the Proxy, not on
|
|
11304
|
+
// the callee it wraps.
|
|
11305
|
+
//
|
|
11306
|
+
// The fix substitutes the target BEFORE the Proxy is built, exactly as bind
|
|
11307
|
+
// substitutes the callee before binding it. Returning an object from a
|
|
11308
|
+
// constructor call short-circuits [[Construct]] (ECMAScript 10.2.2) so this
|
|
11309
|
+
// behaves identically whether reached via `new`, Reflect.construct, or a
|
|
11310
|
+
// .call/.apply/.bind chain on the constructor itself.
|
|
11311
|
+
//
|
|
11312
|
+
// Gated on changesSince.266: this is new distortion behavior, distinct from
|
|
11313
|
+
// getDistortableFrameElement's own changesSince.264 gate on the underlying
|
|
11314
|
+
// cross-realm scoping helper.
|
|
11315
|
+
function initDistortionProxyCtor$LWS({
|
|
11316
|
+
globalObject: {
|
|
11317
|
+
Proxy: originalProxyCtor$LWS
|
|
11318
|
+
}
|
|
11319
|
+
}) {
|
|
11320
|
+
return function distortionProxyCtor$LWS({
|
|
11321
|
+
globalObject: globalObject$LWS,
|
|
11322
|
+
root: root$LWS
|
|
11323
|
+
}) {
|
|
11324
|
+
if (!isGaterEnabledFeature$LWS('changesSince.266') || !getDistortableFrameElement$LWS(globalObject$LWS)) {
|
|
11325
|
+
return undefined;
|
|
11326
|
+
}
|
|
11327
|
+
return [originalProxyCtor$LWS, function Proxy$LWS(target$LWS, handler$LWS) {
|
|
11328
|
+
return new ProxyCtor$LWS(substituteDistortedCallee$LWS(root$LWS, target$LWS), handler$LWS);
|
|
11329
|
+
}];
|
|
11330
|
+
};
|
|
11331
|
+
}
|
|
11332
|
+
|
|
11333
|
+
// W-23748562: distort an iframe contentWindow realm's Proxy.revocable.
|
|
11334
|
+
// See Function/cross-realm-invocation.ts for the threat model and
|
|
11335
|
+
// constructor-value.ts for why Proxy is a capture primitive that needs its
|
|
11336
|
+
// target substituted before the wrapping identity is minted.
|
|
11337
|
+
//
|
|
11338
|
+
// Proxy.revocable needs its OWN entry: per spec (26.2.2.1 Proxy.revocable),
|
|
11339
|
+
// it constructs the exotic Proxy object directly rather than re-invoking the
|
|
11340
|
+
// public Proxy constructor, so distorting the constructor above does not
|
|
11341
|
+
// cover this entry point. We delegate to the original revocable with the
|
|
11342
|
+
// substituted target so the returned { proxy, revoke } pair keeps its native
|
|
11343
|
+
// shape and revocation semantics; only the wrapped target changes.
|
|
11344
|
+
//
|
|
11345
|
+
// Gated on changesSince.266: this is new distortion behavior, distinct from
|
|
11346
|
+
// getDistortableFrameElement's own changesSince.264 gate on the underlying
|
|
11347
|
+
// cross-realm scoping helper.
|
|
11348
|
+
function initDistortionProxyRevocable$LWS({
|
|
11349
|
+
globalObject: {
|
|
11350
|
+
Proxy: {
|
|
11351
|
+
revocable: originalRevocable$LWS
|
|
11352
|
+
}
|
|
11353
|
+
}
|
|
11354
|
+
}) {
|
|
11355
|
+
return function distortionProxyRevocable$LWS({
|
|
11356
|
+
globalObject: globalObject$LWS,
|
|
11357
|
+
root: root$LWS
|
|
11358
|
+
}) {
|
|
11359
|
+
if (!isGaterEnabledFeature$LWS('changesSince.266') || !getDistortableFrameElement$LWS(globalObject$LWS)) {
|
|
11360
|
+
return undefined;
|
|
11361
|
+
}
|
|
11362
|
+
return [originalRevocable$LWS, function revocable$LWS(target$LWS, handler$LWS) {
|
|
11363
|
+
return ReflectApply$LWS$1(originalRevocable$LWS, undefined, [substituteDistortedCallee$LWS(root$LWS, target$LWS), handler$LWS]);
|
|
11364
|
+
}];
|
|
11365
|
+
};
|
|
11366
|
+
}
|
|
10319
11367
|
const {
|
|
10320
11368
|
isSharedElement: isSharedElement$g$LWS
|
|
10321
11369
|
} = rootValidator$LWS;
|
|
@@ -10717,6 +11765,142 @@
|
|
|
10717
11765
|
}];
|
|
10718
11766
|
};
|
|
10719
11767
|
}
|
|
11768
|
+
|
|
11769
|
+
// W-23748456: block cross-realm redefinition of `Error.prepareStackTrace` via a
|
|
11770
|
+
// same-origin iframe realm's `Reflect.defineProperty`. Full threat model and the
|
|
11771
|
+
// KEY-identity reasoning live in Error/prepareStackTrace-shared.ts.
|
|
11772
|
+
function initDistortionReflectDefineProperty$LWS({
|
|
11773
|
+
globalObject: {
|
|
11774
|
+
Error: ErrorCtor$LWS,
|
|
11775
|
+
Reflect: {
|
|
11776
|
+
defineProperty: originalReflectDefineProperty$LWS
|
|
11777
|
+
}
|
|
11778
|
+
}
|
|
11779
|
+
}) {
|
|
11780
|
+
// No V8 prepareStackTrace hook on this platform => nothing to contain.
|
|
11781
|
+
if (!platformSupportsPrepareStackTrace$LWS(ErrorCtor$LWS)) {
|
|
11782
|
+
return noop$LWS$1;
|
|
11783
|
+
}
|
|
11784
|
+
return function distortionReflectDefineProperty$LWS({
|
|
11785
|
+
globalObject: globalObject$LWS
|
|
11786
|
+
}) {
|
|
11787
|
+
if (!isPrepareStackTraceStoreDistortable$LWS(globalObject$LWS)) {
|
|
11788
|
+
return undefined;
|
|
11789
|
+
}
|
|
11790
|
+
return [
|
|
11791
|
+
// KEY: the iframe realm's OWN native, identity-matched across the
|
|
11792
|
+
// membrane. See Error/prepareStackTrace-shared.ts.
|
|
11793
|
+
originalReflectDefineProperty$LWS, function defineProperty$LWS(target$LWS, key$LWS, descriptor$LWS) {
|
|
11794
|
+
const resolvedKey$LWS = resolvePropertyKey$LWS(key$LWS);
|
|
11795
|
+
if (resolvedKey$LWS === PREPARE_STACK_TRACE$LWS) {
|
|
11796
|
+
// Deliberately THROW rather than return `false`. A normal
|
|
11797
|
+
// failed Reflect.defineProperty returns `false`, which is
|
|
11798
|
+
// indistinguishable from ordinary platform behavior; a
|
|
11799
|
+
// throw makes it unmistakable that this is a security
|
|
11800
|
+
// refusal, so the failure is never masked as a routine
|
|
11801
|
+
// define failure.
|
|
11802
|
+
throwPrepareStackTraceBlocked$LWS();
|
|
11803
|
+
}
|
|
11804
|
+
// Any other key: an ordinary define, via the pinned shared
|
|
11805
|
+
// primitive with the already-resolved key (TOCTOU-safe).
|
|
11806
|
+
return ReflectDefineProperty$LWS$1(target$LWS, resolvedKey$LWS, descriptor$LWS);
|
|
11807
|
+
}];
|
|
11808
|
+
};
|
|
11809
|
+
}
|
|
11810
|
+
|
|
11811
|
+
// W-23439899: distort an iframe contentWindow realm's Reflect.get.
|
|
11812
|
+
//
|
|
11813
|
+
// The cross-realm confused-deputy read: sandbox code obtains a same-origin
|
|
11814
|
+
// iframe's blue-realm Reflect.get and applies it to its OWN sandbox document
|
|
11815
|
+
// proxy, e.g. `iframe.contentWindow.Reflect.get(document, 'cookie')`. The
|
|
11816
|
+
// near-membrane apply machinery transfers the red proxy argument back to its
|
|
11817
|
+
// raw blue pointer before the native operation runs, so blue's Reflect.get
|
|
11818
|
+
// performs `[[Get]]` on the UNWRAPPED raw Document and resolves the NATIVE
|
|
11819
|
+
// cookie getter — returning the raw, unfiltered cookie string instead of the
|
|
11820
|
+
// sandbox's namespace-filtered view.
|
|
11821
|
+
//
|
|
11822
|
+
// Unlike Reflect.apply / Reflect.construct (W-22602807), the leaked thing is
|
|
11823
|
+
// not a callee to be swapped: the target object (`document`) maps to itself in
|
|
11824
|
+
// the distortion map, so substituting it is a no-op. The distorted thing is the
|
|
11825
|
+
// resolved ACCESSOR — the distortion map holds `rawCookieGetter -> distorted
|
|
11826
|
+
// (namespace-filtering) getter`. So this replacement resolves the property's
|
|
11827
|
+
// accessor along the target's prototype chain and, when that getter has a
|
|
11828
|
+
// distorted counterpart, invokes the distorted getter against the receiver.
|
|
11829
|
+
// Every other case (data property, non-distorted accessor, missing key) falls
|
|
11830
|
+
// straight through to the native Reflect.get, so behavior is otherwise
|
|
11831
|
+
// byte-identical.
|
|
11832
|
+
function initDistortionReflectGet$LWS({
|
|
11833
|
+
globalObject: {
|
|
11834
|
+
Reflect: {
|
|
11835
|
+
get: originalReflectGet$LWS
|
|
11836
|
+
}
|
|
11837
|
+
}
|
|
11838
|
+
}) {
|
|
11839
|
+
return function distortionReflectGet$LWS({
|
|
11840
|
+
globalObject: globalObject$LWS,
|
|
11841
|
+
root: root$LWS
|
|
11842
|
+
}) {
|
|
11843
|
+
if (!isGaterEnabledFeature$LWS('changesSince.266') || !getDistortableFrameElement$LWS(globalObject$LWS)) {
|
|
11844
|
+
return undefined;
|
|
11845
|
+
}
|
|
11846
|
+
return [originalReflectGet$LWS, function get$LWS(target$LWS, propertyKey$LWS, ...rest$LWS) {
|
|
11847
|
+
// Preserve Reflect.get arity: receiver defaults to target only
|
|
11848
|
+
// when the caller omitted it. An explicit `undefined` third
|
|
11849
|
+
// argument is a distinct receiver per spec, so `rest.length`
|
|
11850
|
+
// (not the value) decides. For the passthrough this is moot
|
|
11851
|
+
// (`Reflect.get(target, key, target)` === `Reflect.get(target,
|
|
11852
|
+
// key)`), but a distorted accessor is invoked against exactly
|
|
11853
|
+
// the caller's receiver.
|
|
11854
|
+
const receiver$LWS = rest$LWS.length > 0 ? rest$LWS[0] : target$LWS;
|
|
11855
|
+
// Resolve the property's accessor along the prototype chain. If
|
|
11856
|
+
// its getter has a distorted counterpart in the sandbox's map,
|
|
11857
|
+
// run THAT against the receiver so the distorted getter (e.g.
|
|
11858
|
+
// the namespace-filtering cookie getter) fires instead of the
|
|
11859
|
+
// raw native one the membrane would otherwise reach on the
|
|
11860
|
+
// unwrapped blue object.
|
|
11861
|
+
//
|
|
11862
|
+
// Proxy fidelity: this walk calls [[GetOwnProperty]] and
|
|
11863
|
+
// [[GetPrototypeOf]] on `target`. Native Reflect.get on a Proxy
|
|
11864
|
+
// WITH a `get` trap invokes only that trap, never these, so a
|
|
11865
|
+
// throwing getOwnPropertyDescriptor/getPrototypeOf trap could
|
|
11866
|
+
// otherwise turn a would-succeed read into a throw. The
|
|
11867
|
+
// confused-deputy target is never a Proxy — the membrane unwraps
|
|
11868
|
+
// the red document proxy to the raw blue host object, whose
|
|
11869
|
+
// own-property and prototype lookups run no sandbox code — so a
|
|
11870
|
+
// throw here means we are NOT on the leak path. Swallow it and
|
|
11871
|
+
// let native Reflect.get decide (re-raising any genuine error),
|
|
11872
|
+
// keeping behavior identical to native for Proxy targets that
|
|
11873
|
+
// resolve without a distorted accessor. The walk only RESOLVES
|
|
11874
|
+
// the distorted getter inside the guard; invoking it happens
|
|
11875
|
+
// after, so an error from the distorted getter itself never
|
|
11876
|
+
// falls through to the raw native read.
|
|
11877
|
+
let distortedGetter$LWS;
|
|
11878
|
+
try {
|
|
11879
|
+
let current$LWS = target$LWS;
|
|
11880
|
+
while (current$LWS !== null && current$LWS !== undefined) {
|
|
11881
|
+
const descriptor$LWS = ReflectGetOwnPropertyDescriptor$LWS(current$LWS, propertyKey$LWS);
|
|
11882
|
+
if (descriptor$LWS !== undefined) {
|
|
11883
|
+
const getter$LWS = descriptor$LWS.get;
|
|
11884
|
+
if (getter$LWS !== undefined) {
|
|
11885
|
+
const candidate$LWS = substituteDistortedCallee$LWS(root$LWS, getter$LWS);
|
|
11886
|
+
if (candidate$LWS !== getter$LWS) {
|
|
11887
|
+
distortedGetter$LWS = candidate$LWS;
|
|
11888
|
+
}
|
|
11889
|
+
}
|
|
11890
|
+
break;
|
|
11891
|
+
}
|
|
11892
|
+
current$LWS = ReflectGetPrototypeOf$LWS$1(current$LWS);
|
|
11893
|
+
}
|
|
11894
|
+
} catch (_unused4$LWS) {
|
|
11895
|
+
// Not the confused-deputy path: defer to native below.
|
|
11896
|
+
}
|
|
11897
|
+
if (distortedGetter$LWS !== undefined) {
|
|
11898
|
+
return ReflectApply$LWS$1(distortedGetter$LWS, receiver$LWS, []);
|
|
11899
|
+
}
|
|
11900
|
+
return originalReflectGet$LWS(target$LWS, propertyKey$LWS, receiver$LWS);
|
|
11901
|
+
}];
|
|
11902
|
+
};
|
|
11903
|
+
}
|
|
10720
11904
|
function initDistortionReportingObserverCtor$LWS({
|
|
10721
11905
|
globalObject: {
|
|
10722
11906
|
ReportingObserver: originalReportingObserverCtor$LWS
|
|
@@ -11364,7 +12548,7 @@
|
|
|
11364
12548
|
try {
|
|
11365
12549
|
originalStorageObject$LWS = globalObject$LWS[storageName$LWS];
|
|
11366
12550
|
// eslint-disable-next-line no-empty
|
|
11367
|
-
} catch (
|
|
12551
|
+
} catch (_unused5$LWS) {}
|
|
11368
12552
|
// istanbul ignore if: currently unreachable via tests
|
|
11369
12553
|
if (!isObject$LWS$1(originalStorageObject$LWS)) {
|
|
11370
12554
|
return noop$LWS$1;
|
|
@@ -11790,7 +12974,7 @@
|
|
|
11790
12974
|
try {
|
|
11791
12975
|
// istanbul ignore next: needs default platform behavior test
|
|
11792
12976
|
return ReflectApply$LWS$1(originalCreatePolicy$LWS, this, args$LWS);
|
|
11793
|
-
} catch (
|
|
12977
|
+
} catch (_unused6$LWS) {
|
|
11794
12978
|
// istanbul ignore next: this is tested, but currently cannot be tested in the coverage environment
|
|
11795
12979
|
consoleWarn$LWS(`${createTrustedTypesExceptionMessage$LWS(name$LWS)} Substituting with Lightning Web Security policy.`);
|
|
11796
12980
|
}
|
|
@@ -11801,6 +12985,68 @@
|
|
|
11801
12985
|
return distortionEntry$LWS;
|
|
11802
12986
|
};
|
|
11803
12987
|
}
|
|
12988
|
+
|
|
12989
|
+
// W-23749358: %TypedArray%.prototype's iteration / reduction / sort methods take
|
|
12990
|
+
// a caller-supplied callback. Unlike Array (a sandbox-realm intrinsic whose
|
|
12991
|
+
// methods run in-realm, so the callback never leaves the sandbox), the typed
|
|
12992
|
+
// array intrinsics are served to sandbox code across the membrane. A callback
|
|
12993
|
+
// argument therefore arrives already unwrapped to its RAW blue reference, and
|
|
12994
|
+
// when that callback is the Function constructor the native method invokes the
|
|
12995
|
+
// raw blue Function — which compiles its body in the undistorted realm and can
|
|
12996
|
+
// read the real document.cookie:
|
|
12997
|
+
//
|
|
12998
|
+
// const value = new Uint8Array([0]);
|
|
12999
|
+
// value.toString = () => 'return document.cookie';
|
|
13000
|
+
// Uint8Array.prototype.reduce.call(value, Function, 'a//')();
|
|
13001
|
+
//
|
|
13002
|
+
// reduce/reduceRight are the directly exploitable pair: the first callback
|
|
13003
|
+
// argument is the caller's arbitrary initialValue (a usable Function
|
|
13004
|
+
// parameter-name string), while a later argument (the array) is String()-coerced
|
|
13005
|
+
// into the body. The element-iterating methods pass a numeric element first,
|
|
13006
|
+
// which is not a valid parameter name, so they cannot form the gadget today.
|
|
13007
|
+
// Every callback-taking method is distorted regardless: re-resolving the callback
|
|
13008
|
+
// through the root distortion map swaps a raw blue evaluator for its
|
|
13009
|
+
// sandbox-distorted counterpart, and is an untouched passthrough for any ordinary
|
|
13010
|
+
// callback (substituteDistortedCallee returns non-distorted values unchanged).
|
|
13011
|
+
//
|
|
13012
|
+
// The callback is argument 0 for all of these methods, so one replacement shape
|
|
13013
|
+
// covers them all: substitute args[0], then delegate to the native method with
|
|
13014
|
+
// the receiver and remaining arguments intact.
|
|
13015
|
+
function makeTypedArrayCallbackDistortion$LWS(methodName$LWS) {
|
|
13016
|
+
return function initTypedArrayCallbackDistortion$LWS({
|
|
13017
|
+
globalObject: globalObject$LWS
|
|
13018
|
+
}) {
|
|
13019
|
+
// %TypedArray%.prototype is not a nameable global; every typed-array
|
|
13020
|
+
// constructor inherits the same methods from it, so read the original off
|
|
13021
|
+
// Uint8Array.prototype — the resolved function IS %TypedArray%.prototype's
|
|
13022
|
+
// own method, identity preserved.
|
|
13023
|
+
const original$LWS = globalObject$LWS.Uint8Array.prototype[methodName$LWS];
|
|
13024
|
+
return function distortTypedArrayCallback$LWS({
|
|
13025
|
+
root: root$LWS
|
|
13026
|
+
}) {
|
|
13027
|
+
if (!isGaterEnabledFeature$LWS('changesSince.266') || typeof original$LWS !== 'function') {
|
|
13028
|
+
return undefined;
|
|
13029
|
+
}
|
|
13030
|
+
const distortionEntry$LWS = [original$LWS, function (callback$LWS, ...rest$LWS) {
|
|
13031
|
+
return ReflectApply$LWS$1(original$LWS, this, [substituteDistortedCallee$LWS(root$LWS, callback$LWS), ...rest$LWS]);
|
|
13032
|
+
}];
|
|
13033
|
+
return distortionEntry$LWS;
|
|
13034
|
+
};
|
|
13035
|
+
};
|
|
13036
|
+
}
|
|
13037
|
+
const initDistortionTypedArrayEvery$LWS = makeTypedArrayCallbackDistortion$LWS('every');
|
|
13038
|
+
const initDistortionTypedArrayFilter$LWS = makeTypedArrayCallbackDistortion$LWS('filter');
|
|
13039
|
+
const initDistortionTypedArrayFind$LWS = makeTypedArrayCallbackDistortion$LWS('find');
|
|
13040
|
+
const initDistortionTypedArrayFindIndex$LWS = makeTypedArrayCallbackDistortion$LWS('findIndex');
|
|
13041
|
+
const initDistortionTypedArrayFindLast$LWS = makeTypedArrayCallbackDistortion$LWS('findLast');
|
|
13042
|
+
const initDistortionTypedArrayFindLastIndex$LWS = makeTypedArrayCallbackDistortion$LWS('findLastIndex');
|
|
13043
|
+
const initDistortionTypedArrayForEach$LWS = makeTypedArrayCallbackDistortion$LWS('forEach');
|
|
13044
|
+
const initDistortionTypedArrayMap$LWS = makeTypedArrayCallbackDistortion$LWS('map');
|
|
13045
|
+
const initDistortionTypedArrayReduce$LWS = makeTypedArrayCallbackDistortion$LWS('reduce');
|
|
13046
|
+
const initDistortionTypedArrayReduceRight$LWS = makeTypedArrayCallbackDistortion$LWS('reduceRight');
|
|
13047
|
+
const initDistortionTypedArraySome$LWS = makeTypedArrayCallbackDistortion$LWS('some');
|
|
13048
|
+
const initDistortionTypedArraySort$LWS = makeTypedArrayCallbackDistortion$LWS('sort');
|
|
13049
|
+
const initDistortionTypedArrayToSorted$LWS = makeTypedArrayCallbackDistortion$LWS('toSorted');
|
|
11804
13050
|
const HTML_MIME_TYPES_LIST$LWS = toSafeArray$LWS$1(['text/html', 'image/svg+xml', 'text/xml']);
|
|
11805
13051
|
const createInsecureBlobErrorMessage$LWS = input$LWS => `Cannot 'createObjectURL' using an unsecure ${toSafeTemplateStringValue$LWS(input$LWS)}.`;
|
|
11806
13052
|
function initDistortionURLCreateObjectURL$LWS({
|
|
@@ -11863,7 +13109,7 @@
|
|
|
11863
13109
|
ReflectApply$LWS$1(XhrProtoOpen$LWS, xhr$LWS, ['GET', outURL$LWS, false]);
|
|
11864
13110
|
try {
|
|
11865
13111
|
ReflectApply$LWS$1(XhrProtoSend$LWS, xhr$LWS, []);
|
|
11866
|
-
} catch (
|
|
13112
|
+
} catch (_unused7$LWS) {
|
|
11867
13113
|
throw new LockerSecurityError$LWS(`Unable to verify ${toSafeTemplateStringValue$LWS(blobObject$LWS)} is secure.`);
|
|
11868
13114
|
}
|
|
11869
13115
|
const responseText$LWS = ReflectApply$LWS$1(XhrProtoResponseTextGetter$LWS, xhr$LWS, []);
|
|
@@ -11886,6 +13132,246 @@
|
|
|
11886
13132
|
}];
|
|
11887
13133
|
};
|
|
11888
13134
|
}
|
|
13135
|
+
|
|
13136
|
+
// Walk the own and inherited property chain of `host` looking for a descriptor
|
|
13137
|
+
// for `key`, returning its getter (or undefined for a data property, an absent
|
|
13138
|
+
// property, or a setter-only accessor). The walk stops at the first descriptor
|
|
13139
|
+
// found so a shadowing data property correctly masks an inherited accessor.
|
|
13140
|
+
function lookupAccessorGetter$LWS(host$LWS, key$LWS) {
|
|
13141
|
+
let current$LWS = host$LWS;
|
|
13142
|
+
while (current$LWS !== null && current$LWS !== undefined) {
|
|
13143
|
+
const descriptor$LWS = ReflectGetOwnPropertyDescriptor$LWS(current$LWS, key$LWS);
|
|
13144
|
+
if (descriptor$LWS !== undefined) {
|
|
13145
|
+
return descriptor$LWS.get;
|
|
13146
|
+
}
|
|
13147
|
+
current$LWS = ReflectGetPrototypeOf$LWS$1(current$LWS);
|
|
13148
|
+
}
|
|
13149
|
+
return undefined;
|
|
13150
|
+
}
|
|
13151
|
+
// Resolve `host[key]` to the value the SANDBOX would observe, given that `host`
|
|
13152
|
+
// is a RAW blue-realm object. The membrane unwraps a distorted function's
|
|
13153
|
+
// arguments to their blue targets before the distortion runs, so a plain read
|
|
13154
|
+
// here would fire native getters and bypass the distortions. This is the
|
|
13155
|
+
// object-graph analog of `substituteDistortedCallee`: it consults the same
|
|
13156
|
+
// `root.distortions` map the membrane's distortionCallback uses.
|
|
13157
|
+
//
|
|
13158
|
+
// - Accessor properties (e.g. `document.cookie`): the native getter is
|
|
13159
|
+
// re-resolved to its distorted replacement in the map before being applied
|
|
13160
|
+
// to the raw receiver, so the distorted getter runs instead of the native
|
|
13161
|
+
// one and returns the sandboxed value.
|
|
13162
|
+
// - Object values (e.g. `window.localStorage`): the resulting object is
|
|
13163
|
+
// re-resolved through the map, yielding the per-sandbox replacement (the
|
|
13164
|
+
// key-namespacing Storage proxy) when one exists.
|
|
13165
|
+
// - Everything else (a real WebAssembly.Memory / Table / Global, a plain
|
|
13166
|
+
// numeric or string value) is returned unchanged, so legitimate imports
|
|
13167
|
+
// keep passing the native linker's brand checks.
|
|
13168
|
+
function readSandboxed$LWS(distortions$LWS, host$LWS, key$LWS) {
|
|
13169
|
+
const getter$LWS = lookupAccessorGetter$LWS(host$LWS, key$LWS);
|
|
13170
|
+
let value$LWS;
|
|
13171
|
+
if (typeof getter$LWS === 'function') {
|
|
13172
|
+
const distortedGetter$LWS = distortions$LWS.get(getter$LWS);
|
|
13173
|
+
const effectiveGetter$LWS = distortedGetter$LWS !== undefined && distortedGetter$LWS !== getter$LWS ? distortedGetter$LWS : getter$LWS;
|
|
13174
|
+
value$LWS = ReflectApply$LWS$1(effectiveGetter$LWS, host$LWS, []);
|
|
13175
|
+
} else {
|
|
13176
|
+
// A data property (or absent property) fires no native getter, so a
|
|
13177
|
+
// plain read cannot expose a lazily computed secret. When `host` is
|
|
13178
|
+
// itself a sandbox replacement proxy (e.g. the namespacing Storage
|
|
13179
|
+
// proxy) this plain read routes through that proxy's trap and is
|
|
13180
|
+
// already sandboxed.
|
|
13181
|
+
value$LWS = host$LWS[key$LWS];
|
|
13182
|
+
}
|
|
13183
|
+
const distortedValue$LWS = distortions$LWS.get(value$LWS);
|
|
13184
|
+
return distortedValue$LWS !== undefined && distortedValue$LWS !== value$LWS ? distortedValue$LWS : value$LWS;
|
|
13185
|
+
}
|
|
13186
|
+
// An own property that is both non-configurable and non-writable (what
|
|
13187
|
+
// `Object.freeze` produces) is bound by the Proxy `[[Get]]` invariant: the trap
|
|
13188
|
+
// MUST return the target's exact stored value, so the property can be neither
|
|
13189
|
+
// substituted nor wrapped. Returning anything else throws a `TypeError`, so a
|
|
13190
|
+
// frozen import object — e.g. `new WebAssembly.Instance(mod, Object.freeze(…))`
|
|
13191
|
+
// — would break where it instantiates natively today. Returns the descriptor
|
|
13192
|
+
// when the invariant binds, `undefined` otherwise (accessors, configurable or
|
|
13193
|
+
// writable data, and absent properties all stay sanitized).
|
|
13194
|
+
//
|
|
13195
|
+
// Honoring the invariant here does not reopen the leak: the exfiltration paths
|
|
13196
|
+
// (`document.cookie`, `window.localStorage`) are INHERITED accessors on the raw
|
|
13197
|
+
// host object, never frozen own data, so this guard never short-circuits them.
|
|
13198
|
+
// The only values it returns verbatim are a target's own frozen data — either
|
|
13199
|
+
// leaves of a sandbox-authored object (already membrane-filtered, since the
|
|
13200
|
+
// sandbox holds no raw host references) or real WebAssembly values — none of
|
|
13201
|
+
// which carry a raw host secret.
|
|
13202
|
+
function sealedOwnDataDescriptor$LWS(target$LWS, key$LWS) {
|
|
13203
|
+
const descriptor$LWS = ReflectGetOwnPropertyDescriptor$LWS(target$LWS, key$LWS);
|
|
13204
|
+
if (descriptor$LWS !== undefined && descriptor$LWS.writable === false && descriptor$LWS.configurable === false) {
|
|
13205
|
+
return descriptor$LWS;
|
|
13206
|
+
}
|
|
13207
|
+
return undefined;
|
|
13208
|
+
}
|
|
13209
|
+
// Wrap a single module-namespace object so the second linking read,
|
|
13210
|
+
// `Get(namespace, field)`, is sanitized in the same way as the first.
|
|
13211
|
+
function createNamespaceProxy$LWS(distortions$LWS, namespace$LWS) {
|
|
13212
|
+
return new ProxyCtor$LWS(namespace$LWS, {
|
|
13213
|
+
get(target$LWS, key$LWS) {
|
|
13214
|
+
const sealed$LWS = sealedOwnDataDescriptor$LWS(target$LWS, key$LWS);
|
|
13215
|
+
if (sealed$LWS !== undefined) {
|
|
13216
|
+
return sealed$LWS.value;
|
|
13217
|
+
}
|
|
13218
|
+
return readSandboxed$LWS(distortions$LWS, target$LWS, key$LWS);
|
|
13219
|
+
}
|
|
13220
|
+
});
|
|
13221
|
+
}
|
|
13222
|
+
// Replace a WebAssembly import object with a Proxy that exposes ONLY sandboxed
|
|
13223
|
+
// values to the native linker. WebAssembly resolves each two-level import
|
|
13224
|
+
// (`module`.`field`) by reading `Get(importObject, module)` then
|
|
13225
|
+
// `Get(namespace, field)`; both reads funnel through `readSandboxed`, so a
|
|
13226
|
+
// hand-crafted import naming a host property path (the W-23439980 bypass) can
|
|
13227
|
+
// only ever observe the membrane-filtered value.
|
|
13228
|
+
function sanitizeWasmImportObject$LWS(root$LWS, importObject$LWS) {
|
|
13229
|
+
const {
|
|
13230
|
+
distortions: distortions$LWS
|
|
13231
|
+
} = root$LWS;
|
|
13232
|
+
return new ProxyCtor$LWS(importObject$LWS, {
|
|
13233
|
+
get(target$LWS, moduleKey$LWS) {
|
|
13234
|
+
// A frozen own module entry is bound by the `[[Get]]` invariant and
|
|
13235
|
+
// must be returned verbatim (see `sealedOwnDataDescriptor`). It is a
|
|
13236
|
+
// sandbox-authored value, so it is already membrane-filtered.
|
|
13237
|
+
const sealed$LWS = sealedOwnDataDescriptor$LWS(target$LWS, moduleKey$LWS);
|
|
13238
|
+
if (sealed$LWS !== undefined) {
|
|
13239
|
+
return sealed$LWS.value;
|
|
13240
|
+
}
|
|
13241
|
+
const namespace$LWS = readSandboxed$LWS(distortions$LWS, target$LWS, moduleKey$LWS);
|
|
13242
|
+
// Wrap object namespaces so their field reads are sanitized too. A
|
|
13243
|
+
// non-object namespace is an invalid import that the native linker
|
|
13244
|
+
// will reject, so it passes through unwrapped.
|
|
13245
|
+
return isObject$LWS$1(namespace$LWS) ? createNamespaceProxy$LWS(distortions$LWS, namespace$LWS) : namespace$LWS;
|
|
13246
|
+
}
|
|
13247
|
+
});
|
|
13248
|
+
}
|
|
13249
|
+
|
|
13250
|
+
// W-23439980: a sandboxed module can hand-craft a WebAssembly module whose
|
|
13251
|
+
// two-level import name is a host property path (e.g. module="document",
|
|
13252
|
+
// field="cookie") typed as an immutable externref global, then re-export it.
|
|
13253
|
+
// `new WebAssembly.Instance(module, importObject)` makes the NATIVE linker
|
|
13254
|
+
// perform the nested property reads in C++. The membrane unwraps `importObject`
|
|
13255
|
+
// to the raw blue-realm object before the native call, so those reads never
|
|
13256
|
+
// pass through the sandbox proxy traps that fire the distortions. Sanitizing
|
|
13257
|
+
// the import object closes that path for the synchronous entry point.
|
|
13258
|
+
function initDistortionWebAssemblyInstanceCtor$LWS({
|
|
13259
|
+
globalObject: {
|
|
13260
|
+
WebAssembly: WebAssembly$LWS
|
|
13261
|
+
}
|
|
13262
|
+
}) {
|
|
13263
|
+
const originalInstanceCtor$LWS = WebAssembly$LWS == null ? void 0 : WebAssembly$LWS.Instance;
|
|
13264
|
+
// istanbul ignore if: WebAssembly is always available in coverage environments
|
|
13265
|
+
if (typeof originalInstanceCtor$LWS !== 'function') {
|
|
13266
|
+
return noop$LWS$1;
|
|
13267
|
+
}
|
|
13268
|
+
return function distortionWebAssemblyInstanceCtor$LWS({
|
|
13269
|
+
root: root$LWS
|
|
13270
|
+
}) {
|
|
13271
|
+
return [originalInstanceCtor$LWS, function Instance$LWS(...args$LWS) {
|
|
13272
|
+
if (isGaterEnabledFeature$LWS('changesSince.266') && args$LWS.length > 1 && args$LWS[1] != null) {
|
|
13273
|
+
args$LWS[1] = sanitizeWasmImportObject$LWS(root$LWS, args$LWS[1]);
|
|
13274
|
+
}
|
|
13275
|
+
return ReflectConstruct$LWS(originalInstanceCtor$LWS, args$LWS);
|
|
13276
|
+
}];
|
|
13277
|
+
};
|
|
13278
|
+
}
|
|
13279
|
+
|
|
13280
|
+
// W-23439980 (async entry point). `WebAssembly.instantiate` accepts either a
|
|
13281
|
+
// compiled `WebAssembly.Module` or a `BufferSource` as its first argument; in
|
|
13282
|
+
// both overloads the import object is the second argument. Distorting it here
|
|
13283
|
+
// closes the same raw-import leak covered by the `WebAssembly.Instance`
|
|
13284
|
+
// constructor distortion for asynchronous instantiation. The import object is
|
|
13285
|
+
// sanitized synchronously before delegating to the native function, so the
|
|
13286
|
+
// returned promise is the native promise unchanged.
|
|
13287
|
+
function initDistortionWebAssemblyInstantiate$LWS({
|
|
13288
|
+
globalObject: {
|
|
13289
|
+
WebAssembly: WebAssembly$LWS
|
|
13290
|
+
}
|
|
13291
|
+
}) {
|
|
13292
|
+
const originalInstantiate$LWS = WebAssembly$LWS == null ? void 0 : WebAssembly$LWS.instantiate;
|
|
13293
|
+
// istanbul ignore if: WebAssembly is always available in coverage environments
|
|
13294
|
+
if (typeof originalInstantiate$LWS !== 'function') {
|
|
13295
|
+
return noop$LWS$1;
|
|
13296
|
+
}
|
|
13297
|
+
return function distortionWebAssemblyInstantiate$LWS({
|
|
13298
|
+
root: root$LWS
|
|
13299
|
+
}) {
|
|
13300
|
+
return [originalInstantiate$LWS, function instantiate$LWS(...args$LWS) {
|
|
13301
|
+
if (isGaterEnabledFeature$LWS('changesSince.266') && args$LWS.length > 1 && args$LWS[1] != null) {
|
|
13302
|
+
args$LWS[1] = sanitizeWasmImportObject$LWS(root$LWS, args$LWS[1]);
|
|
13303
|
+
}
|
|
13304
|
+
return ReflectApply$LWS$1(originalInstantiate$LWS, this, args$LWS);
|
|
13305
|
+
}];
|
|
13306
|
+
};
|
|
13307
|
+
}
|
|
13308
|
+
|
|
13309
|
+
// W-23439980 (streaming entry point). `WebAssembly.instantiateStreaming` takes
|
|
13310
|
+
// a `Response` (or promise of one) as its first argument and the import object
|
|
13311
|
+
// as its second. It compiles and instantiates in one step, so it is a distinct
|
|
13312
|
+
// doorway to the raw-import leak and must be distorted separately from
|
|
13313
|
+
// `instantiate`. The import object is sanitized synchronously before delegating
|
|
13314
|
+
// to the native function.
|
|
13315
|
+
function initDistortionWebAssemblyInstantiateStreaming$LWS({
|
|
13316
|
+
globalObject: {
|
|
13317
|
+
WebAssembly: WebAssembly$LWS
|
|
13318
|
+
}
|
|
13319
|
+
}) {
|
|
13320
|
+
const originalInstantiateStreaming$LWS = WebAssembly$LWS == null ? void 0 : WebAssembly$LWS.instantiateStreaming;
|
|
13321
|
+
// istanbul ignore if: instantiateStreaming is unavailable in some coverage environments
|
|
13322
|
+
if (typeof originalInstantiateStreaming$LWS !== 'function') {
|
|
13323
|
+
return noop$LWS$1;
|
|
13324
|
+
}
|
|
13325
|
+
return function distortionWebAssemblyInstantiateStreaming$LWS({
|
|
13326
|
+
root: root$LWS
|
|
13327
|
+
}) {
|
|
13328
|
+
return [originalInstantiateStreaming$LWS, function instantiateStreaming$LWS(...args$LWS) {
|
|
13329
|
+
if (isGaterEnabledFeature$LWS('changesSince.266') && args$LWS.length > 1 && args$LWS[1] != null) {
|
|
13330
|
+
args$LWS[1] = sanitizeWasmImportObject$LWS(root$LWS, args$LWS[1]);
|
|
13331
|
+
}
|
|
13332
|
+
return ReflectApply$LWS$1(originalInstantiateStreaming$LWS, this, args$LWS);
|
|
13333
|
+
}];
|
|
13334
|
+
};
|
|
13335
|
+
}
|
|
13336
|
+
|
|
13337
|
+
// W-23768151: JSPI's `WebAssembly.Suspending` boxes a callable so a wasm module
|
|
13338
|
+
// can call it across a stack switch (resumed later via `WebAssembly.promising`).
|
|
13339
|
+
// Sandbox code can pass its own `Function` global to
|
|
13340
|
+
// `new WebAssembly.Suspending(fn)`. The membrane unwraps `fn` to its RAW
|
|
13341
|
+
// blue-realm target before this distortion runs, so the native constructor
|
|
13342
|
+
// would otherwise box the undistorted `Function`; a wasm module linked with
|
|
13343
|
+
// that boxed import then compiles a body like `return document.cookie` in the
|
|
13344
|
+
// blue realm and reads the real top-level value outside the sandbox view.
|
|
13345
|
+
//
|
|
13346
|
+
// This is a distinct doorway from the import-object scan the `Instance`/
|
|
13347
|
+
// `instantiate`/`instantiateStreaming` distortions perform: the callable is
|
|
13348
|
+
// handed directly to `Suspending`, never read through a `Get` on an import
|
|
13349
|
+
// object, so that scan never sees it. Re-resolving the argument through
|
|
13350
|
+
// `root.distortions` — the same map the membrane's distortionCallback consults —
|
|
13351
|
+
// swaps a laundered evaluator back to its sandbox-distorted counterpart, so the
|
|
13352
|
+
// boxed callable compiles in the sandbox realm. An ordinary sandbox closure is
|
|
13353
|
+
// not in the map, so it passes through unchanged.
|
|
13354
|
+
function initDistortionWebAssemblySuspending$LWS({
|
|
13355
|
+
globalObject: {
|
|
13356
|
+
WebAssembly: WebAssembly$LWS
|
|
13357
|
+
}
|
|
13358
|
+
}) {
|
|
13359
|
+
const originalSuspending$LWS = WebAssembly$LWS == null ? void 0 : WebAssembly$LWS.Suspending;
|
|
13360
|
+
// istanbul ignore if: JSPI is unavailable in some coverage environments
|
|
13361
|
+
if (typeof originalSuspending$LWS !== 'function') {
|
|
13362
|
+
return noop$LWS$1;
|
|
13363
|
+
}
|
|
13364
|
+
return function distortionWebAssemblySuspending$LWS({
|
|
13365
|
+
root: root$LWS
|
|
13366
|
+
}) {
|
|
13367
|
+
return [originalSuspending$LWS, function Suspending$LWS(...args$LWS) {
|
|
13368
|
+
if (isGaterEnabledFeature$LWS('changesSince.266') && args$LWS.length > 0) {
|
|
13369
|
+
args$LWS[0] = substituteDistortedCallee$LWS(root$LWS, args$LWS[0]);
|
|
13370
|
+
}
|
|
13371
|
+
return ReflectConstruct$LWS(originalSuspending$LWS, args$LWS);
|
|
13372
|
+
}];
|
|
13373
|
+
};
|
|
13374
|
+
}
|
|
11889
13375
|
function initDistortionWindowFetch$LWS({
|
|
11890
13376
|
globalObject: {
|
|
11891
13377
|
fetch: originalFetch$LWS
|
|
@@ -12145,7 +13631,18 @@
|
|
|
12145
13631
|
const windowPropertiesProxy$LWS = new ProxyCtor$LWS(shadowWindowProperties$LWS, shadowWindowPropertiesHandler$LWS);
|
|
12146
13632
|
ReflectSetPrototypeOf$LWS$1(shadowFrames$LWS, framesPrototypeProxy$LWS);
|
|
12147
13633
|
ReflectSetPrototypeOf$LWS$1(shadowFramesPrototype$LWS, windowPropertiesProxy$LWS);
|
|
12148
|
-
|
|
13634
|
+
// Each proxy in this chain re-points its immediate prototype away from
|
|
13635
|
+
// `Object.prototype` to emulate the real `frames` -> `FrameList` ->
|
|
13636
|
+
// `WindowProperties` lookup chain. `isTargetLive` treats a
|
|
13637
|
+
// `constructor === Object` target as live only when its *immediate*
|
|
13638
|
+
// prototype is `Object.prototype`, so without an explicit signal these
|
|
13639
|
+
// proxies would be classified as static and the membrane would wrap
|
|
13640
|
+
// them, breaking the pass-through `set`/`deleteProperty` traps and
|
|
13641
|
+
// `window.frames === window.frames` identity. Track them so
|
|
13642
|
+
// `isTargetLive`'s live-target short-circuit fires first.
|
|
13643
|
+
trackAsLiveTarget$LWS(framesPrototypeProxy$LWS);
|
|
13644
|
+
trackAsLiveTarget$LWS(windowPropertiesProxy$LWS);
|
|
13645
|
+
return trackAsLiveTarget$LWS(new ProxyCtor$LWS(shadowFrames$LWS, shadowFramesHandler$LWS));
|
|
12149
13646
|
};
|
|
12150
13647
|
let framesProxy$LWS;
|
|
12151
13648
|
const distortionEntry$LWS = [originalWindowFramesGetter$LWS, function frames$LWS() {
|
|
@@ -12577,8 +14074,31 @@
|
|
|
12577
14074
|
// MAY CONTAIN a custom element, which must be marked for
|
|
12578
14075
|
// association to this sandbox.
|
|
12579
14076
|
setCustomElementsRegistry$LWS(document$LWS, key$LWS);
|
|
12580
|
-
|
|
12581
|
-
|
|
14077
|
+
// W-23439992: `instanceof Document` only recognizes a Document
|
|
14078
|
+
// from this realm. When the XHR is constructed in another
|
|
14079
|
+
// same-origin realm (e.g. a same-origin iframe's
|
|
14080
|
+
// `XMLHttpRequest`), a `responseType='document'` response is a
|
|
14081
|
+
// genuine Document from that other realm and fails the
|
|
14082
|
+
// realm-bound check, so sanitization is skipped and the raw
|
|
14083
|
+
// (unsanitized) response is returned. The structural fallback
|
|
14084
|
+
// recognizes a Document from any realm by reading a native
|
|
14085
|
+
// `Document.prototype` accessor: a real Document (any realm)
|
|
14086
|
+
// has the backing internal slot and the call succeeds, while a
|
|
14087
|
+
// non-Document response (JSON, text, Blob, ArrayBuffer, null)
|
|
14088
|
+
// throws and is passed through untouched, as before.
|
|
14089
|
+
let docEl$LWS;
|
|
14090
|
+
let isDocument$LWS = rawResponse$LWS instanceof Document$LWS;
|
|
14091
|
+
if (isDocument$LWS) {
|
|
14092
|
+
docEl$LWS = ReflectApply$LWS$1(DocumentProtoDocumentElementGetter$LWS, rawResponse$LWS, []);
|
|
14093
|
+
} else if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
14094
|
+
try {
|
|
14095
|
+
docEl$LWS = ReflectApply$LWS$1(DocumentProtoDocumentElementGetter$LWS, rawResponse$LWS, []);
|
|
14096
|
+
isDocument$LWS = true;
|
|
14097
|
+
} catch (_unused8$LWS) {
|
|
14098
|
+
isDocument$LWS = false;
|
|
14099
|
+
}
|
|
14100
|
+
}
|
|
14101
|
+
if (isDocument$LWS) {
|
|
12582
14102
|
const content$LWS = ReflectApply$LWS$1(ElementProtoOuterHTMLGetter$LWS, docEl$LWS, []);
|
|
12583
14103
|
if (isGaterEnabledFeature$LWS('changesSince.262') && (isXMLEntityAttack$LWS(content$LWS) || isXMLNamespacedScriptAttack$LWS(content$LWS))) {
|
|
12584
14104
|
throw new LockerSecurityError$LWS(`Cannot access XMLHttpRequest response using an unsecure ${toSafeTemplateStringValue$LWS(rawResponse$LWS)}.`);
|
|
@@ -12681,7 +14201,7 @@
|
|
|
12681
14201
|
// Navigator
|
|
12682
14202
|
initDistortionNavigatorSendBeacon$LWS, initDistortionNavigatorServiceWorkerGetter$LWS,
|
|
12683
14203
|
// Observable
|
|
12684
|
-
initDistortionObservableForEach$LWS, initDistortionObservableSubscribe$LWS,
|
|
14204
|
+
initDistortionObservableCatch$LWS, initDistortionObservableEvery$LWS, initDistortionObservableFilter$LWS, initDistortionObservableFinally$LWS, initDistortionObservableFind$LWS, initDistortionObservableFlatMap$LWS, initDistortionObservableForEach$LWS, initDistortionObservableInspect$LWS, initDistortionObservableMap$LWS, initDistortionObservableReduce$LWS, initDistortionObservableSome$LWS, initDistortionObservableSubscribe$LWS, initDistortionObservableSwitchMap$LWS,
|
|
12685
14205
|
// Node
|
|
12686
14206
|
initDistortionNodeGetRootNode$LWS, initDistortionNodeParentElementGetter$LWS, initDistortionNodeParentNodeGetter$LWS, initDistortionNodeRemoveChild$LWS, initDistortionNodeReplaceChild$LWS,
|
|
12687
14207
|
// Performance
|
|
@@ -12692,10 +14212,14 @@
|
|
|
12692
14212
|
initDistortionPromiseAll$LWS, initDistortionPromiseAllSettled$LWS, initDistortionPromiseAny$LWS, initDistortionPromiseCatch$LWS, initDistortionPromiseFinally$LWS, initDistortionPromiseRace$LWS, initDistortionPromiseReject$LWS, initDistortionPromiseResolve$LWS, initDistortionPromiseThen$LWS, initDistortionPromiseTry$LWS, initDistortionPromiseWithResolvers$LWS,
|
|
12693
14213
|
// Notification
|
|
12694
14214
|
initDistortionNotificationCtor$LWS,
|
|
14215
|
+
// Object
|
|
14216
|
+
initDistortionObjectDefineProperties$LWS, initDistortionObjectDefineProperty$LWS,
|
|
14217
|
+
// Proxy
|
|
14218
|
+
initDistortionProxyCtor$LWS, initDistortionProxyRevocable$LWS,
|
|
12695
14219
|
// Range
|
|
12696
14220
|
initDistortionRangeCloneContents$LWS, initDistortionRangeCloneRange$LWS, initDistortionRangeDeleteContents$LWS, initDistortionRangeExtractContents$LWS, initDistortionRangeGetBoundingClientRect$LWS, initDistortionRangeInsertNode$LWS, initDistortionRangeSelectNode$LWS, initDistortionRangeSelectNodeContents$LWS, initDistortionRangeSetEnd$LWS, initDistortionRangeSetEndAfter$LWS, initDistortionRangeSetEndBefore$LWS, initDistortionRangeSetStart$LWS, initDistortionRangeSetStartAfter$LWS, initDistortionRangeSetStartBefore$LWS, initDistortionRangeSurroundContents$LWS, initDistortionRangeToString$LWS,
|
|
12697
14221
|
// Reflect
|
|
12698
|
-
initDistortionReflectApply$LWS, initDistortionReflectConstruct$LWS,
|
|
14222
|
+
initDistortionReflectApply$LWS, initDistortionReflectConstruct$LWS, initDistortionReflectDefineProperty$LWS, initDistortionReflectGet$LWS,
|
|
12699
14223
|
// Selection
|
|
12700
14224
|
initDistortionSelectionAnchorNodeGetter$LWS, initDistortionSelectionCollapse$LWS, initDistortionSelectionExtend$LWS, initDistortionSelectionFocusNodeGetter$LWS, initDistortionSelectionSelectAllChildren$LWS, initDistortionSelectionSetBaseAndExtent$LWS, initDistortionSelectionSetPosition$LWS, initDistortionSelectionToString$LWS,
|
|
12701
14225
|
// ServiceWorkerContainer
|
|
@@ -12716,6 +14240,10 @@
|
|
|
12716
14240
|
initDistortionSVGUseElementHrefAttribute$LWS, initDistortionSVGUseElementXlinkHrefAttribute$LWS,
|
|
12717
14241
|
// TrustedTypePolicyFactory
|
|
12718
14242
|
initDistortionTrustedTypePolicyFactoryCreatePolicy$LWS,
|
|
14243
|
+
// TypedArray
|
|
14244
|
+
initDistortionTypedArrayEvery$LWS, initDistortionTypedArrayFilter$LWS, initDistortionTypedArrayFind$LWS, initDistortionTypedArrayFindIndex$LWS, initDistortionTypedArrayFindLast$LWS, initDistortionTypedArrayFindLastIndex$LWS, initDistortionTypedArrayForEach$LWS, initDistortionTypedArrayMap$LWS, initDistortionTypedArrayReduce$LWS, initDistortionTypedArrayReduceRight$LWS, initDistortionTypedArraySome$LWS, initDistortionTypedArraySort$LWS, initDistortionTypedArrayToSorted$LWS,
|
|
14245
|
+
// WebAssembly
|
|
14246
|
+
initDistortionWebAssemblyInstanceCtor$LWS, initDistortionWebAssemblyInstantiate$LWS, initDistortionWebAssemblyInstantiateStreaming$LWS, initDistortionWebAssemblySuspending$LWS,
|
|
12719
14247
|
// Window
|
|
12720
14248
|
initDistortionWindowFetch$LWS, initDistortionWindowFetchLater$LWS, initDistortionWindowFramesGetter$LWS, initDistortionWindowGetComputedStyle$LWS, initDistortionWindowLengthGetter$LWS, initDistortionWindowNameGetter$LWS, initDistortionWindowNameSetter$LWS, initDistortionWindowOpen$LWS, initDistortionWindowPostMessage$LWS, initDistortionWindowStructuredClone$LWS,
|
|
12721
14249
|
// Worker
|
|
@@ -12800,7 +14328,7 @@
|
|
|
12800
14328
|
// initDistortionNodeAppendChild,
|
|
12801
14329
|
initDistortionNodeInsertBefore$LWS]);
|
|
12802
14330
|
const externalKeyedDistortionFactoryInitializers$LWS = internalKeyedDistortionFactoryInitializers$LWS;
|
|
12803
|
-
const distortionFactoryInitializerToggleSwitches$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1([[initDistortionBroadcastChannelCtor$LWS, 'broadcastChannel'], [initDistortionBroadcastChannelNameGetter$LWS, 'broadcastChannel'], [initDistortionCacheStorageDelete$LWS, 'caches'], [initDistortionCacheStorageHas$LWS, 'caches'], [initDistortionCacheStorageKeys$LWS, 'caches'], [initDistortionCacheStorageMatch$LWS, 'caches'], [initDistortionCacheStorageOpen$LWS, 'caches'], [initDistortionCookieStoreDelete$LWS, 'cookieStore'], [initDistortionCookieStoreGet$LWS, 'cookieStore'], [initDistortionCookieStoreGetAll$LWS, 'cookieStore'], [initDistortionCookieStoreOnChange$LWS, 'cookieStore'], [initDistortionCookieStoreSet$LWS, 'cookieStore'], [initDistortionCSSStyleRuleStyleGetter$LWS, 'style'], [initDistortionCustomElementRegistryDefine$LWS, 'customElements'], [initDistortionCustomElementRegistryGet$LWS, 'customElements'], [initDistortionCustomElementRegistryUpgrade$LWS, 'customElements'], [initDistortionCustomElementRegistryWhenDefined$LWS, 'customElements'], [initDistortionDocumentCookieGetter$LWS, 'documentCookie'], [initDistortionDocumentCookieSetter$LWS, 'documentCookie'], [initDistortionDocumentDomainSetter$LWS, 'documentDomain'], [initDistortionDocumentExecCommand$LWS, 'documentExecCommand'], [initDistortionDOMParserParseFromString$LWS, 'domParserParseFromString'], [initDistortionDOMTokenListAdd$LWS, 'domTokenList'], [initDistortionDOMTokenListReplace$LWS, 'domTokenList'], [initDistortionDOMTokenListToggle$LWS, 'domTokenList'], [initDistortionDOMTokenListValueSetter$LWS, 'domTokenList'], [initDistortionElementAfter$LWS, 'element'], [initDistortionElementAppend$LWS, 'element'], [initDistortionElementAttributesGetter$LWS, 'attributes'], [initDistortionElementBefore$LWS, 'element'], [initDistortionElementGetInnerHTML$LWS, 'innerHTML'], [initDistortionElementInnerHTMLSetter$LWS, 'innerHTML'], [initDistortionElementInsertAdjacentElement$LWS, 'element'], [initDistortionElementInsertAdjacentHTML$LWS, 'element'], [initDistortionElementOuterHTMLSetter$LWS, 'element'], [initDistortionElementPrepend$LWS, 'element'], [initDistortionElementRemove$LWS, 'element'], [initDistortionElementReplaceChildren$LWS, 'element'], [initDistortionElementReplaceWith$LWS, 'element'], [initDistortionElementGetAttribute$LWS, 'attributes'], [initDistortionElementGetAttributeNode$LWS, 'attributes'], [initDistortionElementGetAttributeNodeNS$LWS, 'attributes'], [initDistortionElementGetAttributeNS$LWS, 'attributes'], [initDistortionElementSetAttribute$LWS, 'attributes'], [initDistortionElementSetAttributeNode$LWS, 'attributes'], [initDistortionElementSetAttributeNodeNS$LWS, 'attributes'], [initDistortionElementSetAttributeNS$LWS, 'attributes'], [initDistortionElementRemoveAttribute$LWS, 'attributes'], [initDistortionElementRemoveAttributeNS$LWS, 'attributes'], [initDistortionElementRemoveAttributeNode$LWS, 'attributes'], [initDistortionElementSetHTML$LWS, 'element'], [initDistortionElementToggleAttribute$LWS, 'attributes'], [initDistortionHTMLButtonElementFormActionSetter$LWS, 'form'], [initDistortionHTMLFormElementActionSetter$LWS, 'form'], [initDistortionHTMLInputElementFormActionSetter$LWS, 'form'], [initDistortionHistoryPushState$LWS, 'history'], [initDistortionHistoryReplaceState$LWS, 'history'], [initDistortionHTMLElementDatasetGetter$LWS, 'dataset'], [initDistortionHTMLElementStyleGetter$LWS, 'style'], [initDistortionHTMLImageElementSrcSetter$LWS, 'networkSrc'], [initDistortionHTMLImageElementSrcsetSetter$LWS, 'networkSrc'], [initDistortionHTMLLinkElementHrefSetter$LWS, 'networkSrc'], [initDistortionHTMLMediaElementSrcSetter$LWS, 'networkSrc'], [initDistortionHTMLSourceElementSrcSetter$LWS, 'networkSrc'], [initDistortionHTMLSourceElementSrcsetSetter$LWS, 'networkSrc'], [initDistortionHTMLTrackElementSrcSetter$LWS, 'networkSrc'], [initDistortionHTMLScriptElementInnerTextGetter$LWS, 'script'], [initDistortionHTMLScriptElementInnerTextSetter$LWS, 'script'], [initDistortionHTMLScriptElementSrcGetter$LWS, 'script'], [initDistortionHTMLScriptElementSrcSetter$LWS, 'script'], [initDistortionHTMLScriptElementTextGetter$LWS, 'script'], [initDistortionHTMLScriptElementTextSetter$LWS, 'script'], [initDistortionIDBFactoryDatabases$LWS, 'indexedDB'], [initDistortionIDBFactoryDeleteDatabase$LWS, 'indexedDB'], [initDistortionIDBFactoryOpen$LWS, 'indexedDB'], [initDistortionIDBObjectStoreAdd$LWS, 'indexedDB'], [initDistortionIDBObjectStorePut$LWS, 'indexedDB'], [initDistortionLocalStorage$LWS, 'storage'], [initDistortionMessagePortPostMessage$LWS, 'postMessage'], [initDistortionIntersectionObserverObserve$LWS, 'observers'], [initDistortionMutationObserverObserve$LWS, 'mutationObserver'], [initDistortionPerformanceObserverObserve$LWS, 'observers'], [initDistortionResizeObserverObserve$LWS, 'observers'], [initDistortionAttrValueGetter$LWS, 'attributes'], [initDistortionAttrValueSetter$LWS, 'attributes'], [initDistortionNamedNodeMapGetNamedItem$LWS, 'attributes'], [initDistortionNamedNodeMapGetNamedItemNS$LWS, 'attributes'], [initDistortionNamedNodeMapRemoveNamedItem$LWS, 'attributes'], [initDistortionNamedNodeMapRemoveNamedItemNS$LWS, 'attributes'], [initDistortionNamedNodeMapSetNamedItem$LWS, 'attributes'], [initDistortionNamedNodeMapSetNamedItemNS$LWS, 'attributes'], [initDistortionNavigatorSendBeacon$LWS, 'navigatorSendBeacon'], [initDistortionObservableForEach$LWS, 'observable'], [initDistortionObservableSubscribe$LWS, 'observable'], [initDistortionNodeGetRootNode$LWS, 'node'], [initDistortionNodeInsertBefore$LWS, 'node'], [initDistortionNodeParentElementGetter$LWS, 'node'], [initDistortionNodeParentNodeGetter$LWS, 'node'], [initDistortionNodeRemoveChild$LWS, 'node'], [initDistortionNodeReplaceChild$LWS, 'node'], [initDistortionNodeTextContentGetter$LWS, 'node'], [initDistortionNodeTextContentSetter$LWS, 'node'], [initDistortionNodeValueSetter$LWS, 'node'], [initDistortionNotificationCtor$LWS, 'notification'], [initDistortionPerformanceMark$LWS, 'performance'], [initDistortionPerformanceMarkCtor$LWS, 'performance'], [initDistortionPerformanceMeasure$LWS, 'performance'], [initDistortionRangeCloneContents$LWS, 'range'], [initDistortionRangeCloneRange$LWS, 'range'], [initDistortionRangeCreateContextualFragment$LWS, 'range'], [initDistortionRangeDeleteContents$LWS, 'range'], [initDistortionRangeExtractContents$LWS, 'range'], [initDistortionRangeGetBoundingClientRect$LWS, 'range'], [initDistortionRangeInsertNode$LWS, 'range'], [initDistortionRangeSelectNode$LWS, 'range'], [initDistortionRangeSelectNodeContents$LWS, 'range'], [initDistortionRangeSetEnd$LWS, 'range'], [initDistortionRangeSetEndAfter$LWS, 'range'], [initDistortionRangeSetEndBefore$LWS, 'range'], [initDistortionRangeSetStart$LWS, 'range'], [initDistortionRangeSetStartAfter$LWS, 'range'], [initDistortionRangeSetStartBefore$LWS, 'range'], [initDistortionRangeSurroundContents$LWS, 'range'], [initDistortionRangeToString$LWS, 'range'], [initDistortionSelectionAnchorNodeGetter$LWS, 'selection'], [initDistortionSelectionCollapse$LWS, 'selection'], [initDistortionSelectionExtend$LWS, 'selection'], [initDistortionSelectionFocusNodeGetter$LWS, 'selection'], [initDistortionSelectionSelectAllChildren$LWS, 'selection'], [initDistortionSelectionSetBaseAndExtent$LWS, 'selection'], [initDistortionSelectionSetPosition$LWS, 'selection'], [initDistortionSelectionToString$LWS, 'selection'], [initDistortionSessionStorage$LWS, 'storage'], [initDistortionShadowRootInnerHTMLSetter$LWS, 'innerHTML'], [initDistortionStorage$LWS, 'storage'], [initDistortionStorageClear$LWS, 'storage'], [initDistortionStorageGetItem$LWS, 'storage'], [initDistortionStorageKey$LWS, 'storage'], [initDistortionStorageLength$LWS, 'storage'], [initDistortionStorageRemoveItem$LWS, 'storage'], [initDistortionStorageSetItem$LWS, 'storage'], [initDistortionSVGElementDatasetGetter$LWS, 'dataset'], [initDistortionSVGElementStyleGetter$LWS, 'style'], [initDistortionSVGAnimatedStringBaseValSetter$LWS, 'script'], [initDistortionSVGScriptElementHrefGetter$LWS, 'script'], [initDistortionSVGScriptElementHrefSetter$LWS, 'script'], [initDistortionWindowFetch$LWS, 'windowFetch'], [initDistortionWindowFetchLater$LWS, 'windowFetchLater'], [initDistortionWindowFramesGetter$LWS, 'windowFrames'], [initDistortionWindowGetComputedStyle$LWS, 'style'], [initDistortionWindowLengthGetter$LWS, 'windowFrames'], [initDistortionWindowNameGetter$LWS, 'windowName'], [initDistortionWindowNameSetter$LWS, 'windowName'], [initDistortionWindowPostMessage$LWS, 'postMessage'], [initDistortionWindowSetInterval$LWS, 'setInterval'], [initDistortionWindowSetTimeout$LWS, 'setTimeout'], [initDistortionXMLHttpRequestResponseGetter$LWS, 'xhr'], [initDistortionXMLHttpRequestResponseXMLGetter$LWS, 'xhr']]));
|
|
14331
|
+
const distortionFactoryInitializerToggleSwitches$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1([[initDistortionBroadcastChannelCtor$LWS, 'broadcastChannel'], [initDistortionBroadcastChannelNameGetter$LWS, 'broadcastChannel'], [initDistortionCacheStorageDelete$LWS, 'caches'], [initDistortionCacheStorageHas$LWS, 'caches'], [initDistortionCacheStorageKeys$LWS, 'caches'], [initDistortionCacheStorageMatch$LWS, 'caches'], [initDistortionCacheStorageOpen$LWS, 'caches'], [initDistortionCookieStoreDelete$LWS, 'cookieStore'], [initDistortionCookieStoreGet$LWS, 'cookieStore'], [initDistortionCookieStoreGetAll$LWS, 'cookieStore'], [initDistortionCookieStoreOnChange$LWS, 'cookieStore'], [initDistortionCookieStoreSet$LWS, 'cookieStore'], [initDistortionCSSStyleRuleStyleGetter$LWS, 'style'], [initDistortionCustomElementRegistryDefine$LWS, 'customElements'], [initDistortionCustomElementRegistryGet$LWS, 'customElements'], [initDistortionCustomElementRegistryUpgrade$LWS, 'customElements'], [initDistortionCustomElementRegistryWhenDefined$LWS, 'customElements'], [initDistortionDocumentCookieGetter$LWS, 'documentCookie'], [initDistortionDocumentCookieSetter$LWS, 'documentCookie'], [initDistortionDocumentDomainSetter$LWS, 'documentDomain'], [initDistortionDocumentExecCommand$LWS, 'documentExecCommand'], [initDistortionDOMParserParseFromString$LWS, 'domParserParseFromString'], [initDistortionDOMTokenListAdd$LWS, 'domTokenList'], [initDistortionDOMTokenListReplace$LWS, 'domTokenList'], [initDistortionDOMTokenListToggle$LWS, 'domTokenList'], [initDistortionDOMTokenListValueSetter$LWS, 'domTokenList'], [initDistortionElementAfter$LWS, 'element'], [initDistortionElementAppend$LWS, 'element'], [initDistortionElementAttributesGetter$LWS, 'attributes'], [initDistortionElementBefore$LWS, 'element'], [initDistortionElementGetInnerHTML$LWS, 'innerHTML'], [initDistortionElementInnerHTMLSetter$LWS, 'innerHTML'], [initDistortionElementInsertAdjacentElement$LWS, 'element'], [initDistortionElementInsertAdjacentHTML$LWS, 'element'], [initDistortionElementOuterHTMLSetter$LWS, 'element'], [initDistortionElementPrepend$LWS, 'element'], [initDistortionElementRemove$LWS, 'element'], [initDistortionElementReplaceChildren$LWS, 'element'], [initDistortionElementReplaceWith$LWS, 'element'], [initDistortionElementGetAttribute$LWS, 'attributes'], [initDistortionElementGetAttributeNode$LWS, 'attributes'], [initDistortionElementGetAttributeNodeNS$LWS, 'attributes'], [initDistortionElementGetAttributeNS$LWS, 'attributes'], [initDistortionElementSetAttribute$LWS, 'attributes'], [initDistortionElementSetAttributeNode$LWS, 'attributes'], [initDistortionElementSetAttributeNodeNS$LWS, 'attributes'], [initDistortionElementSetAttributeNS$LWS, 'attributes'], [initDistortionElementRemoveAttribute$LWS, 'attributes'], [initDistortionElementRemoveAttributeNS$LWS, 'attributes'], [initDistortionElementRemoveAttributeNode$LWS, 'attributes'], [initDistortionElementSetHTML$LWS, 'element'], [initDistortionElementToggleAttribute$LWS, 'attributes'], [initDistortionHTMLButtonElementFormActionSetter$LWS, 'form'], [initDistortionHTMLFormElementActionSetter$LWS, 'form'], [initDistortionHTMLInputElementFormActionSetter$LWS, 'form'], [initDistortionHistoryPushState$LWS, 'history'], [initDistortionHistoryReplaceState$LWS, 'history'], [initDistortionHTMLElementDatasetGetter$LWS, 'dataset'], [initDistortionHTMLElementStyleGetter$LWS, 'style'], [initDistortionHTMLImageElementSrcSetter$LWS, 'networkSrc'], [initDistortionHTMLImageElementSrcsetSetter$LWS, 'networkSrc'], [initDistortionHTMLLinkElementHrefSetter$LWS, 'networkSrc'], [initDistortionHTMLMediaElementSrcSetter$LWS, 'networkSrc'], [initDistortionHTMLSourceElementSrcSetter$LWS, 'networkSrc'], [initDistortionHTMLSourceElementSrcsetSetter$LWS, 'networkSrc'], [initDistortionHTMLTrackElementSrcSetter$LWS, 'networkSrc'], [initDistortionHTMLScriptElementInnerTextGetter$LWS, 'script'], [initDistortionHTMLScriptElementInnerTextSetter$LWS, 'script'], [initDistortionHTMLScriptElementSrcGetter$LWS, 'script'], [initDistortionHTMLScriptElementSrcSetter$LWS, 'script'], [initDistortionHTMLScriptElementTextGetter$LWS, 'script'], [initDistortionHTMLScriptElementTextSetter$LWS, 'script'], [initDistortionIDBFactoryDatabases$LWS, 'indexedDB'], [initDistortionIDBFactoryDeleteDatabase$LWS, 'indexedDB'], [initDistortionIDBFactoryOpen$LWS, 'indexedDB'], [initDistortionIDBObjectStoreAdd$LWS, 'indexedDB'], [initDistortionIDBObjectStorePut$LWS, 'indexedDB'], [initDistortionLocalStorage$LWS, 'storage'], [initDistortionMessagePortPostMessage$LWS, 'postMessage'], [initDistortionIntersectionObserverObserve$LWS, 'observers'], [initDistortionMutationObserverObserve$LWS, 'mutationObserver'], [initDistortionPerformanceObserverObserve$LWS, 'observers'], [initDistortionResizeObserverObserve$LWS, 'observers'], [initDistortionAttrValueGetter$LWS, 'attributes'], [initDistortionAttrValueSetter$LWS, 'attributes'], [initDistortionNamedNodeMapGetNamedItem$LWS, 'attributes'], [initDistortionNamedNodeMapGetNamedItemNS$LWS, 'attributes'], [initDistortionNamedNodeMapRemoveNamedItem$LWS, 'attributes'], [initDistortionNamedNodeMapRemoveNamedItemNS$LWS, 'attributes'], [initDistortionNamedNodeMapSetNamedItem$LWS, 'attributes'], [initDistortionNamedNodeMapSetNamedItemNS$LWS, 'attributes'], [initDistortionNavigatorSendBeacon$LWS, 'navigatorSendBeacon'], [initDistortionObservableCatch$LWS, 'observable'], [initDistortionObservableEvery$LWS, 'observable'], [initDistortionObservableFilter$LWS, 'observable'], [initDistortionObservableFinally$LWS, 'observable'], [initDistortionObservableFind$LWS, 'observable'], [initDistortionObservableFlatMap$LWS, 'observable'], [initDistortionObservableForEach$LWS, 'observable'], [initDistortionObservableInspect$LWS, 'observable'], [initDistortionObservableMap$LWS, 'observable'], [initDistortionObservableReduce$LWS, 'observable'], [initDistortionObservableSome$LWS, 'observable'], [initDistortionObservableSubscribe$LWS, 'observable'], [initDistortionObservableSwitchMap$LWS, 'observable'], [initDistortionNodeGetRootNode$LWS, 'node'], [initDistortionNodeInsertBefore$LWS, 'node'], [initDistortionNodeParentElementGetter$LWS, 'node'], [initDistortionNodeParentNodeGetter$LWS, 'node'], [initDistortionNodeRemoveChild$LWS, 'node'], [initDistortionNodeReplaceChild$LWS, 'node'], [initDistortionNodeTextContentGetter$LWS, 'node'], [initDistortionNodeTextContentSetter$LWS, 'node'], [initDistortionNodeValueSetter$LWS, 'node'], [initDistortionNotificationCtor$LWS, 'notification'], [initDistortionPerformanceMark$LWS, 'performance'], [initDistortionPerformanceMarkCtor$LWS, 'performance'], [initDistortionPerformanceMeasure$LWS, 'performance'], [initDistortionRangeCloneContents$LWS, 'range'], [initDistortionRangeCloneRange$LWS, 'range'], [initDistortionRangeCreateContextualFragment$LWS, 'range'], [initDistortionRangeDeleteContents$LWS, 'range'], [initDistortionRangeExtractContents$LWS, 'range'], [initDistortionRangeGetBoundingClientRect$LWS, 'range'], [initDistortionRangeInsertNode$LWS, 'range'], [initDistortionRangeSelectNode$LWS, 'range'], [initDistortionRangeSelectNodeContents$LWS, 'range'], [initDistortionRangeSetEnd$LWS, 'range'], [initDistortionRangeSetEndAfter$LWS, 'range'], [initDistortionRangeSetEndBefore$LWS, 'range'], [initDistortionRangeSetStart$LWS, 'range'], [initDistortionRangeSetStartAfter$LWS, 'range'], [initDistortionRangeSetStartBefore$LWS, 'range'], [initDistortionRangeSurroundContents$LWS, 'range'], [initDistortionRangeToString$LWS, 'range'], [initDistortionSelectionAnchorNodeGetter$LWS, 'selection'], [initDistortionSelectionCollapse$LWS, 'selection'], [initDistortionSelectionExtend$LWS, 'selection'], [initDistortionSelectionFocusNodeGetter$LWS, 'selection'], [initDistortionSelectionSelectAllChildren$LWS, 'selection'], [initDistortionSelectionSetBaseAndExtent$LWS, 'selection'], [initDistortionSelectionSetPosition$LWS, 'selection'], [initDistortionSelectionToString$LWS, 'selection'], [initDistortionSessionStorage$LWS, 'storage'], [initDistortionShadowRootInnerHTMLSetter$LWS, 'innerHTML'], [initDistortionStorage$LWS, 'storage'], [initDistortionStorageClear$LWS, 'storage'], [initDistortionStorageGetItem$LWS, 'storage'], [initDistortionStorageKey$LWS, 'storage'], [initDistortionStorageLength$LWS, 'storage'], [initDistortionStorageRemoveItem$LWS, 'storage'], [initDistortionStorageSetItem$LWS, 'storage'], [initDistortionSVGElementDatasetGetter$LWS, 'dataset'], [initDistortionSVGElementStyleGetter$LWS, 'style'], [initDistortionSVGAnimatedStringBaseValSetter$LWS, 'script'], [initDistortionSVGScriptElementHrefGetter$LWS, 'script'], [initDistortionSVGScriptElementHrefSetter$LWS, 'script'], [initDistortionWindowFetch$LWS, 'windowFetch'], [initDistortionWindowFetchLater$LWS, 'windowFetchLater'], [initDistortionWindowFramesGetter$LWS, 'windowFrames'], [initDistortionWindowGetComputedStyle$LWS, 'style'], [initDistortionWindowLengthGetter$LWS, 'windowFrames'], [initDistortionWindowNameGetter$LWS, 'windowName'], [initDistortionWindowNameSetter$LWS, 'windowName'], [initDistortionWindowPostMessage$LWS, 'postMessage'], [initDistortionWindowSetInterval$LWS, 'setInterval'], [initDistortionWindowSetTimeout$LWS, 'setTimeout'], [initDistortionXMLHttpRequestResponseGetter$LWS, 'xhr'], [initDistortionXMLHttpRequestResponseXMLGetter$LWS, 'xhr']]));
|
|
12804
14332
|
const DocumentBlockedProperties$LWS = ['parseHTMLUnsafe'];
|
|
12805
14333
|
const DocumentProtoBlockedProperties$LWS = ['createProcessingInstruction', 'exitFullscreen', 'fullscreen', 'fullscreenElement', 'fullscreenEnabled', 'mozCancelFullScreen', 'mozFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'onfullscreenchange', 'onfullscreenerror', 'onmozfullscreenchange', 'onmozfullscreenerror', 'onrejectionhandled', 'onunhandledrejection', 'parseHTMLUnsafe', 'releaseCapture', 'releaseEvents', 'requestStorageAccess', 'webkitFullScreenKeyboardInputAllowed', 'write', 'writeln'];
|
|
12806
14334
|
const ElementProtoBlockedProperties$LWS = ['mozRequestFullScreen', 'onfullscreenchange', 'onfullscreenerror', 'requestFullscreen', 'webkitRequestFullScreen', 'webkitRequestFullscreen'];
|
|
@@ -12816,12 +14344,20 @@
|
|
|
12816
14344
|
const HTMLObjectElementProtoBlockedProperties$LWS = ['getSVGDocument'];
|
|
12817
14345
|
const HTMLScriptElementBlockedAttributes$LWS = ['nonce'];
|
|
12818
14346
|
const HTMLScriptElementProtoBlockedProperties$LWS = ['nonce'];
|
|
14347
|
+
|
|
14348
|
+
// `originalPolicy` serializes the page's full Content-Security-Policy text,
|
|
14349
|
+
// including any `script-src 'nonce-...'` source expression. A sandboxed
|
|
14350
|
+
// listener that reads it can lift the live CSP nonce and forge markup the
|
|
14351
|
+
// page's CSP would otherwise reject. Block the read so the nonce cannot leak
|
|
14352
|
+
// through a SecurityPolicyViolationEvent, complementing the already-blocked
|
|
14353
|
+
// `nonce` attribute/property and the ReportingObserver lockdown.
|
|
14354
|
+
const SecurityPolicyViolationEventProtoBlockedProperties$LWS = ['originalPolicy'];
|
|
12819
14355
|
const SVGElementBlockedAttributes$LWS = ['nonce'];
|
|
12820
14356
|
const SVGElementProtoBlockedProperties$LWS = ['nonce'];
|
|
12821
14357
|
const UIEventProtoBlockedProperties$LWS = ['rangeParent'];
|
|
12822
14358
|
const WindowBlockedProperties$LWS = ['find', 'requestFileSystem', 'webkitRequestFileSystem'];
|
|
12823
14359
|
const XSLTProcessorProtoBlockedProperties$LWS = ['transformToDocument', 'transformToFragment'];
|
|
12824
|
-
/*! version: 0.
|
|
14360
|
+
/*! version: 0.29.0 */
|
|
12825
14361
|
|
|
12826
14362
|
/*!
|
|
12827
14363
|
* Copyright (C) 2021 salesforce.com, inc.
|
|
@@ -12830,7 +14366,7 @@
|
|
|
12830
14366
|
function getPdpSchema$LWS() {
|
|
12831
14367
|
return pdpSchema$LWS;
|
|
12832
14368
|
}
|
|
12833
|
-
/*! version: 0.
|
|
14369
|
+
/*! version: 0.29.0 */
|
|
12834
14370
|
|
|
12835
14371
|
/*!
|
|
12836
14372
|
* Copyright (C) 2019 salesforce.com, inc.
|
|
@@ -13117,6 +14653,11 @@
|
|
|
13117
14653
|
addBlockedPropertyDistortionFactoryInitializers$LWS(record$LWS, HTMLScriptElement$LWS.prototype, HTMLScriptElementProtoBlockedProperties$LWS, initializers$LWS);
|
|
13118
14654
|
addBlockedPropertyDistortionFactoryInitializers$LWS(record$LWS, SVGElement$LWS.prototype, SVGElementProtoBlockedProperties$LWS, initializers$LWS);
|
|
13119
14655
|
addBlockedPropertyDistortionFactoryInitializers$LWS(record$LWS, UIEvent$LWS.prototype, UIEventProtoBlockedProperties$LWS, initializers$LWS);
|
|
14656
|
+
// istanbul ignore else: SecurityPolicyViolationEvent is not implemented in
|
|
14657
|
+
// every engine (e.g. jsdom), so guard on its presence like XSLTProcessor below.
|
|
14658
|
+
if (isGaterEnabledFeature$LWS('changesSince.266') && typeof SecurityPolicyViolationEvent === 'function') {
|
|
14659
|
+
addBlockedPropertyDistortionFactoryInitializers$LWS(record$LWS, SecurityPolicyViolationEvent.prototype, SecurityPolicyViolationEventProtoBlockedProperties$LWS, initializers$LWS);
|
|
14660
|
+
}
|
|
13120
14661
|
addBlockedPropertyDistortionFactoryInitializers$LWS(record$LWS, globalObject$LWS, WindowBlockedProperties$LWS, initializers$LWS);
|
|
13121
14662
|
// istanbul ignore else: this is a safety precaution that is unreachable via tests
|
|
13122
14663
|
if (typeof XSLTProcessor$LWS === 'function') {
|
|
@@ -14968,22 +16509,40 @@
|
|
|
14968
16509
|
const thisArgOrNewTarget$LWS = isApplyTrap$LWS ? thisArgOrArgs$LWS : argsOrNewTarget$LWS;
|
|
14969
16510
|
let combinedOffset$LWS = 2;
|
|
14970
16511
|
const combinedArgs$LWS = new ArrayCtor$LWS(length$LWS + combinedOffset$LWS);
|
|
14971
|
-
|
|
16512
|
+
// Use `[[DefineOwnProperty]]` (via `ReflectDefineProperty`) rather than
|
|
16513
|
+
// `[[Set]]` (`combinedArgs[i] = value`) to populate the combined arguments.
|
|
16514
|
+
// A plain array still inherits from `Array.prototype`, so a `[[Set]]` on a
|
|
16515
|
+
// numeric index would invoke an inherited accessor if sandboxed code has
|
|
16516
|
+
// installed one (e.g. `Object.defineProperty(Array.prototype, '2', { set })`).
|
|
16517
|
+
// Such a setter can observe and overwrite the pointers marshalled here —
|
|
16518
|
+
// including `combinedArgs[0]`, the foreign target pointer — redirecting the
|
|
16519
|
+
// call to a different foreign callable. Defining own data properties bypasses
|
|
16520
|
+
// the prototype chain entirely and is immune to prototype pollution.
|
|
16521
|
+
ReflectDefineProperty$LWS(combinedArgs$LWS, 0, {
|
|
16522
|
+
__proto__: null,
|
|
16523
|
+
value: foreignTargetPointer$LWS
|
|
16524
|
+
});
|
|
14972
16525
|
let pointerOrPrimitive$LWS;
|
|
14973
16526
|
try {
|
|
14974
|
-
|
|
14975
|
-
|
|
14976
|
-
|
|
14977
|
-
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
|
|
14978
|
-
typeof thisArgOrNewTarget$LWS === 'undefined' ? undefined : thisArgOrNewTarget$LWS;
|
|
14979
|
-
for (let i$LWS = 0; i$LWS < length$LWS; i$LWS += 1) {
|
|
14980
|
-
const arg$LWS = args$LWS[i$LWS];
|
|
14981
|
-
// Inlining `getTransferableValue()`.
|
|
14982
|
-
combinedArgs$LWS[combinedOffset$LWS++] = typeof arg$LWS === 'object' && arg$LWS !== null || typeof arg$LWS === 'function' ? getTransferablePointer$LWS(arg$LWS) :
|
|
16527
|
+
ReflectDefineProperty$LWS(combinedArgs$LWS, 1, {
|
|
16528
|
+
__proto__: null,
|
|
16529
|
+
value: typeof thisArgOrNewTarget$LWS === 'object' && thisArgOrNewTarget$LWS !== null || typeof thisArgOrNewTarget$LWS === 'function' ? getTransferablePointer$LWS(thisArgOrNewTarget$LWS) :
|
|
14983
16530
|
// Intentionally ignoring `document.all`.
|
|
14984
16531
|
// https://developer.mozilla.org/en-US/docs/Web/API/Document/all
|
|
14985
16532
|
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
|
|
14986
|
-
typeof
|
|
16533
|
+
typeof thisArgOrNewTarget$LWS === 'undefined' ? undefined : thisArgOrNewTarget$LWS
|
|
16534
|
+
});
|
|
16535
|
+
for (let i$LWS = 0; i$LWS < length$LWS; i$LWS += 1) {
|
|
16536
|
+
const arg$LWS = args$LWS[i$LWS];
|
|
16537
|
+
// Inlining `getTransferableValue()`.
|
|
16538
|
+
ReflectDefineProperty$LWS(combinedArgs$LWS, combinedOffset$LWS++, {
|
|
16539
|
+
__proto__: null,
|
|
16540
|
+
value: typeof arg$LWS === 'object' && arg$LWS !== null || typeof arg$LWS === 'function' ? getTransferablePointer$LWS(arg$LWS) :
|
|
16541
|
+
// Intentionally ignoring `document.all`.
|
|
16542
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Document/all
|
|
16543
|
+
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
|
|
16544
|
+
typeof arg$LWS === 'undefined' ? undefined : arg$LWS
|
|
16545
|
+
});
|
|
14987
16546
|
}
|
|
14988
16547
|
pointerOrPrimitive$LWS = ReflectApply$LWS(foreignCallableApplyOrConstruct$LWS, undefined, combinedArgs$LWS);
|
|
14989
16548
|
} catch (error) {
|
|
@@ -15566,10 +17125,36 @@
|
|
|
15566
17125
|
// Replace pending traps with live traps that can work with the
|
|
15567
17126
|
// target without taking snapshots.
|
|
15568
17127
|
this.deleteProperty = BoundaryProxyHandler$LWS.passthruDeletePropertyTrap;
|
|
15569
|
-
this.defineProperty = BoundaryProxyHandler$LWS.passthruDefinePropertyTrap;
|
|
15570
17128
|
this.preventExtensions = BoundaryProxyHandler$LWS.passthruPreventExtensionsTrap;
|
|
15571
17129
|
this.set = BoundaryProxyHandler$LWS.passthruSetTrap;
|
|
15572
|
-
|
|
17130
|
+
// `[[DefineOwnProperty]]` is passthru for DATA descriptors
|
|
17131
|
+
// (the expando capability live targets actually need) but
|
|
17132
|
+
// accessor descriptors are scoped to the shadow target. The
|
|
17133
|
+
// passthru variant calls `foreignCallableDefineProperty` on the
|
|
17134
|
+
// RAW foreign target; for an accessor that plants a
|
|
17135
|
+
// sandbox-authored getter/setter directly onto a host-shared
|
|
17136
|
+
// object. Because the descriptor's functions are marshalled as
|
|
17137
|
+
// pointers back into the sandbox, any later access from the
|
|
17138
|
+
// primary realm (a confused deputy reading the planted key)
|
|
17139
|
+
// would execute sandbox code with the RAW object as `this` and
|
|
17140
|
+
// read raw-global-only state through it. Data expandos carry no
|
|
17141
|
+
// such callback, so they remain passthru; only accessors are
|
|
17142
|
+
// contained. See `liveAccessorGuardedDefinePropertyTrap`.
|
|
17143
|
+
this.defineProperty = BoundaryProxyHandler$LWS.liveAccessorGuardedDefinePropertyTrap;
|
|
17144
|
+
// `[[SetPrototypeOf]]` is the one live trap we do not
|
|
17145
|
+
// passthru. The passthru variant calls `ReflectSetPrototypeOf`
|
|
17146
|
+
// on the RAW foreign target, which lets sandbox code splice a
|
|
17147
|
+
// foreign prototype (e.g. the primary-realm global) onto a live
|
|
17148
|
+
// target and then read foreign globals through inherited
|
|
17149
|
+
// lookups: live reads resolve against the RAW prototype chain
|
|
17150
|
+
// (`hybridGetTrap` -> `lookupForeignDescriptor`), never the
|
|
17151
|
+
// shadow target. It also lets sandbox code wipe a host-shared
|
|
17152
|
+
// object's prototype to `null`. Scoping the proto change to the
|
|
17153
|
+
// shadow target makes both observably inert while leaving
|
|
17154
|
+
// `set`/`deleteProperty` passthru (the capabilities live targets
|
|
17155
|
+
// actually need) untouched. No legitimate live target re-parents
|
|
17156
|
+
// itself across the membrane.
|
|
17157
|
+
this.setPrototypeOf = BoundaryProxyHandler$LWS.staticSetPrototypeOfTrap;
|
|
15573
17158
|
} : noop$LWS;
|
|
15574
17159
|
this.makeProxyStatic = IS_IN_SHADOW_REALM$LWS ? function () {
|
|
15575
17160
|
// Reset all traps except apply and construct for static proxies
|
|
@@ -15921,6 +17506,25 @@
|
|
|
15921
17506
|
if (IS_NOT_IN_SHADOW_REALM$LWS && (key$LWS === LOCKER_NEAR_MEMBRANE_SYMBOL$LWS || key$LWS === LOCKER_NEAR_MEMBRANE_SERIALIZED_VALUE_SYMBOL$LWS)) {
|
|
15922
17507
|
throw new TypeErrorCtor$LWS(ERR_ILLEGAL_PROPERTY_ACCESS$LWS);
|
|
15923
17508
|
}
|
|
17509
|
+
// `x.__proto__ = value` triggers the `Object.prototype.__proto__`
|
|
17510
|
+
// accessor, whose setter performs `[[SetPrototypeOf]]` on the
|
|
17511
|
+
// target. This is the live target's `set` trap, and its passthru
|
|
17512
|
+
// below would forward the write to the RAW foreign target,
|
|
17513
|
+
// running the raw realm's `__proto__` setter and reparenting the
|
|
17514
|
+
// raw object. That reintroduces the `setPrototypeOf` isolation
|
|
17515
|
+
// leak (W-23623814) through property-assignment syntax: a
|
|
17516
|
+
// subsequent inherited read would resolve foreign members
|
|
17517
|
+
// against the spliced prototype. Confine an own `__proto__`
|
|
17518
|
+
// write to the shadow target by delegating to `ReflectSet` on
|
|
17519
|
+
// it, exactly as static proxies do via `staticSetTrap`; the red
|
|
17520
|
+
// realm's own `__proto__` accessor then applies the correct
|
|
17521
|
+
// ordinary semantics (primitive no-op, Object/Null reparent)
|
|
17522
|
+
// scoped to the shadow target. A non-own write
|
|
17523
|
+
// (`proxy !== receiver`) targets the other receiver, not the
|
|
17524
|
+
// raw foreign target, so it is left to the passthru path.
|
|
17525
|
+
if (IS_IN_SHADOW_REALM$LWS && key$LWS === '__proto__' && proxy$LWS === receiver$LWS) {
|
|
17526
|
+
return ReflectSet$LWS(shadowTarget$LWS, key$LWS, value$LWS, shadowTarget$LWS);
|
|
17527
|
+
}
|
|
15924
17528
|
const isFastPath$LWS = proxy$LWS === receiver$LWS;
|
|
15925
17529
|
let result$LWS = false;
|
|
15926
17530
|
try {
|
|
@@ -16155,6 +17759,76 @@
|
|
|
16155
17759
|
}
|
|
16156
17760
|
return result$LWS;
|
|
16157
17761
|
} : alwaysFalse$LWS;
|
|
17762
|
+
// `[[DefineOwnProperty]]` trap for LIVE targets. Data descriptors are the
|
|
17763
|
+
// expando capability live targets rely on and stay passthru to the RAW
|
|
17764
|
+
// foreign target via `passthruDefinePropertyTrap`. Accessor descriptors
|
|
17765
|
+
// (a `get` and/or `set`), however, would install sandbox-authored
|
|
17766
|
+
// functions onto a host-shared object; a subsequent access from the
|
|
17767
|
+
// primary realm would run that sandbox code with the RAW target as
|
|
17768
|
+
// receiver and expose raw-global-only state. We contain accessors on the
|
|
17769
|
+
// inert shadow target instead. This mirrors the `staticSetPrototypeOfTrap`
|
|
17770
|
+
// contract: the operation is observably inert from every side. A live
|
|
17771
|
+
// `get` resolves against the RAW foreign target (`lookupForeignDescriptor`
|
|
17772
|
+
// reads the raw own descriptor and walks the RAW prototype chain; it only
|
|
17773
|
+
// ever writes the shadow target, never reads its own properties), so the
|
|
17774
|
+
// sandbox reads back `undefined` for a shadow-scoped accessor too. The
|
|
17775
|
+
// security-relevant guarantee is that no sandbox-authored callback ever
|
|
17776
|
+
// reaches the raw host-shared object.
|
|
17777
|
+
//
|
|
17778
|
+
// The shadow-scoped copy is always written with `configurable: true`,
|
|
17779
|
+
// regardless of what the sandbox asked for. A live proxy's `has`,
|
|
17780
|
+
// `ownKeys`, and `getOwnPropertyDescriptor` traps are NOT overridden by
|
|
17781
|
+
// `makeProxyLive()` (see `hybridHasTrap`, `passthruOwnKeysTrap`,
|
|
17782
|
+
// `passthruGetOwnPropertyDescriptorTrap`): they all resolve against the
|
|
17783
|
+
// RAW foreign target and never consult the shadow target's own
|
|
17784
|
+
// properties. `Object.defineProperty` defaults `configurable` to
|
|
17785
|
+
// `false`, so the common `{ get() {...} }` shape would otherwise leave
|
|
17786
|
+
// the shadow target — the proxy's actual `[[ProxyTarget]]` — holding a
|
|
17787
|
+
// NON-CONFIGURABLE own key that those raw-resolving traps can never
|
|
17788
|
+
// mirror. The engine's proxy invariants then throw on the very next
|
|
17789
|
+
// `has`/`ownKeys`/`getOwnPropertyDescriptor` (`in`, `Object.keys`,
|
|
17790
|
+
// spread, `JSON.stringify`, `Object.getOwnPropertyDescriptor`, ...)
|
|
17791
|
+
// because a non-configurable target key must be reported by those traps
|
|
17792
|
+
// and it never can be. Since the accessor is invisible through the
|
|
17793
|
+
// proxy either way (reads resolve against the raw target), forcing
|
|
17794
|
+
// `configurable: true` is not observable to the sandbox, and it keeps
|
|
17795
|
+
// every read-side invariant satisfiable. An explicit `configurable:
|
|
17796
|
+
// false` request cannot be honored while preserving that invisibility;
|
|
17797
|
+
// it now fails fast with a native TypeError raised by the engine's own
|
|
17798
|
+
// `defineProperty` trap-result invariant check (requested
|
|
17799
|
+
// non-configurable vs. an actually-configurable target descriptor) at
|
|
17800
|
+
// the `defineProperty` call site itself, rather than deferring the
|
|
17801
|
+
// detonation to a later, unrelated read.
|
|
17802
|
+
BoundaryProxyHandler$LWS.liveAccessorGuardedDefinePropertyTrap = IS_IN_SHADOW_REALM$LWS ? function (shadowTarget$LWS, key$LWS, unsafePartialDesc$LWS) {
|
|
17803
|
+
// A descriptor is an accessor iff it carries a `get` or `set`.
|
|
17804
|
+
// Read membership before detaching the prototype so a poisoned
|
|
17805
|
+
// `Object.prototype` getter cannot forge the answer.
|
|
17806
|
+
const isAccessorDescriptor$LWS = 'get' in unsafePartialDesc$LWS || 'set' in unsafePartialDesc$LWS;
|
|
17807
|
+
if (isAccessorDescriptor$LWS) {
|
|
17808
|
+
lastProxyTrapCalled$LWS = 4 /* ProxyHandlerTraps.DefineProperty */;
|
|
17809
|
+
// Build a fresh descriptor rather than writing the
|
|
17810
|
+
// sandbox's `unsafePartialDesc` object directly, and
|
|
17811
|
+
// force `configurable: true` on the shadow-scoped copy
|
|
17812
|
+
// (see the block comment above).
|
|
17813
|
+
const shadowDesc$LWS = {
|
|
17814
|
+
__proto__: null
|
|
17815
|
+
};
|
|
17816
|
+
if ('get' in unsafePartialDesc$LWS) {
|
|
17817
|
+
shadowDesc$LWS.get = unsafePartialDesc$LWS.get;
|
|
17818
|
+
}
|
|
17819
|
+
if ('set' in unsafePartialDesc$LWS) {
|
|
17820
|
+
shadowDesc$LWS.set = unsafePartialDesc$LWS.set;
|
|
17821
|
+
}
|
|
17822
|
+
if ('enumerable' in unsafePartialDesc$LWS) {
|
|
17823
|
+
shadowDesc$LWS.enumerable = unsafePartialDesc$LWS.enumerable;
|
|
17824
|
+
}
|
|
17825
|
+
shadowDesc$LWS.configurable = true;
|
|
17826
|
+
// Scope the accessor to the shadow target: observably
|
|
17827
|
+
// defined for the sandbox, never planted on the raw object.
|
|
17828
|
+
return ReflectDefineProperty$LWS(shadowTarget$LWS, key$LWS, shadowDesc$LWS);
|
|
17829
|
+
}
|
|
17830
|
+
return ReflectApply$LWS(BoundaryProxyHandler$LWS.passthruDefinePropertyTrap, this, [shadowTarget$LWS, key$LWS, unsafePartialDesc$LWS]);
|
|
17831
|
+
} : alwaysFalse$LWS;
|
|
16158
17832
|
BoundaryProxyHandler$LWS.passthruGetTrap = IS_NOT_IN_SHADOW_REALM$LWS ? function (_shadowTarget$LWS, key$LWS, receiver$LWS) {
|
|
16159
17833
|
// Only allow accessing handshake property values if the
|
|
16160
17834
|
// "has" trap has been triggered immediately BEFORE and
|
|
@@ -16455,7 +18129,17 @@
|
|
|
16455
18129
|
const pointerOrPrimitive$LWS = args$LWS[i$LWS];
|
|
16456
18130
|
if (typeof pointerOrPrimitive$LWS === 'function') {
|
|
16457
18131
|
pointerOrPrimitive$LWS();
|
|
16458
|
-
args
|
|
18132
|
+
// Use `[[DefineOwnProperty]]` rather than `[[Set]]` (`args[i] = ...`).
|
|
18133
|
+
// `args` is a rest-parameter array that still inherits from
|
|
18134
|
+
// `Array.prototype`, so a plain assignment to a numeric index would
|
|
18135
|
+
// invoke an inherited accessor installed by sandboxed code (e.g.
|
|
18136
|
+
// `Object.defineProperty(Array.prototype, '2', { set })`). Such a
|
|
18137
|
+
// setter could observe and overwrite the un-marshalled arguments
|
|
18138
|
+
// before they reach the target function. See W-23789302.
|
|
18139
|
+
ReflectDefineProperty$LWS(args$LWS, i$LWS, {
|
|
18140
|
+
__proto__: null,
|
|
18141
|
+
value: selectedTarget$LWS
|
|
18142
|
+
});
|
|
16459
18143
|
selectedTarget$LWS = undefined;
|
|
16460
18144
|
}
|
|
16461
18145
|
}
|
|
@@ -18212,6 +19896,163 @@
|
|
|
18212
19896
|
return loadPromise$LWS(link$LWS, urlResolved$LWS);
|
|
18213
19897
|
}];
|
|
18214
19898
|
}
|
|
19899
|
+
|
|
19900
|
+
// Red-realm bootstrap overrides.
|
|
19901
|
+
//
|
|
19902
|
+
// Each export in this module is a self-contained source-text string that is
|
|
19903
|
+
// evaluated in the sandbox (red) realm via `virtualEnvironment.evaluate(...)`
|
|
19904
|
+
// from `record.ts`, immediately after `EVAL_HELPERS_SOURCE_TEXT` and before any
|
|
19905
|
+
// user code runs. Evaluating in the red realm is what lets these overrides
|
|
19906
|
+
// reassign the sandbox's OWN intrinsics (e.g. `Reflect.construct`) — bindings a
|
|
19907
|
+
// blue-side distortion can never see, because the sandbox's own intrinsics never
|
|
19908
|
+
// cross the membrane.
|
|
19909
|
+
//
|
|
19910
|
+
// Conventions for anything added here:
|
|
19911
|
+
// - Use only direct `===` comparisons and bootstrap-captured native references.
|
|
19912
|
+
// Never call a method (`.includes`, `.indexOf`, ...) that sandboxed code could
|
|
19913
|
+
// monkeypatch after the override installs.
|
|
19914
|
+
// - Throw a plain `TypeError`. `LockerSecurityError` is a blue-realm class and is
|
|
19915
|
+
// not lexically available in this red-realm source text; the containment is
|
|
19916
|
+
// that the offending operation never completes, not the error type or its
|
|
19917
|
+
// catchability.
|
|
19918
|
+
// - Keep each override independently gated at its `virtualEnvironment.evaluate`
|
|
19919
|
+
// call site in `record.ts`.
|
|
19920
|
+
// W-23552771: contain the window-prototype construct pivot.
|
|
19921
|
+
//
|
|
19922
|
+
// Inside the sandbox, `window.$A` (Aura) is `undefined` — the red (iframe) window
|
|
19923
|
+
// does not carry `$A`, so there is no direct route to it. The reported PoC reaches
|
|
19924
|
+
// it anyway:
|
|
19925
|
+
//
|
|
19926
|
+
// function C() {}
|
|
19927
|
+
// C.prototype = window;
|
|
19928
|
+
// Reflect.construct(Event, [0], C).$A.util.copy(document).cookie;
|
|
19929
|
+
//
|
|
19930
|
+
// Feeding a `newTarget` whose `.prototype` is the sandbox window into a DOM
|
|
19931
|
+
// constructor's [[Construct]] yields an object whose property lookups resolve
|
|
19932
|
+
// against the BLUE window — where `$A` actually lives. The construct pivot is
|
|
19933
|
+
// therefore a blue-window-reach primitive, not obfuscation: `$A.util.copy(...)`
|
|
19934
|
+
// is merely what the attacker does once the blue window is in hand. Because the
|
|
19935
|
+
// direct read (`window.$A`) is already dead, this pivot is the sole doorway, and
|
|
19936
|
+
// rejecting a `newTarget.prototype` that is the sandbox window (or globalThis)
|
|
19937
|
+
// closes it.
|
|
19938
|
+
//
|
|
19939
|
+
// The sandbox's own `Reflect.construct` is red-native and never crosses the
|
|
19940
|
+
// membrane, so a distortion cannot intercept it; overriding the red global at
|
|
19941
|
+
// bootstrap is the only place this can be done. near-membrane captured
|
|
19942
|
+
// `Reflect.construct` into a const at connector-init, so the membrane's internal
|
|
19943
|
+
// construct-forwarding is unaffected — only sandboxed code that resolves
|
|
19944
|
+
// `Reflect.construct` from the red global sees this guard.
|
|
19945
|
+
const OVERRIDE_REFLECT_CONSTRUCT$LWS = `'use strict';
|
|
19946
|
+
(function () {
|
|
19947
|
+
const nativeConstruct = Reflect.construct;
|
|
19948
|
+
const nativeGetPrototypeOf = Object.getPrototypeOf;
|
|
19949
|
+
const nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
19950
|
+
const nativeReflectGet = Reflect.get;
|
|
19951
|
+
const ProxyCtor = Proxy;
|
|
19952
|
+
const sandboxGlobalThis = globalThis;
|
|
19953
|
+
const sandboxWindow = typeof window === 'undefined' ? sandboxGlobalThis : window;
|
|
19954
|
+
// Bound the prototype-chain walk so a newTarget.prototype that is (or is a
|
|
19955
|
+
// Proxy exposing) a pathological [[GetPrototypeOf]] cannot spin the guard.
|
|
19956
|
+
const MAX_PROTO_CHAIN_DEPTH = 100;
|
|
19957
|
+
Reflect.construct = function construct(target, argumentsList, newTarget) {
|
|
19958
|
+
if (arguments.length > 2) {
|
|
19959
|
+
if (typeof newTarget === 'function') {
|
|
19960
|
+
// Read newTarget.prototype EXACTLY ONCE into a snapshot. Native
|
|
19961
|
+
// [[Construct]] below reads it a SECOND time to seat the new
|
|
19962
|
+
// object's [[Prototype]] -- and a callable Proxy newTarget (or an
|
|
19963
|
+
// accessor .prototype) can answer this validation read with a
|
|
19964
|
+
// benign object and that construction read with the sandbox window
|
|
19965
|
+
// (a TOCTOU), passing the guard while still seating the window. A
|
|
19966
|
+
// post-construction check is no defense either: a base
|
|
19967
|
+
// constructor's this-value is created from newTarget.prototype
|
|
19968
|
+
// BEFORE the constructor body runs, so attacker-controlled target
|
|
19969
|
+
// code can capture the poisoned this-value the instant it is
|
|
19970
|
+
// seated. The snapshot is validated below, then construction either
|
|
19971
|
+
// passes the ORIGINAL newTarget through (only when the engine
|
|
19972
|
+
// itself guarantees native's second read cannot diverge) or pins
|
|
19973
|
+
// this snapshot through a wrapper for every other newTarget.
|
|
19974
|
+
const prototype = newTarget.prototype;
|
|
19975
|
+
// Reject if the sandbox window (or globalThis) is the snapshot OR
|
|
19976
|
+
// appears anywhere on its prototype chain. An object that merely
|
|
19977
|
+
// inherits from the window (e.g. Object.create(window)) is a
|
|
19978
|
+
// distinct identity but preserves the same blue-window reach
|
|
19979
|
+
// through the new object's [[Prototype]], so an identity-only
|
|
19980
|
+
// check would let the pivot through. Reachability, not identity,
|
|
19981
|
+
// is the invariant.
|
|
19982
|
+
let cursor = prototype;
|
|
19983
|
+
let depth = 0;
|
|
19984
|
+
while (
|
|
19985
|
+
cursor !== null &&
|
|
19986
|
+
(typeof cursor === 'object' || typeof cursor === 'function') &&
|
|
19987
|
+
depth < MAX_PROTO_CHAIN_DEPTH
|
|
19988
|
+
) {
|
|
19989
|
+
if (cursor === sandboxGlobalThis || cursor === sandboxWindow) {
|
|
19990
|
+
throw new TypeError(
|
|
19991
|
+
'Reflect.construct: newTarget.prototype must not reach the sandbox window.'
|
|
19992
|
+
);
|
|
19993
|
+
}
|
|
19994
|
+
cursor = nativeGetPrototypeOf(cursor);
|
|
19995
|
+
depth += 1;
|
|
19996
|
+
}
|
|
19997
|
+
// Decide whether native's SECOND read is forced -- by the engine's
|
|
19998
|
+
// own Proxy [[Get]] invariant -- to equal this validated snapshot.
|
|
19999
|
+
// That holds exactly when newTarget.prototype is an own DATA
|
|
20000
|
+
// property that is non-configurable AND non-writable. For such a
|
|
20001
|
+
// property a Proxy get trap may not return anything other than the
|
|
20002
|
+
// real value (it throws instead), and a getOwnPropertyDescriptor
|
|
20003
|
+
// trap may not even claim those attributes unless the underlying
|
|
20004
|
+
// target genuinely has them. So a real class or a native
|
|
20005
|
+
// constructor -- and essentially only those -- can present this
|
|
20006
|
+
// shape, and native's re-read provably cannot diverge. Hand native
|
|
20007
|
+
// the ORIGINAL newTarget untouched: new.target inside the
|
|
20008
|
+
// constructor stays the caller-supplied constructor and native's
|
|
20009
|
+
// own error text is unchanged (this is why HTMLElement still
|
|
20010
|
+
// reports the bare Illegal constructor).
|
|
20011
|
+
const prototypeDescriptor = nativeGetOwnPropertyDescriptor(
|
|
20012
|
+
newTarget,
|
|
20013
|
+
'prototype'
|
|
20014
|
+
);
|
|
20015
|
+
if (
|
|
20016
|
+
prototypeDescriptor !== undefined &&
|
|
20017
|
+
'value' in prototypeDescriptor &&
|
|
20018
|
+
prototypeDescriptor.value === prototype &&
|
|
20019
|
+
prototypeDescriptor.writable === false &&
|
|
20020
|
+
prototypeDescriptor.configurable === false
|
|
20021
|
+
) {
|
|
20022
|
+
return nativeConstruct(target, argumentsList, newTarget);
|
|
20023
|
+
}
|
|
20024
|
+
// Otherwise native's second read is NOT forced to match: a writable
|
|
20025
|
+
// data .prototype, an accessor .prototype, a Proxy get trap, or no
|
|
20026
|
+
// own .prototype at all (a bound constructor) each let native read
|
|
20027
|
+
// a value that diverges from the validated snapshot. A dual-trap
|
|
20028
|
+
// Proxy exploits precisely this: a forwarded descriptor shows a
|
|
20029
|
+
// benign writable data property while the get trap answers native
|
|
20030
|
+
// with the window. Pin the snapshot by constructing through a
|
|
20031
|
+
// wrapper whose only intercept is the prototype read; every other
|
|
20032
|
+
// operation forwards untouched, so [[Construct]] presence, argument
|
|
20033
|
+
// handling, and the realm-default-prototype fallback for a missing
|
|
20034
|
+
// or non-object .prototype (the benign bound-constructor path) are
|
|
20035
|
+
// all preserved. new.target is the wrapper for these dynamic cases,
|
|
20036
|
+
// which is the necessary cost of containing an attacker-controlled
|
|
20037
|
+
// re-read; the common class and native-constructor cases keep their
|
|
20038
|
+
// identity through the pass-through branch above.
|
|
20039
|
+
const pinnedNewTarget = new ProxyCtor(newTarget, {
|
|
20040
|
+
get(pinnedTarget, key, receiver) {
|
|
20041
|
+
if (key === 'prototype') {
|
|
20042
|
+
return prototype;
|
|
20043
|
+
}
|
|
20044
|
+
return nativeReflectGet(pinnedTarget, key, receiver);
|
|
20045
|
+
}
|
|
20046
|
+
});
|
|
20047
|
+
return nativeConstruct(target, argumentsList, pinnedNewTarget);
|
|
20048
|
+
}
|
|
20049
|
+
// newTarget supplied but not callable: defer to native, which throws
|
|
20050
|
+
// because newTarget must be a constructor. Preserves spec semantics.
|
|
20051
|
+
return nativeConstruct(target, argumentsList, newTarget);
|
|
20052
|
+
}
|
|
20053
|
+
return nativeConstruct(target, argumentsList);
|
|
20054
|
+
};
|
|
20055
|
+
}());`;
|
|
18215
20056
|
function toSourceText$LWS(value$LWS, sourceType$LWS) {
|
|
18216
20057
|
let sourceText$LWS = typeof value$LWS === 'function' ? extractFunctionBodySource$LWS(value$LWS) : toSafeStringValue$LWS(value$LWS);
|
|
18217
20058
|
// We workaround bundlers, like Rollup, aggressively stripping inline source
|
|
@@ -18222,7 +20063,7 @@
|
|
|
18222
20063
|
// tools from mistaking the regexp or the replacement string for an
|
|
18223
20064
|
// actual source mapping URL.
|
|
18224
20065
|
/\/\/# sandbox(?=MappingURL=.*?\s*$)/, '//# source']);
|
|
18225
|
-
sourceText$LWS = `\n//# LWS Version = "0.
|
|
20066
|
+
sourceText$LWS = `\n//# LWS Version = "0.29.0"\n${sourceText$LWS}`;
|
|
18226
20067
|
return sourceType$LWS === 1 /* SourceType.Module */ && indexOfPragma$LWS(sourceText$LWS, 'use strict') === -1 ?
|
|
18227
20068
|
// Append "'use strict'" to the extracted function body so it is
|
|
18228
20069
|
// evaluated in strict mode.
|
|
@@ -18269,6 +20110,13 @@
|
|
|
18269
20110
|
setEvalHelpers$LWS(helpers$LWS);
|
|
18270
20111
|
});
|
|
18271
20112
|
virtualEnvironment$LWS.evaluate(EVAL_HELPERS_SOURCE_TEXT$LWS);
|
|
20113
|
+
// W-23552771: install red-realm bootstrap overrides now that the
|
|
20114
|
+
// eval helpers are in place and before any user code runs. Each
|
|
20115
|
+
// override is independently gated here in the blue realm, where the
|
|
20116
|
+
// gater is available (the red-realm source text cannot see it).
|
|
20117
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
20118
|
+
virtualEnvironment$LWS.evaluate(OVERRIDE_REFLECT_CONSTRUCT$LWS);
|
|
20119
|
+
}
|
|
18272
20120
|
if (typeof context$LWS === 'object' && context$LWS !== null) {
|
|
18273
20121
|
// Track the `context` object and its properties as a fast
|
|
18274
20122
|
// targets because it may contain things like `blueGet` and
|
|
@@ -18902,7 +20750,19 @@
|
|
|
18902
20750
|
}
|
|
18903
20751
|
toSafeMap$LWS$1(new MapCtor$LWS$1());
|
|
18904
20752
|
toSafeSet$LWS(new SetCtor$LWS$1(['lightning/platformResourceLoader', 'lightning:platformResourceLoader', 'lightningmobileruntime/platformResourceLoader', 'lightningmobileruntime:platformResourceLoader']));
|
|
18905
|
-
|
|
20753
|
+
// The case-folded forms of every entry in `lprDepNames` above (kept 1:1 with
|
|
20754
|
+
// that set). The dynamic module resolver can hand LWS a dependency name whose
|
|
20755
|
+
// casing differs from the exact strings above (e.g.
|
|
20756
|
+
// 'lightning/PlatformResourceLoader'). A case-variant name misses the exact
|
|
20757
|
+
// `lprDepNames.has` check and would otherwise fall through to `return dep` —
|
|
20758
|
+
// handing out the raw platformResourceLoader, whose `loadScript` appends a
|
|
20759
|
+
// <script> to the host document with no sandboxing (a native host-realm
|
|
20760
|
+
// script-injection primitive). Matching a lower-cased, whitespace-trimmed copy
|
|
20761
|
+
// of the incoming name against these canonical keys collapses every case and
|
|
20762
|
+
// surrounding-whitespace variant of the two known separators back onto the
|
|
20763
|
+
// sandbox-scoped facade.
|
|
20764
|
+
toSafeSet$LWS(new SetCtor$LWS$1(['lightning/platformresourceloader', 'lightning:platformresourceloader', 'lightningmobileruntime/platformresourceloader', 'lightningmobileruntime:platformresourceloader']));
|
|
20765
|
+
/*! version: 0.29.0 */
|
|
18906
20766
|
|
|
18907
20767
|
// Expose evaluateInSandbox on the window global so the browser harness page
|
|
18908
20768
|
// (eval.html / component.html) can invoke it against source delivered by the
|