@locker/cli 0.29.0 → 0.29.2
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/lwc-engine.js +371 -283
- package/dist/lws-sandbox.js +1809 -302
- package/package.json +8 -8
- package/src/compile-lwc.mjs +4 -1
package/dist/lws-sandbox.js
CHANGED
|
@@ -59,6 +59,14 @@
|
|
|
59
59
|
function ObjectLookupOwnGetter$LWS$1(object$LWS, key$LWS) {
|
|
60
60
|
return object$LWS === null || object$LWS === undefined || !ObjectHasOwn$LWS$1(object$LWS, key$LWS) ? undefined : ReflectApply$LWS$1(ObjectProtoLookupGetter$LWS$1, object$LWS, [key$LWS]);
|
|
61
61
|
}
|
|
62
|
+
// Like ObjectLookupOwnGetter but without the own-property guard, so it resolves
|
|
63
|
+
// a getter defined anywhere on the prototype chain (__lookupGetter__ walks up).
|
|
64
|
+
// Use this when an accessor may live on a base interface's prototype rather than
|
|
65
|
+
// on `object` itself, e.g. an accessor the platform relocates between interface
|
|
66
|
+
// prototypes across browser versions.
|
|
67
|
+
function ObjectLookupGetter$LWS(object$LWS, key$LWS) {
|
|
68
|
+
return object$LWS === null || object$LWS === undefined ? undefined : ReflectApply$LWS$1(ObjectProtoLookupGetter$LWS$1, object$LWS, [key$LWS]);
|
|
69
|
+
}
|
|
62
70
|
function ObjectLookupOwnSetter$LWS(object$LWS, key$LWS) {
|
|
63
71
|
return object$LWS === null || object$LWS === undefined || !ObjectHasOwn$LWS$1(object$LWS, key$LWS) ? undefined : ReflectApply$LWS$1(ObjectProtoLookupSetter$LWS$1, object$LWS, [key$LWS]);
|
|
64
72
|
}
|
|
@@ -1018,6 +1026,10 @@
|
|
|
1018
1026
|
const {
|
|
1019
1027
|
parse: JSONParse$LWS
|
|
1020
1028
|
} = JSON;
|
|
1029
|
+
// Used by '@locker/near-membrane-dom'.
|
|
1030
|
+
const {
|
|
1031
|
+
stringify: JSONStringify$LWS$1
|
|
1032
|
+
} = JSON;
|
|
1021
1033
|
function getNearMembraneProxySerializedValue$LWS$1(object$LWS) {
|
|
1022
1034
|
if (typeof object$LWS === 'object' && object$LWS !== null || typeof object$LWS === 'function') {
|
|
1023
1035
|
// To extract the serialized value of a blue near-membrane proxy we must
|
|
@@ -1370,7 +1382,7 @@
|
|
|
1370
1382
|
// reads identically to what isGaterEnabledFeature stores (register and
|
|
1371
1383
|
// deregister also accept the short form via fullName above). Frozen so a
|
|
1372
1384
|
// consumer cannot mutate the shared array.
|
|
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`]);
|
|
1385
|
+
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}iframeSrcSameOriginPreflightCheck`, `${FEATURE_NAME_PREFIX$LWS}xmlEntityAttackPrologScan`, `${FEATURE_NAME_PREFIX$LWS}blockWindowOpenSameOriginSameContext`, `${FEATURE_NAME_PREFIX$LWS}walkRangeProtoChainForMethods`]);
|
|
1374
1386
|
function registerGaterEnabledFeatures$LWS(lockerGaterEnabledFeatures$LWS) {
|
|
1375
1387
|
if (ArrayIsArray$LWS$1(lockerGaterEnabledFeatures$LWS)) {
|
|
1376
1388
|
lockerGaterEnabledFeatures$LWS.forEach(feature$LWS => gaterEnabledFeatures$LWS.add(fullName$LWS(feature$LWS)));
|
|
@@ -1379,6 +1391,7 @@
|
|
|
1379
1391
|
function isGaterEnabledFeature$LWS(featureName$LWS) {
|
|
1380
1392
|
return gaterEnabledFeatures$LWS.has(fullName$LWS(featureName$LWS));
|
|
1381
1393
|
}
|
|
1394
|
+
const COUNT_DISPATCH_EVENT_DETAIL_REFERENCES_GATE$LWS = 'countDispatchEventDetailReferences';
|
|
1382
1395
|
const ENABLE_MAX_PERF_MODE_GATE$LWS = 'enableMaxPerfMode';
|
|
1383
1396
|
const ENABLE_SANDBOX_CREATED_INSTRUMENTATION_GATE$LWS = 'enableSandboxCreatedInstrumentation';
|
|
1384
1397
|
const ENABLE_SANDBOXED_SAMEORIGIN_IFRAME_GATE$LWS = 'enableSandboxedSameOriginIframe';
|
|
@@ -1555,7 +1568,7 @@
|
|
|
1555
1568
|
const PromiseResolve$LWS = PromiseCtor$LWS.resolve.bind(PromiseCtor$LWS);
|
|
1556
1569
|
const PromiseReject$LWS = PromiseCtor$LWS.reject.bind(PromiseCtor$LWS);
|
|
1557
1570
|
toSafeSet$LWS(new SetCtor$LWS$1());
|
|
1558
|
-
/*! version: 0.29.
|
|
1571
|
+
/*! version: 0.29.2 */
|
|
1559
1572
|
|
|
1560
1573
|
/*!
|
|
1561
1574
|
* Copyright (C) 2019 salesforce.com, inc.
|
|
@@ -2125,9 +2138,19 @@
|
|
|
2125
2138
|
}
|
|
2126
2139
|
const NodeProtoOwnerDocumentGetter$LWS = ObjectLookupOwnGetter$LWS$1(NodeProto$LWS$1, 'ownerDocument');
|
|
2127
2140
|
ObjectLookupOwnGetter$LWS$1(NodeProto$LWS$1, 'parentNode');
|
|
2128
|
-
|
|
2141
|
+
const {
|
|
2142
|
+
get: NodeProtoTextContentGetter$LWS,
|
|
2143
|
+
set: NodeProtoTextContentSetter$LWS
|
|
2144
|
+
} = ReflectGetOwnPropertyDescriptor$LWS(NodeProto$LWS$1, 'textContent');
|
|
2129
2145
|
const rootDocumentDetachedFragment$LWS = ReflectApply$LWS$1(DocumentProtoCreateDocumentFragment$LWS, rootDocument$LWS, []);
|
|
2130
2146
|
const rootDocumentDetachedContainer$LWS = ReflectApply$LWS$1(DocumentProtoCreateElement$LWS$1, rootDocument$LWS, ['div']);
|
|
2147
|
+
// Inert parse surface for the hidden-<script> heuristic (changesSince.266,
|
|
2148
|
+
// W-23595929). Template contents are parsed into an inert template-owner
|
|
2149
|
+
// document: custom elements are never upgraded, scripts never execute, and
|
|
2150
|
+
// resource-loading attributes never fire — so setting innerHTML here decodes
|
|
2151
|
+
// entities/obfuscation exactly like a live parse but has no observable side
|
|
2152
|
+
// effects in the shared realm.
|
|
2153
|
+
const rootDocumentDetachedTemplate$LWS = ReflectApply$LWS$1(DocumentProtoCreateElement$LWS$1, rootDocument$LWS, ['template']);
|
|
2131
2154
|
// Regex to match null bytes and zero-width characters that browsers may strip or ignore
|
|
2132
2155
|
// \x00 - Null byte
|
|
2133
2156
|
// \u00AD - Soft Hyphen
|
|
@@ -2171,11 +2194,49 @@
|
|
|
2171
2194
|
// bounded the token but left the regex free to roam the whole 30 KB–2 MB slice.)
|
|
2172
2195
|
const PROLOG_DOCTYPE_INTERNAL_SUBSET_REGEX$LWS = /^<!doctype\s+[^>\s]+\s*\[/;
|
|
2173
2196
|
const PROLOG_DOCTYPE_EXTERNAL_ENTITY_REGEX$LWS = /^<!doctype\s+[^>\s]+\s+(?:system|public)\s/;
|
|
2197
|
+
// Two regexes together detect a namespaced <script> that an HTML parser leaves
|
|
2198
|
+
// inert but an XML parser makes executable once its namespace resolves.
|
|
2199
|
+
//
|
|
2200
|
+
// (1) NAMESPACED_SCRIPT_XMLNS_REGEX — the xmlns declaration sits INSIDE the
|
|
2201
|
+
// script start tag. Matches <script or <prefix:script (the leading [<:]), then a
|
|
2202
|
+
// whitespace or `/` separator so decoy tags like <scripting> or <scriptx> are
|
|
2203
|
+
// not matched, then scans the start tag up to xmlns. The gap alternation treats
|
|
2204
|
+
// quoted attribute values as opaque ("[^"]*" and '[^']*') so a `>` inside an
|
|
2205
|
+
// attribute value (e.g. title=">") cannot prematurely end the start tag and let
|
|
2206
|
+
// the real xmlns escape the scan. This is the self-declared shape:
|
|
2207
|
+
// <script xmlns="..."> or <prefix:script ... xmlns:prefix="...">.
|
|
2208
|
+
//
|
|
2209
|
+
// (2) PREFIXED_SCRIPT_TAG_REGEX — a namespace-PREFIXED <prefix:script> tag,
|
|
2210
|
+
// whatever its attributes. XML namespaces are inherited down the tree, so the
|
|
2211
|
+
// xmlns:prefix binding can sit on an ANCESTOR — the idiomatic
|
|
2212
|
+
// <svg xmlns:a="..."><a:script/></svg> shape — rather than on the script tag
|
|
2213
|
+
// itself, where regex (1) would never see it (the declaration precedes the
|
|
2214
|
+
// script in document order). isXMLNamespacedScriptAttack pairs a match here with
|
|
2215
|
+
// a body-wide "xmlns" lookup: a prefixed script whose prefix is bound anywhere
|
|
2216
|
+
// in scope can execute. The prefixed form does not occur in benign HTML (an HTML
|
|
2217
|
+
// parser treats <a:script> as an unknown, inert element), so this reintroduces
|
|
2218
|
+
// the ancestor-inheritance vector without reviving the "plain <script> + an
|
|
2219
|
+
// unrelated 'xmlns' string" false positives that motivated narrowing regex (1) —
|
|
2220
|
+
// those bodies carry no prefixed script tag. The [^\s/>]+ prefix requires at
|
|
2221
|
+
// least one non-whitespace, non-`/`, non-`>` character before `:script`, which
|
|
2222
|
+
// is what keeps a plain <script> (no prefix) from matching.
|
|
2223
|
+
const NAMESPACED_SCRIPT_XMLNS_REGEX$LWS = /[<:]script[\s/](?:[^>"']|"[^"]*"|'[^']*')*xmlns/;
|
|
2224
|
+
const PREFIXED_SCRIPT_TAG_REGEX$LWS = /<[^\s/>]+:script[\s/>]/;
|
|
2174
2225
|
const DOCTYPE_OPENER$LWS = '<!doctype';
|
|
2175
2226
|
const PI_OPENER$LWS = '<?';
|
|
2176
2227
|
const PI_CLOSER$LWS = '?>';
|
|
2177
2228
|
const COMMENT_OPENER$LWS = '<!--';
|
|
2178
2229
|
const COMMENT_CLOSER$LWS = '-->';
|
|
2230
|
+
const CDATA_OPENER$LWS = '<![cdata[';
|
|
2231
|
+
const CDATA_CLOSER$LWS = ']]>';
|
|
2232
|
+
// A processing instruction whose target is exactly `xml-stylesheet`. Written as
|
|
2233
|
+
// the PI opener plus the target so the whole-input walk below can match it in one
|
|
2234
|
+
// StartsWith and then confirm the target boundary.
|
|
2235
|
+
const XML_STYLESHEET_PI_TARGET$LWS = `${PI_OPENER$LWS}xml-stylesheet`;
|
|
2236
|
+
// The `type` pseudo-attribute values Chromium's XSLT engine recognizes on an
|
|
2237
|
+
// `xml-stylesheet` PI. A stylesheet PI declaring any other type (e.g. text/css)
|
|
2238
|
+
// is a styling directive, not a script-execution vector, so it is left alone.
|
|
2239
|
+
const XSL_TYPE_TOKENS$LWS = ['text/xsl', 'application/xslt+xml'];
|
|
2179
2240
|
// Locate a DOCTYPE that sits in the document prolog — the only position where a
|
|
2180
2241
|
// DTD is actually parsed and where entity definitions can take effect. A DTD is
|
|
2181
2242
|
// only meaningful before the root element's start tag; anything after the root
|
|
@@ -2234,6 +2295,77 @@
|
|
|
2234
2295
|
}
|
|
2235
2296
|
return null;
|
|
2236
2297
|
}
|
|
2298
|
+
// Locate an `xml-stylesheet` processing instruction that declares an XSLT
|
|
2299
|
+
// stylesheet (W-23657156). Unlike a DTD, such a PI is dangerous wherever the XML
|
|
2300
|
+
// parser materializes it as a node — the prolog, element content, or the epilog
|
|
2301
|
+
// — because the attacker does not use it in place: they read the parsed PI node
|
|
2302
|
+
// out of the (context-less, inert) DOMParser document and append it to the LIVE
|
|
2303
|
+
// document, where Chromium's native XSLT engine fetches the stylesheet and
|
|
2304
|
+
// commits a transform whose output script runs in the host realm. So this scans
|
|
2305
|
+
// the WHOLE input, not just the prolog, skipping only comment (`<!-- -->`) and
|
|
2306
|
+
// CDATA (`<![CDATA[ ]]>`) spans — the two regions where `<?xml-stylesheet` is
|
|
2307
|
+
// inert character data the parser never turns into a PI node.
|
|
2308
|
+
//
|
|
2309
|
+
// Only a PI whose target is exactly `xml-stylesheet` and whose data carries an
|
|
2310
|
+
// XSL `type` token matches Chromium's XSLT trigger. PI data is NOT
|
|
2311
|
+
// entity-decoded by the XML parser, so a literal substring test on the PI's own
|
|
2312
|
+
// `<? ... ?>` span is faithful — an obfuscated `text/xsl` is read verbatim
|
|
2313
|
+
// and never fires. A text/css stylesheet PI has no XSL type token and is left
|
|
2314
|
+
// alone.
|
|
2315
|
+
function hasXSLStylesheetProcessingInstruction$LWS(normalizedInput$LWS) {
|
|
2316
|
+
const {
|
|
2317
|
+
length: length$LWS
|
|
2318
|
+
} = normalizedInput$LWS;
|
|
2319
|
+
let index$LWS = 0;
|
|
2320
|
+
while (index$LWS < length$LWS) {
|
|
2321
|
+
// Skip comment spans: <!-- ... --> is inert text, never a PI node.
|
|
2322
|
+
if (ReflectApply$LWS$1(StringProtoStartsWith$LWS, normalizedInput$LWS, [COMMENT_OPENER$LWS, index$LWS])) {
|
|
2323
|
+
const closerOffset$LWS = ReflectApply$LWS$1(StringProtoIndexOf$LWS, normalizedInput$LWS, [COMMENT_CLOSER$LWS, index$LWS + COMMENT_OPENER$LWS.length]);
|
|
2324
|
+
// Unterminated comment: everything after it is inert; no live PI follows.
|
|
2325
|
+
if (closerOffset$LWS === -1) {
|
|
2326
|
+
return false;
|
|
2327
|
+
}
|
|
2328
|
+
index$LWS = closerOffset$LWS + COMMENT_CLOSER$LWS.length;
|
|
2329
|
+
continue;
|
|
2330
|
+
}
|
|
2331
|
+
// Skip CDATA spans: <![CDATA[ ... ]]> is inert text, never a PI node.
|
|
2332
|
+
if (ReflectApply$LWS$1(StringProtoStartsWith$LWS, normalizedInput$LWS, [CDATA_OPENER$LWS, index$LWS])) {
|
|
2333
|
+
const closerOffset$LWS = ReflectApply$LWS$1(StringProtoIndexOf$LWS, normalizedInput$LWS, [CDATA_CLOSER$LWS, index$LWS + CDATA_OPENER$LWS.length]);
|
|
2334
|
+
if (closerOffset$LWS === -1) {
|
|
2335
|
+
return false;
|
|
2336
|
+
}
|
|
2337
|
+
index$LWS = closerOffset$LWS + CDATA_CLOSER$LWS.length;
|
|
2338
|
+
continue;
|
|
2339
|
+
}
|
|
2340
|
+
// A processing instruction: <? ... ?>. Classify it, then advance past it.
|
|
2341
|
+
if (ReflectApply$LWS$1(StringProtoStartsWith$LWS, normalizedInput$LWS, [PI_OPENER$LWS, index$LWS])) {
|
|
2342
|
+
const closerOffset$LWS = ReflectApply$LWS$1(StringProtoIndexOf$LWS, normalizedInput$LWS, [PI_CLOSER$LWS, index$LWS + PI_OPENER$LWS.length]);
|
|
2343
|
+
// Unterminated PI: the parser produces no node from it.
|
|
2344
|
+
if (closerOffset$LWS === -1) {
|
|
2345
|
+
return false;
|
|
2346
|
+
}
|
|
2347
|
+
if (ReflectApply$LWS$1(StringProtoStartsWith$LWS, normalizedInput$LWS, [XML_STYLESHEET_PI_TARGET$LWS, index$LWS])) {
|
|
2348
|
+
// Confirm the target ends exactly at `xml-stylesheet`; the next
|
|
2349
|
+
// character must be PI whitespace or the closing `?`, so a longer
|
|
2350
|
+
// target such as `xml-stylesheetfoo` (which Chromium would not fire)
|
|
2351
|
+
// is not misread as the stylesheet PI.
|
|
2352
|
+
const boundaryChar$LWS = ReflectApply$LWS$1(StringProtoCharAt$LWS, normalizedInput$LWS, [index$LWS + XML_STYLESHEET_PI_TARGET$LWS.length]);
|
|
2353
|
+
if (boundaryChar$LWS === ' ' || boundaryChar$LWS === '\t' || boundaryChar$LWS === '\n' || boundaryChar$LWS === '\r' || boundaryChar$LWS === '?') {
|
|
2354
|
+
const piData$LWS = ReflectApply$LWS$1(StringProtoSlice$LWS$1, normalizedInput$LWS, [index$LWS, closerOffset$LWS]);
|
|
2355
|
+
for (let i$LWS = 0; i$LWS < XSL_TYPE_TOKENS$LWS.length; i$LWS += 1) {
|
|
2356
|
+
if (ReflectApply$LWS$1(StringProtoIncludes$LWS, piData$LWS, [XSL_TYPE_TOKENS$LWS[i$LWS]])) {
|
|
2357
|
+
return true;
|
|
2358
|
+
}
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
index$LWS = closerOffset$LWS + PI_CLOSER$LWS.length;
|
|
2363
|
+
continue;
|
|
2364
|
+
}
|
|
2365
|
+
index$LWS += 1;
|
|
2366
|
+
}
|
|
2367
|
+
return false;
|
|
2368
|
+
}
|
|
2237
2369
|
/* eslint-disable no-underscore-dangle */
|
|
2238
2370
|
class Validator$LWS {
|
|
2239
2371
|
constructor(document$LWS, {
|
|
@@ -2280,11 +2412,50 @@
|
|
|
2280
2412
|
// when the namespace is XHTML or SVG. The namespace URL itself can be
|
|
2281
2413
|
// obfuscated with XML character entities in attribute values, but the
|
|
2282
2414
|
// xmlns attribute name cannot, so checking for "xmlns" is reliable.
|
|
2415
|
+
//
|
|
2416
|
+
// With the iframeSrcSameOriginPreflightCheck gate on, a plain <script> plus
|
|
2417
|
+
// the substring "xmlns" elsewhere in the body is no longer enough; the xmlns
|
|
2418
|
+
// must actually be able to namespace a script. Two shapes qualify:
|
|
2419
|
+
// (1) the xmlns declaration sits inside the script start tag itself
|
|
2420
|
+
// (<script xmlns="..."> / <prefix:script ... xmlns:prefix="...">), or
|
|
2421
|
+
// (2) a namespace-PREFIXED <prefix:script> whose xmlns:prefix binding sits
|
|
2422
|
+
// on an ancestor — XML inherits namespaces down the tree, so the
|
|
2423
|
+
// declaration need not be on the script tag (the idiomatic
|
|
2424
|
+
// <svg xmlns:a="..."><a:script/></svg> shape). This pairs the prefixed
|
|
2425
|
+
// form (never emitted by benign HTML) with a body-wide "xmlns" lookup.
|
|
2426
|
+
// The legacy form (gate off) only checked for a <script> tag and the
|
|
2427
|
+
// substring "xmlns" anywhere in the body; that false-positived on benign
|
|
2428
|
+
// HTML that carries a plain <script> and also mentions "xmlns" in an
|
|
2429
|
+
// unrelated place (a sanitizer's attribute allowlist, an SVG child element,
|
|
2430
|
+
// a string literal). Shape (1) alone would miss ancestor-declared namespace
|
|
2431
|
+
// inheritance (W-23924612 review, verified in Deno and Bun); shape (2)
|
|
2432
|
+
// restores it without reviving the plain-<script> false positives. This is
|
|
2433
|
+
// the 264-patch narrowing (W-23591510, #2218) forward-ported to 266 under
|
|
2434
|
+
// the same gate that gates the iframe.src pre-flight feature, so the two
|
|
2435
|
+
// trains agree on both the check and the gate that controls it.
|
|
2283
2436
|
// eslint-disable-next-line class-methods-use-this
|
|
2284
2437
|
this.isXMLNamespacedScriptAttack = input$LWS => {
|
|
2438
|
+
if (isGaterEnabledFeature$LWS('iframeSrcSameOriginPreflightCheck')) {
|
|
2439
|
+
const normalizedInput$LWS = ReflectApply$LWS$1(StringProtoReplace$LWS, normalizeInput$LWS(input$LWS), [/\s+/g, ' ']);
|
|
2440
|
+
// (1) Self-declared: xmlns inside the script start tag.
|
|
2441
|
+
if (ReflectApply$LWS$1(RegExpProtoTest$LWS$1, NAMESPACED_SCRIPT_XMLNS_REGEX$LWS, [normalizedInput$LWS])) {
|
|
2442
|
+
return true;
|
|
2443
|
+
}
|
|
2444
|
+
// (2) Inherited: a prefixed <prefix:script> plus an xmlns declaration
|
|
2445
|
+
// anywhere in the body, which can bind the prefix from an ancestor.
|
|
2446
|
+
return ReflectApply$LWS$1(RegExpProtoTest$LWS$1, PREFIXED_SCRIPT_TAG_REGEX$LWS, [normalizedInput$LWS]) && ReflectApply$LWS$1(StringProtoIncludes$LWS, normalizedInput$LWS, ['xmlns']);
|
|
2447
|
+
}
|
|
2285
2448
|
const normalizedInput$LWS = normalizeInput$LWS(input$LWS);
|
|
2286
2449
|
return hasTag$LWS(normalizedInput$LWS, 'script') && ReflectApply$LWS$1(StringProtoIncludes$LWS, normalizedInput$LWS, ['xmlns']);
|
|
2287
2450
|
};
|
|
2451
|
+
// Detect an `xml-stylesheet` processing instruction that declares an XSLT
|
|
2452
|
+
// stylesheet (W-23657156). See hasXSLStylesheetProcessingInstruction for the
|
|
2453
|
+
// full attack chain. Applied to the XML/XHTML/SVG parse paths of
|
|
2454
|
+
// DOMParser.parseFromString, which hand their input to the native parser
|
|
2455
|
+
// unsanitized and would otherwise mint a live, relocatable PI node that
|
|
2456
|
+
// sandboxed code can append to the live document to fire native XSLT.
|
|
2457
|
+
// eslint-disable-next-line class-methods-use-this
|
|
2458
|
+
this.isXMLStylesheetProcessingInstructionAttack = input$LWS => hasXSLStylesheetProcessingInstruction$LWS(normalizeInput$LWS(input$LWS));
|
|
2288
2459
|
// Detects the iframe+srcdoc substring combination in raw input.
|
|
2289
2460
|
// Any HTML or XML containing both <iframe> and the substring
|
|
2290
2461
|
// 'srcdoc' is considered hostile, regardless of where the
|
|
@@ -2329,23 +2500,55 @@
|
|
|
2329
2500
|
if (!hasScript$LWS) {
|
|
2330
2501
|
return false;
|
|
2331
2502
|
}
|
|
2503
|
+
// changesSince.266 (W-23595929): decide the hidden-<script> verdict by
|
|
2504
|
+
// parsing into an inert <template>, never a live <div> owned by the shared
|
|
2505
|
+
// root document. Setting innerHTML on a rootDocument-owned element runs the
|
|
2506
|
+
// HTML fragment parser in the shared realm, and that parse upgrades any
|
|
2507
|
+
// custom element it encounters — running the element's constructor
|
|
2508
|
+
// SYNCHRONOUSLY, before this inspection returns the verdict that would
|
|
2509
|
+
// reject the input. An attacker who replays a leaked `lskey` registry token
|
|
2510
|
+
// can route that upgrade to a sandbox-defined constructor and have it run in
|
|
2511
|
+
// the host realm as a side effect of this supposedly-inert text check (the
|
|
2512
|
+
// clone-a-live-<script> escape). Template contents are inert, so the parse
|
|
2513
|
+
// still decodes entities/obfuscation for an accurate innerHTML-vs-text
|
|
2514
|
+
// comparison but cannot upgrade custom elements, execute scripts, or fire
|
|
2515
|
+
// resource-loading attributes. Mirrors the ContentType.SVG template fix in
|
|
2516
|
+
// @locker/internal-policy.
|
|
2517
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
2518
|
+
ReflectApply$LWS$1(ElementProtoInnerHTMLSetter$LWS, rootDocumentDetachedTemplate$LWS, [normalizedInput$LWS]);
|
|
2519
|
+
// Element.prototype.innerHTML on a <template> reflects the serialized
|
|
2520
|
+
// template contents, but textContent must be read off the content
|
|
2521
|
+
// fragment: the parsed nodes live there, not as children of the
|
|
2522
|
+
// <template> element itself (template.textContent would be '').
|
|
2523
|
+
const innerHTML$LWS = ReflectApply$LWS$1(ElementProtoInnerHTMLGetter$LWS, rootDocumentDetachedTemplate$LWS, []);
|
|
2524
|
+
const content$LWS = ReflectApply$LWS$1(HTMLTemplateElementProtoContentGetter$LWS, rootDocumentDetachedTemplate$LWS, []);
|
|
2525
|
+
const textContent$LWS = toSafeStringValue$LWS(ReflectApply$LWS$1(NodeProtoTextContentGetter$LWS, content$LWS, []));
|
|
2526
|
+
// Release the parsed nodes so nothing lingers on the shared template
|
|
2527
|
+
// between calls.
|
|
2528
|
+
ReflectApply$LWS$1(ElementProtoInnerHTMLSetter$LWS, rootDocumentDetachedTemplate$LWS, ['']);
|
|
2529
|
+
// The legacy detached-<div> path reads innerText from an unrendered
|
|
2530
|
+
// element, which per spec is that element's textContent — the same value
|
|
2531
|
+
// read above. Strip < > : so a decoded entity such as <script> in
|
|
2532
|
+
// visible text cannot mask a genuinely hidden <script> (same rationale as
|
|
2533
|
+
// the changesSince.262 strip in the legacy path below).
|
|
2534
|
+
const checkableText$LWS = ReflectApply$LWS$1(StringProtoReplace$LWS, textContent$LWS, [/[<>:]/g, '']);
|
|
2535
|
+
return hasTag$LWS(innerHTML$LWS, 'script') && !hasTag$LWS(checkableText$LWS, 'script');
|
|
2536
|
+
}
|
|
2332
2537
|
// This is obnoxious... jsdom doesn't implement HTMLElement.prototype.innerText
|
|
2333
2538
|
if (!HTMLElementProtoInnerTextGetter$LWS) {
|
|
2334
2539
|
return true;
|
|
2335
2540
|
}
|
|
2336
|
-
//
|
|
2337
|
-
//
|
|
2338
|
-
//
|
|
2339
|
-
//
|
|
2340
|
-
//
|
|
2341
|
-
//
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
const innerText$LWS = ReflectApply$LWS$1(HTMLElementProtoInnerTextGetter$LWS, rootDocumentDetachedContainer$LWS, []);
|
|
2348
|
-
ReflectApply$LWS$1(ElementProtoRemove$LWS$1, rootDocumentDetachedContainer$LWS, []);
|
|
2541
|
+
// The input contains the word "script"; confirm it is actually markup by
|
|
2542
|
+
// rendering it on the shared detached container and comparing the parsed
|
|
2543
|
+
// innerHTML against the visible innerText. IMPORTANT: We CANNOT reuse
|
|
2544
|
+
// this._templates.left/right here — template elements return neither
|
|
2545
|
+
// innerText nor textContent, which would make the comparison useless. The
|
|
2546
|
+
// values MUST be read after rendering: the browser has to parse the source
|
|
2547
|
+
// for the hidden-script shape to surface.
|
|
2548
|
+
const {
|
|
2549
|
+
innerHTML: innerHTML$LWS,
|
|
2550
|
+
innerText: innerText$LWS
|
|
2551
|
+
} = htmlParserRoundTrip$LWS(normalizedInput$LWS);
|
|
2349
2552
|
// If innerHTML contains "script", but innerText does not, then the string
|
|
2350
2553
|
// was hiding a script element through some kind of obfuscation, and is unsecure.
|
|
2351
2554
|
let checkableInnerText$LWS = innerText$LWS;
|
|
@@ -2357,6 +2560,65 @@
|
|
|
2357
2560
|
}
|
|
2358
2561
|
return hasTag$LWS(innerHTML$LWS, 'script') && !hasTag$LWS(checkableInnerText$LWS, 'script');
|
|
2359
2562
|
};
|
|
2563
|
+
// Detect a <script> that the HTML parser hides inside a raw-text / RCDATA
|
|
2564
|
+
// element (textarea, title, style, xmp, ...) but the XML parser exposes as
|
|
2565
|
+
// a live element. XMLDocument-owned elements are parsed with the XML parser,
|
|
2566
|
+
// which has NO raw-text elements: <textarea><script>...</script></textarea>
|
|
2567
|
+
// is inert escaped text under HTML, but a live, clonable HTMLScriptElement
|
|
2568
|
+
// under XML. cloneNode + adoption into the HTML document then promotes it to
|
|
2569
|
+
// an executing script (W-23486666).
|
|
2570
|
+
//
|
|
2571
|
+
// isIframeSrcdocScriptAttack cannot see this: it renders through the HTML
|
|
2572
|
+
// parser, where the swallowed <script> becomes `<script>` text and no
|
|
2573
|
+
// live tag survives, so its `hasTag(innerHTML, 'script')` clause is false.
|
|
2574
|
+
// We instead flag the HTML-vs-XML divergence directly: the source text
|
|
2575
|
+
// contains a <script> tag, yet an HTML round-trip does NOT preserve it as a
|
|
2576
|
+
// live <script>. A bare or foster-parented <script> survives the round-trip
|
|
2577
|
+
// (and is already rejected by isIframeSrcdocScriptAttack); only one absorbed
|
|
2578
|
+
// into raw text disappears — the XML-only exploit. Intended for the
|
|
2579
|
+
// XMLDocument-owned branch of the HTML-injection sinks; HTML-owned elements
|
|
2580
|
+
// genuinely treat that content as inert text and must not reach this check.
|
|
2581
|
+
// eslint-disable-next-line class-methods-use-this
|
|
2582
|
+
this.isXMLScriptInRawTextElementAttack = input$LWS => {
|
|
2583
|
+
const normalizedInput$LWS = normalizeInput$LWS(input$LWS);
|
|
2584
|
+
// No <script> in the source text: nothing an XML parser could make live.
|
|
2585
|
+
if (!hasTag$LWS(normalizedInput$LWS, 'script')) {
|
|
2586
|
+
return false;
|
|
2587
|
+
}
|
|
2588
|
+
// changesSince.266 (W-23657409): decide the HTML-vs-XML divergence by
|
|
2589
|
+
// parsing into the inert <template>, never the live shared <div>. This is
|
|
2590
|
+
// the same shared-realm-upgrade hazard the changesSince.266 fix above
|
|
2591
|
+
// closed for isIframeSrcdocScriptAttack (W-23595929): setting innerHTML on
|
|
2592
|
+
// the rootDocument-owned <div> runs the HTML fragment parser in the shared
|
|
2593
|
+
// realm and upgrades any registered custom element the markup contains,
|
|
2594
|
+
// running a sandbox-defined constructor SYNCHRONOUSLY against a host-realm
|
|
2595
|
+
// element (its this.parentNode is the shared container, whose ownerDocument
|
|
2596
|
+
// and defaultView are the host document and window) — a full membrane
|
|
2597
|
+
// breach, and before this check even returns its verdict. This path is
|
|
2598
|
+
// reachable at the gate whenever the <script> is hidden in a raw-text /
|
|
2599
|
+
// RCDATA element (<textarea><script>...), because that shape makes
|
|
2600
|
+
// isIframeSrcdocScriptAttack return false and fall through to here. Template
|
|
2601
|
+
// contents are inert (no upgrade, no script execution, no resource loads)
|
|
2602
|
+
// and the HTML fragment parser's raw-text/RCDATA handling is identical, so
|
|
2603
|
+
// the <script>-survival verdict is unchanged. With the gate off the legacy
|
|
2604
|
+
// shared-container round-trip is preserved.
|
|
2605
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
2606
|
+
ReflectApply$LWS$1(ElementProtoInnerHTMLSetter$LWS, rootDocumentDetachedTemplate$LWS, [normalizedInput$LWS]);
|
|
2607
|
+
const templateInnerHTML$LWS = ReflectApply$LWS$1(ElementProtoInnerHTMLGetter$LWS, rootDocumentDetachedTemplate$LWS, []);
|
|
2608
|
+
// Release the parsed nodes so nothing lingers on the shared template
|
|
2609
|
+
// between calls.
|
|
2610
|
+
ReflectApply$LWS$1(ElementProtoInnerHTMLSetter$LWS, rootDocumentDetachedTemplate$LWS, ['']);
|
|
2611
|
+
return !hasTag$LWS(templateInnerHTML$LWS, 'script');
|
|
2612
|
+
}
|
|
2613
|
+
// Legacy (gate off): round-trip through the shared live container. If the
|
|
2614
|
+
// <script> survives as a live tag it is caught by isIframeSrcdocScriptAttack;
|
|
2615
|
+
// if it vanished, the HTML parser absorbed it into a raw-text / RCDATA
|
|
2616
|
+
// element where the XML parser would not.
|
|
2617
|
+
const {
|
|
2618
|
+
innerHTML: innerHTML$LWS
|
|
2619
|
+
} = htmlParserRoundTrip$LWS(normalizedInput$LWS);
|
|
2620
|
+
return !hasTag$LWS(innerHTML$LWS, 'script');
|
|
2621
|
+
};
|
|
2360
2622
|
this.isSharedElement = element$LWS => element$LWS === ReflectApply$LWS$1(DocumentProtoHeadGetter$LWS, this._document, []) || element$LWS === ReflectApply$LWS$1(DocumentProtoBodyGetter$LWS$1, this._document, []) || element$LWS === ReflectApply$LWS$1(DocumentProtoDocumentElementGetter$LWS, this._document, []);
|
|
2361
2623
|
// Detects whether `node` belongs to a document that an attacker
|
|
2362
2624
|
// could have populated with content bypassing LWS distortions.
|
|
@@ -2447,6 +2709,25 @@
|
|
|
2447
2709
|
}
|
|
2448
2710
|
return false;
|
|
2449
2711
|
}
|
|
2712
|
+
// Render `normalizedInput` once through the HTML parser on the shared detached
|
|
2713
|
+
// container and return both its serialized innerHTML and its rendered innerText.
|
|
2714
|
+
// isIframeSrcdocScriptAttack (hidden-script: innerHTML has a script, innerText
|
|
2715
|
+
// does not) and isXMLScriptInRawTextElementAttack (HTML-vs-XML divergence: source
|
|
2716
|
+
// has a script, the round-tripped innerHTML does not) both derive their answer
|
|
2717
|
+
// from this single parse, so they share one setter invocation instead of two.
|
|
2718
|
+
// innerText is '' when the engine lacks the getter (jsdom); the only consumer of
|
|
2719
|
+
// innerText already short-circuits before reaching here in that case.
|
|
2720
|
+
function htmlParserRoundTrip$LWS(normalizedInput$LWS) {
|
|
2721
|
+
ReflectApply$LWS$1(DocumentFragmentProtoAppend$LWS, rootDocumentDetachedFragment$LWS, [rootDocumentDetachedContainer$LWS]);
|
|
2722
|
+
ReflectApply$LWS$1(ElementProtoInnerHTMLSetter$LWS, rootDocumentDetachedContainer$LWS, [normalizedInput$LWS]);
|
|
2723
|
+
const innerHTML$LWS = ReflectApply$LWS$1(ElementProtoInnerHTMLGetter$LWS, rootDocumentDetachedContainer$LWS, []);
|
|
2724
|
+
const innerText$LWS = HTMLElementProtoInnerTextGetter$LWS ? ReflectApply$LWS$1(HTMLElementProtoInnerTextGetter$LWS, rootDocumentDetachedContainer$LWS, []) : '';
|
|
2725
|
+
ReflectApply$LWS$1(ElementProtoRemove$LWS$1, rootDocumentDetachedContainer$LWS, []);
|
|
2726
|
+
return {
|
|
2727
|
+
innerHTML: innerHTML$LWS,
|
|
2728
|
+
innerText: innerText$LWS
|
|
2729
|
+
};
|
|
2730
|
+
}
|
|
2450
2731
|
function hasTag$LWS(input$LWS, tag$LWS) {
|
|
2451
2732
|
// Input is already lowercased and invisible chars stripped by caller
|
|
2452
2733
|
const checkableInput$LWS = ReflectApply$LWS$1(StringProtoReplace$LWS, input$LWS, [/\s+/g, ' ']);
|
|
@@ -2505,13 +2786,18 @@
|
|
|
2505
2786
|
const DOMTokenListProtoLengthGetter$LWS = ObjectLookupOwnGetter$LWS$1(DOMTokenListProto$LWS, 'length');
|
|
2506
2787
|
const DOMTokenListProtoValueGetter$LWS = ObjectLookupOwnGetter$LWS$1(DOMTokenListProto$LWS, 'value');
|
|
2507
2788
|
const DOMTokenListProtoValueSetter$LWS = ObjectLookupOwnSetter$LWS(DOMTokenListProto$LWS, 'value');
|
|
2789
|
+
const CustomEventCtor$LWS = CustomEvent;
|
|
2508
2790
|
const EventCtor$LWS = Event;
|
|
2791
|
+
const {
|
|
2792
|
+
prototype: CustomEventProto$LWS
|
|
2793
|
+
} = CustomEventCtor$LWS;
|
|
2509
2794
|
const {
|
|
2510
2795
|
prototype: EventProto$LWS
|
|
2511
2796
|
} = EventCtor$LWS;
|
|
2512
2797
|
const {
|
|
2513
2798
|
stopPropagation: EventProtoStopPropagation$LWS
|
|
2514
2799
|
} = EventProto$LWS;
|
|
2800
|
+
const CustomEventProtoDetailGetter$LWS = ObjectLookupOwnGetter$LWS$1(CustomEventProto$LWS, 'detail');
|
|
2515
2801
|
const EventProtoCurrentTargetGetter$LWS = ObjectLookupOwnGetter$LWS$1(EventProto$LWS, 'currentTarget');
|
|
2516
2802
|
const EventProtoTypeGetter$LWS = ObjectLookupOwnGetter$LWS$1(EventProto$LWS, 'type');
|
|
2517
2803
|
const {
|
|
@@ -2833,7 +3119,7 @@
|
|
|
2833
3119
|
const XhrProtoResponseTextGetter$LWS = ObjectLookupOwnGetter$LWS$1(XhrProto$LWS, 'responseText');
|
|
2834
3120
|
const XhrProtoStatusGetter$LWS = ObjectLookupOwnGetter$LWS$1(XhrProto$LWS, 'status');
|
|
2835
3121
|
ObjectLookupOwnSetter$LWS(XhrProto$LWS, 'withCredentials');
|
|
2836
|
-
/*! version: 0.29.
|
|
3122
|
+
/*! version: 0.29.2 */
|
|
2837
3123
|
|
|
2838
3124
|
/*!
|
|
2839
3125
|
* Copyright (C) 2019 salesforce.com, inc.
|
|
@@ -3049,7 +3335,7 @@
|
|
|
3049
3335
|
}
|
|
3050
3336
|
return sanitized$LWS;
|
|
3051
3337
|
}
|
|
3052
|
-
/*! version: 0.29.
|
|
3338
|
+
/*! version: 0.29.2 */
|
|
3053
3339
|
|
|
3054
3340
|
/*!
|
|
3055
3341
|
* Copyright (C) 2023 salesforce.com, inc.
|
|
@@ -3125,7 +3411,7 @@
|
|
|
3125
3411
|
// swallow
|
|
3126
3412
|
}
|
|
3127
3413
|
const trusted = createPolicy('trusted', policyOptions);
|
|
3128
|
-
/*! version: 0.29.
|
|
3414
|
+
/*! version: 0.29.2 */
|
|
3129
3415
|
|
|
3130
3416
|
/*!
|
|
3131
3417
|
* Copyright (C) 2019 salesforce.com, inc.
|
|
@@ -3434,7 +3720,7 @@
|
|
|
3434
3720
|
}
|
|
3435
3721
|
return getSanitizerForConfig$LWS(sandboxKey$LWS, 'STRING_BLOB_HTML');
|
|
3436
3722
|
}
|
|
3437
|
-
/*! version: 0.29.
|
|
3723
|
+
/*! version: 0.29.2 */
|
|
3438
3724
|
|
|
3439
3725
|
/*!
|
|
3440
3726
|
* Copyright (C) 2023 salesforce.com, inc.
|
|
@@ -3648,13 +3934,39 @@
|
|
|
3648
3934
|
// signed value and we are ok or we don't and the browser throws an error. We
|
|
3649
3935
|
// want our 404 URL to be set and trigger the event handlers, hence we have to sign.
|
|
3650
3936
|
setScriptURL$LWS('blob:http://localhost/not-found');
|
|
3651
|
-
//
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3937
|
+
// changesSince.266 (W-23596014, Bug Bounty / H1): on the reject path we
|
|
3938
|
+
// no longer restore the developer's raw url to the NATIVE src content
|
|
3939
|
+
// attribute. That restoration was purely cosmetic ("leave no traces"),
|
|
3940
|
+
// but the browser's native "prepare a script element" algorithm reads
|
|
3941
|
+
// the src *content attribute* directly — it never routes through any
|
|
3942
|
+
// JS-level getter/setter, so no LWS distortion observes it. Unlike the
|
|
3943
|
+
// onFulfill path (which restores the raw url only AFTER the browser has
|
|
3944
|
+
// already run our injected safe blob, i.e. the script has "already
|
|
3945
|
+
// started" and can never re-run), a rejected fetch means the script was
|
|
3946
|
+
// NEVER sandbox-evaluated. Restoring a raw, never-evaluated url is thus
|
|
3947
|
+
// a native-execution primitive: an attacker aborts the first async
|
|
3948
|
+
// fetch with a second `.src=` write, then dispatches a synthetic `error`
|
|
3949
|
+
// while the script is still disconnected — firing this handler, writing
|
|
3950
|
+
// the raw attacker url into the native attribute — and appends the
|
|
3951
|
+
// element, so the browser's own loader fetches and executes it in the
|
|
3952
|
+
// MAIN realm with an undistorted document.cookie. (The sibling
|
|
3953
|
+
// SVGScriptElement/href path shares this code and the same fix.) The 404
|
|
3954
|
+
// placeholder set above still fires genuine developer `error` handlers;
|
|
3955
|
+
// only the raw-url restoration is dropped, since cosmetic DOM parity is
|
|
3956
|
+
// never worth an executable raw url.
|
|
3957
|
+
//
|
|
3958
|
+
// Gated OFF so a mechanical gate-cleanup removes the hole, not the
|
|
3959
|
+
// guard: DELETE THIS ENTIRE `if (!isGaterEnabledFeature(...))` BLOCK
|
|
3960
|
+
// when changesSince.266 graduates.
|
|
3961
|
+
if (!isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
3962
|
+
// This error event handler will get triggered after we set our 404 blob URL.
|
|
3963
|
+
const errorEventHandler$LWS = () => {
|
|
3964
|
+
// Similar to our wrappedEvaluator, we leave no traces.
|
|
3965
|
+
setScriptURL$LWS(cachedURL$LWS);
|
|
3966
|
+
ReflectApply$LWS$1(EventTargetProtoRemoveEventListener$LWS, targetElement$LWS, ['error', errorEventHandler$LWS]);
|
|
3967
|
+
};
|
|
3968
|
+
ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, targetElement$LWS, ['error', errorEventHandler$LWS]);
|
|
3969
|
+
}
|
|
3658
3970
|
};
|
|
3659
3971
|
ReflectApply$LWS$1(PromiseProtoThen$LWS, asyncRequest$LWS, [onFulfill$LWS, onReject$LWS]);
|
|
3660
3972
|
return '';
|
|
@@ -3685,7 +3997,7 @@
|
|
|
3685
3997
|
ReflectApply$LWS$1(ElementProtoSetAttributeNS$LWS, targetElement$LWS, [attributeNamespaceURI$LWS, attributeName$LWS, src$LWS]);
|
|
3686
3998
|
};
|
|
3687
3999
|
}
|
|
3688
|
-
/*! version: 0.29.
|
|
4000
|
+
/*! version: 0.29.2 */
|
|
3689
4001
|
|
|
3690
4002
|
/*!
|
|
3691
4003
|
* Copyright (C) 2019 salesforce.com, inc.
|
|
@@ -4448,6 +4760,24 @@
|
|
|
4448
4760
|
const DataTransferProtoBlockedProperties$LWS = ['mozCursor', 'mozSourceNode', 'mozUserCancelled'];
|
|
4449
4761
|
const attributeDistortionFactoriesCache$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1());
|
|
4450
4762
|
const sandboxAttributeDistortionRegistryCache$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
|
|
4763
|
+
const blockedTagInfoByCtor$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
|
|
4764
|
+
// Associate a blocked attribute on `Ctor` with the HTML tag name a foreign
|
|
4765
|
+
// generic node would carry when it specializes into `Ctor`'s interface on HTML
|
|
4766
|
+
// reparse. Called from the block-list wiring for the interfaces that have a
|
|
4767
|
+
// single canonical tag (iframe, embed, script). Idempotent across sandboxes.
|
|
4768
|
+
function registerBlockedAttributeTagName$LWS(Ctor$LWS, tagName$LWS, attributeName$LWS) {
|
|
4769
|
+
const loweredTagName$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, tagName$LWS, []);
|
|
4770
|
+
const loweredAttributeName$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, attributeName$LWS, []);
|
|
4771
|
+
let info$LWS = blockedTagInfoByCtor$LWS.get(Ctor$LWS);
|
|
4772
|
+
if (info$LWS === undefined) {
|
|
4773
|
+
info$LWS = {
|
|
4774
|
+
tagName: loweredTagName$LWS,
|
|
4775
|
+
attributeNames: toSafeSet$LWS(new SetCtor$LWS$1())
|
|
4776
|
+
};
|
|
4777
|
+
blockedTagInfoByCtor$LWS.set(Ctor$LWS, info$LWS);
|
|
4778
|
+
}
|
|
4779
|
+
info$LWS.attributeNames.add(loweredAttributeName$LWS);
|
|
4780
|
+
}
|
|
4451
4781
|
// =============================================================================
|
|
4452
4782
|
// Prototype-independent, realm-generic element-kind matching
|
|
4453
4783
|
// (W-23729707 + W-23768065)
|
|
@@ -4490,7 +4820,7 @@
|
|
|
4490
4820
|
// Gated changesSince.266; when the gate is off the fallback is inert and
|
|
4491
4821
|
// selection is byte-identical to the pre-fix instanceof-only behavior.
|
|
4492
4822
|
// =============================================================================
|
|
4493
|
-
function elementMatchesCtor$LWS(element$LWS, Ctor$LWS, allowBrandCheck$LWS) {
|
|
4823
|
+
function elementMatchesCtor$LWS(element$LWS, Ctor$LWS, attributeName$LWS, allowBrandCheck$LWS) {
|
|
4494
4824
|
// Fast path (all gates): an intact prototype chain answers definitively and
|
|
4495
4825
|
// matches the pre-fix behavior exactly.
|
|
4496
4826
|
if (element$LWS instanceof Ctor$LWS) {
|
|
@@ -4508,7 +4838,27 @@
|
|
|
4508
4838
|
if (!allowBrandCheck$LWS || !isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
4509
4839
|
return false;
|
|
4510
4840
|
}
|
|
4511
|
-
|
|
4841
|
+
if (isElementOfInterface$LWS(element$LWS, Ctor$LWS)) {
|
|
4842
|
+
return true;
|
|
4843
|
+
}
|
|
4844
|
+
// Tag-name fallback (W-23590867): `element` is not (yet) an instance of
|
|
4845
|
+
// Ctor's interface and carries none of its slots, but if its tag name
|
|
4846
|
+
// matches Ctor's blocked HTML tag name — for one of the attributes recorded
|
|
4847
|
+
// as blocked on that tag — an HTML reparse would specialize it into the real
|
|
4848
|
+
// interface, inheriting the attribute value set on the generic node. Match
|
|
4849
|
+
// by tag name so the block fires before that promotion can occur.
|
|
4850
|
+
const blockedTagInfo$LWS = blockedTagInfoByCtor$LWS.get(Ctor$LWS);
|
|
4851
|
+
if (blockedTagInfo$LWS === undefined || !blockedTagInfo$LWS.attributeNames.has(attributeName$LWS)) {
|
|
4852
|
+
return false;
|
|
4853
|
+
}
|
|
4854
|
+
let tagName$LWS;
|
|
4855
|
+
try {
|
|
4856
|
+
tagName$LWS = ReflectApply$LWS$1(ElementProtoTagNameGetter$LWS, element$LWS, []);
|
|
4857
|
+
} catch (_unused2$LWS) {
|
|
4858
|
+
// Not a genuine Element (e.g. a forged receiver) — no reparse risk.
|
|
4859
|
+
return false;
|
|
4860
|
+
}
|
|
4861
|
+
return ReflectApply$LWS$1(StringProtoToLowerCase$LWS, tagName$LWS, []) === blockedTagInfo$LWS.tagName;
|
|
4512
4862
|
}
|
|
4513
4863
|
function finalizeAttributeSetterDistortions$LWS(record$LWS) {
|
|
4514
4864
|
const attributeFactories$LWS = attributeDistortionFactoriesCache$LWS.get(record$LWS);
|
|
@@ -4549,7 +4899,8 @@
|
|
|
4549
4899
|
if (attributeDistortionRegistry$LWS === undefined) {
|
|
4550
4900
|
return undefined;
|
|
4551
4901
|
}
|
|
4552
|
-
const
|
|
4902
|
+
const loweredAttrName$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, attrName$LWS, []);
|
|
4903
|
+
const elementCtorMapByAttributeNamespaceRegistry$LWS = attributeDistortionRegistry$LWS[loweredAttrName$LWS];
|
|
4553
4904
|
if (elementCtorMapByAttributeNamespaceRegistry$LWS === undefined) {
|
|
4554
4905
|
return undefined;
|
|
4555
4906
|
}
|
|
@@ -4567,8 +4918,10 @@
|
|
|
4567
4918
|
// elementMatchesCtor uses instanceof as the fast path and, when
|
|
4568
4919
|
// allowBrandCheck is set (same-document element, changesSince.266), a
|
|
4569
4920
|
// tamper-resistant brand-check fallback so a repointed [[Prototype]]
|
|
4570
|
-
// cannot deselect this distortion
|
|
4571
|
-
|
|
4921
|
+
// cannot deselect this distortion, plus a tag-name fallback so a foreign
|
|
4922
|
+
// generic node that would reparse into this interface (W-23590867) is
|
|
4923
|
+
// still matched for its blocked attributes.
|
|
4924
|
+
if (elementMatchesCtor$LWS(element$LWS, Ctor$LWS, loweredAttrName$LWS, allowBrandCheck$LWS)) {
|
|
4572
4925
|
return distortion$LWS;
|
|
4573
4926
|
}
|
|
4574
4927
|
}
|
|
@@ -4637,6 +4990,23 @@
|
|
|
4637
4990
|
function normalizeNamespace$LWS(ns$LWS) {
|
|
4638
4991
|
return ns$LWS === null || ns$LWS === undefined || ns$LWS === '' ? NAMESPACE_DEFAULT$LWS : ns$LWS;
|
|
4639
4992
|
}
|
|
4993
|
+
// W-23486664: An Attr minted via createAttributeNS carries a *qualified* name
|
|
4994
|
+
// (e.g. 'foo:href') whose localName the browser still resolves as 'href'. The
|
|
4995
|
+
// attribute-distortion registry keys on the canonical name, so a qualified
|
|
4996
|
+
// name has to be normalized before lookup or getAttributeSetterDistortion
|
|
4997
|
+
// misses the registered 'href' entry and the raw value reaches the native
|
|
4998
|
+
// slot unsanitized. The setAttribute* family already normalizes inline; this
|
|
4999
|
+
// helper gives the remaining Attr-value sinks (Attr.value, Node.nodeValue,
|
|
5000
|
+
// Node.textContent, NamedNodeMap.setNamedItem) the same normalization. It is
|
|
5001
|
+
// deliberately scoped to those sinks rather than folded into
|
|
5002
|
+
// getAttributeSetterDistortion because that function is also reached by
|
|
5003
|
+
// toggleAttribute and the SVG attributeName distortions, which must keep
|
|
5004
|
+
// their raw-name behavior. Gated on the active train so pre-266 sandboxes
|
|
5005
|
+
// preserve their existing lookup behavior; the read side already normalizes
|
|
5006
|
+
// unconditionally inside getAttributeGetterDistortion.
|
|
5007
|
+
function normalizeAttributeName$LWS(attrName$LWS) {
|
|
5008
|
+
return isGaterEnabledFeature$LWS('changesSince.266') ? normalizeNamespacedAttributeName$LWS(attrName$LWS) : attrName$LWS;
|
|
5009
|
+
}
|
|
4640
5010
|
function registerAttributeSetterDistortion$LWS(record$LWS, ElementCtor$LWS, attributeName$LWS, attributeNamespace$LWS, distortion$LWS) {
|
|
4641
5011
|
let attributeFactories$LWS = attributeDistortionFactoriesCache$LWS.get(record$LWS);
|
|
4642
5012
|
if (attributeFactories$LWS === undefined) {
|
|
@@ -4698,7 +5068,8 @@
|
|
|
4698
5068
|
if (registry$LWS === undefined) {
|
|
4699
5069
|
return undefined;
|
|
4700
5070
|
}
|
|
4701
|
-
const
|
|
5071
|
+
const loweredAttrName$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, attrName$LWS, []);
|
|
5072
|
+
const byNamespace$LWS = registry$LWS[loweredAttrName$LWS];
|
|
4702
5073
|
if (byNamespace$LWS === undefined) {
|
|
4703
5074
|
return undefined;
|
|
4704
5075
|
}
|
|
@@ -4713,9 +5084,11 @@
|
|
|
4713
5084
|
} of it$LWS) {
|
|
4714
5085
|
// Prototype-independent selection, mirroring the setter registry: a
|
|
4715
5086
|
// repointed [[Prototype]] must not deselect a read-side (e.g. nonce)
|
|
4716
|
-
// getter distortion either
|
|
5087
|
+
// getter distortion either, and a foreign generic node whose tag name
|
|
5088
|
+
// would reparse into this interface (W-23590867) is matched for its
|
|
5089
|
+
// blocked attributes. allowBrandCheck is scoped to same-document
|
|
4717
5090
|
// elements by the caller. See elementMatchesCtor.
|
|
4718
|
-
if (elementMatchesCtor$LWS(element$LWS, Ctor$LWS, allowBrandCheck$LWS)) {
|
|
5091
|
+
if (elementMatchesCtor$LWS(element$LWS, Ctor$LWS, loweredAttrName$LWS, allowBrandCheck$LWS)) {
|
|
4719
5092
|
return getter$LWS;
|
|
4720
5093
|
}
|
|
4721
5094
|
}
|
|
@@ -4826,20 +5199,35 @@
|
|
|
4826
5199
|
const originalAttrValueSetter$LWS = ObjectLookupOwnSetter$LWS(Attr$LWS.prototype, 'value');
|
|
4827
5200
|
return function distortionAttrValueSetter$LWS(record$LWS) {
|
|
4828
5201
|
return [originalAttrValueSetter$LWS, function value$LWS(val$LWS) {
|
|
5202
|
+
// W-23596015: coerce `val` to a string EXACTLY ONCE, up front —
|
|
5203
|
+
// before reading `ownerElement` — to close a reentrant TOCTOU.
|
|
5204
|
+
// A `{ toString() {...} }` argument would otherwise reach the
|
|
5205
|
+
// native setter unconverted, and native WebIDL DOMString
|
|
5206
|
+
// coercion runs the attacker's `toString()` AFTER LWS has
|
|
5207
|
+
// committed to its routing decision. That reentrant call can
|
|
5208
|
+
// attach this (until now detached) Attr to a <script> via
|
|
5209
|
+
// `setAttributeNode`, so when the native setter finally writes
|
|
5210
|
+
// the real URL the Attr is connected — yet LWS is never
|
|
5211
|
+
// re-entered, and the URL lands through a raw native write that
|
|
5212
|
+
// skips the script-`src` distortion. Coercing first makes any
|
|
5213
|
+
// such reentrant attach visible to the `ownerElement` read
|
|
5214
|
+
// below, so the resolved string is routed through the
|
|
5215
|
+
// registered distortion instead of a raw native write.
|
|
5216
|
+
const coercedVal$LWS = isGaterEnabledFeature$LWS('changesSince.266') ? toSafeStringValue$LWS(val$LWS) : val$LWS;
|
|
4829
5217
|
const ownerElement$LWS = ReflectApply$LWS$1(AttrProtoOwnerElementGetter$LWS, this, []);
|
|
4830
5218
|
// istanbul ignore else: needs default platform behavior test
|
|
4831
5219
|
if (ownerElement$LWS) {
|
|
4832
|
-
const attrName$LWS = ReflectApply$LWS$1(AttrProtoNameGetter$LWS, this, []);
|
|
5220
|
+
const attrName$LWS = normalizeAttributeName$LWS(ReflectApply$LWS$1(AttrProtoNameGetter$LWS, this, []));
|
|
4833
5221
|
const attrNamespace$LWS = ReflectApply$LWS$1(AttrProtoNamespaceURIGetter$LWS, this, []);
|
|
4834
5222
|
const normalizedNamespace$LWS = normalizeNamespace$LWS(attrNamespace$LWS);
|
|
4835
5223
|
const distortion$LWS = getAttributeSetterDistortion$LWS(record$LWS, ownerElement$LWS, attrName$LWS, normalizedNamespace$LWS);
|
|
4836
5224
|
// istanbul ignore if: coverage missing, needs investigation
|
|
4837
5225
|
if (distortion$LWS) {
|
|
4838
|
-
ReflectApply$LWS$1(distortion$LWS, ownerElement$LWS, [
|
|
5226
|
+
ReflectApply$LWS$1(distortion$LWS, ownerElement$LWS, [coercedVal$LWS]);
|
|
4839
5227
|
return;
|
|
4840
5228
|
}
|
|
4841
5229
|
}
|
|
4842
|
-
ReflectApply$LWS$1(originalAttrValueSetter$LWS, this, [
|
|
5230
|
+
ReflectApply$LWS$1(originalAttrValueSetter$LWS, this, [coercedVal$LWS]);
|
|
4843
5231
|
}];
|
|
4844
5232
|
};
|
|
4845
5233
|
}
|
|
@@ -5997,7 +6385,8 @@
|
|
|
5997
6385
|
const {
|
|
5998
6386
|
isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$LWS,
|
|
5999
6387
|
isXMLEntityAttack: isXMLEntityAttack$LWS,
|
|
6000
|
-
isXMLNamespacedScriptAttack: isXMLNamespacedScriptAttack$LWS
|
|
6388
|
+
isXMLNamespacedScriptAttack: isXMLNamespacedScriptAttack$LWS,
|
|
6389
|
+
isXMLStylesheetProcessingInstructionAttack: isXMLStylesheetProcessingInstructionAttack$LWS
|
|
6001
6390
|
} = getValidator$LWS(document$LWS, globalObject$LWS);
|
|
6002
6391
|
// DOMParser.prototype.parseFromString can only be called with
|
|
6003
6392
|
// exactly two arguments. If it receives one argument, it will fail.
|
|
@@ -6034,6 +6423,22 @@
|
|
|
6034
6423
|
throw new LockerSecurityError$LWS(`Cannot 'parseFromString' using an unsecure ${toSafeTemplateStringValue$LWS(string$LWS)}.`);
|
|
6035
6424
|
}
|
|
6036
6425
|
}
|
|
6426
|
+
// changesSince.266 (W-23657156): reject an XSLT `xml-stylesheet`
|
|
6427
|
+
// processing instruction in any XML-family input. Generic XML is
|
|
6428
|
+
// handed to the native parser unsanitized, so the PI survives as a
|
|
6429
|
+
// live ProcessingInstruction node; sandboxed code reads it out of
|
|
6430
|
+
// this (context-less, inert) document and appends it to the LIVE
|
|
6431
|
+
// document. Node.prototype.appendChild is not distorted and the PI
|
|
6432
|
+
// lands on the Document node — which isSharedElement does not cover
|
|
6433
|
+
// — so the insertion is unguarded, and Chromium then fires native
|
|
6434
|
+
// XSLT: it fetches the attacker stylesheet and commits a transform
|
|
6435
|
+
// whose output script runs in the host realm, outside the sandbox.
|
|
6436
|
+
// SVG is included alongside XML/XHTML because it is XML-parsed and
|
|
6437
|
+
// can carry the same document-level PI. Rejecting at the parse
|
|
6438
|
+
// source prevents the PI node from ever existing.
|
|
6439
|
+
if (isGaterEnabledFeature$LWS('changesSince.266') && (contentType$LWS === ContentType$LWS.XML || contentType$LWS === ContentType$LWS.XHTML || contentType$LWS === ContentType$LWS.SVG) && isXMLStylesheetProcessingInstructionAttack$LWS(string$LWS)) {
|
|
6440
|
+
throw new LockerSecurityError$LWS(`Cannot 'parseFromString' using an unsecure ${toSafeTemplateStringValue$LWS(string$LWS)}.`);
|
|
6441
|
+
}
|
|
6037
6442
|
// This must be called to signal to the virtual
|
|
6038
6443
|
// CustomElementRegistry that the next thing created
|
|
6039
6444
|
// MAY CONTAIN a custom element, which must be marked for
|
|
@@ -6282,7 +6687,7 @@
|
|
|
6282
6687
|
const element$LWS = namedNodeMapToElementCache$LWS.get(nodeNameMap$LWS);
|
|
6283
6688
|
// istanbul ignore else: nothing to do if there's no element
|
|
6284
6689
|
if (element$LWS) {
|
|
6285
|
-
const attrName$LWS = ReflectApply$LWS$1(AttrProtoNameGetter$LWS, attr$LWS, []);
|
|
6690
|
+
const attrName$LWS = normalizeAttributeName$LWS(ReflectApply$LWS$1(AttrProtoNameGetter$LWS, attr$LWS, []));
|
|
6286
6691
|
const attrNamespace$LWS = ReflectApply$LWS$1(AttrProtoNamespaceURIGetter$LWS, attr$LWS, []);
|
|
6287
6692
|
const normalizedNamespace$LWS = normalizeNamespace$LWS(attrNamespace$LWS);
|
|
6288
6693
|
const distortion$LWS = getAttributeSetterDistortion$LWS(record$LWS, element$LWS, attrName$LWS, normalizedNamespace$LWS);
|
|
@@ -6618,7 +7023,8 @@
|
|
|
6618
7023
|
}
|
|
6619
7024
|
const {
|
|
6620
7025
|
isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$7$LWS,
|
|
6621
|
-
isSharedElement: isSharedElement$y$LWS
|
|
7026
|
+
isSharedElement: isSharedElement$y$LWS,
|
|
7027
|
+
isXMLScriptInRawTextElementAttack: isXMLScriptInRawTextElementAttack$1$LWS
|
|
6622
7028
|
} = rootValidator$LWS;
|
|
6623
7029
|
function initDistortionElementInnerHTMLSetter$LWS({
|
|
6624
7030
|
document: document$LWS,
|
|
@@ -6672,7 +7078,13 @@
|
|
|
6672
7078
|
// malicious markup on a later engine coercion (see toSafeStringValue() docs).
|
|
6673
7079
|
value$LWS = toSafeStringValue$LWS(value$LWS);
|
|
6674
7080
|
}
|
|
6675
|
-
|
|
7081
|
+
// isOwnerXMLDocument && !isSVGElement is exactly the permissive branch above: it
|
|
7082
|
+
// skips createHTML and is parsed by the XML parser, which has no raw-text / RCDATA
|
|
7083
|
+
// elements. A <script> nested in <textarea>/<title>/etc. is inert text under the
|
|
7084
|
+
// HTML parser (so isIframeSrcdocScriptAttack alone misses it) but a live, clonable
|
|
7085
|
+
// script under XML — cloneNode + adoption into the HTML document then executes it
|
|
7086
|
+
// (W-23486666).
|
|
7087
|
+
if (isIframeSrcdocScriptAttack$7$LWS(value$LWS) || isOwnerXMLDocument$LWS && !isSVGElement$LWS && isGaterEnabledFeature$LWS('changesSince.266') && isXMLScriptInRawTextElementAttack$1$LWS(value$LWS)) {
|
|
6676
7088
|
throw new LockerSecurityError$LWS(`Cannot set 'innerHTML' using an unsecure ${toSafeTemplateStringValue$LWS(value$LWS)}.`);
|
|
6677
7089
|
}
|
|
6678
7090
|
ReflectApply$LWS$1(originalInnerHTMLSetter$LWS, this, [value$LWS]);
|
|
@@ -7260,7 +7672,8 @@
|
|
|
7260
7672
|
}
|
|
7261
7673
|
const {
|
|
7262
7674
|
isIframeSrcdocScriptAttack: isIframeSrcdocScriptAttack$3$LWS,
|
|
7263
|
-
isSharedElement: isSharedElement$p$LWS
|
|
7675
|
+
isSharedElement: isSharedElement$p$LWS,
|
|
7676
|
+
isXMLScriptInRawTextElementAttack: isXMLScriptInRawTextElementAttack$LWS
|
|
7264
7677
|
} = rootValidator$LWS;
|
|
7265
7678
|
function initDistortionElementSetHTMLUnsafe$LWS({
|
|
7266
7679
|
document: document$LWS,
|
|
@@ -7320,7 +7733,13 @@
|
|
|
7320
7733
|
const contentType$LWS = isSVGElement$LWS ? ContentType$LWS.SVG : ContentType$LWS.HTML;
|
|
7321
7734
|
normalizedValue$LWS = lwsInternalPolicy$LWS.createHTML(normalizedValue$LWS, key$LWS, contentType$LWS);
|
|
7322
7735
|
}
|
|
7323
|
-
|
|
7736
|
+
// isOwnerXMLDocument && !isSVGElement is exactly the permissive branch above: it
|
|
7737
|
+
// skips createHTML and is parsed by the XML parser, which has no raw-text / RCDATA
|
|
7738
|
+
// elements. A <script> nested in <textarea>/<title>/etc. is inert text under the
|
|
7739
|
+
// HTML parser (so isIframeSrcdocScriptAttack alone misses it) but a live, clonable
|
|
7740
|
+
// script under XML — cloneNode + adoption into the HTML document then executes it
|
|
7741
|
+
// (W-23486666).
|
|
7742
|
+
if (isIframeSrcdocScriptAttack$3$LWS(normalizedValue$LWS) || isOwnerXMLDocument$LWS && !isSVGElement$LWS && isGaterEnabledFeature$LWS('changesSince.266') && isXMLScriptInRawTextElementAttack$LWS(normalizedValue$LWS)) {
|
|
7324
7743
|
throw new LockerSecurityError$LWS(`Cannot 'setHTMLUnsafe' using an unsecure ${toSafeTemplateStringValue$LWS(normalizedValue$LWS)}.`);
|
|
7325
7744
|
}
|
|
7326
7745
|
ReflectApply$LWS$1(originalSetHTMLUnsafe$LWS, this, [normalizedValue$LWS]);
|
|
@@ -7497,11 +7916,48 @@
|
|
|
7497
7916
|
return [originalAddEventListener$LWS, addEventListener$LWS];
|
|
7498
7917
|
};
|
|
7499
7918
|
}
|
|
7500
|
-
|
|
7919
|
+
const DISPATCH_DETAIL_REFERENCE_METRIC$LWS = 'lws.dispatchEvent.detailReference';
|
|
7920
|
+
const DISPATCH_TOTAL_METRIC$LWS = 'lws.dispatchEvent.total';
|
|
7501
7921
|
// @W-18977628 — Reserved event types that sandboxed code must never dispatch.
|
|
7502
7922
|
// These are internal Aura framework events whose listeners run outside the
|
|
7503
7923
|
// sandbox and pass privileged unsandboxed references to the caller.
|
|
7504
7924
|
const BLOCKED_DISPATCH_EVENT_TYPES$LWS = toSafeSet$LWS(new SetCtor$LWS$1(['aurainteropfindowner']));
|
|
7925
|
+
function isDomElementOrFunction$LWS(value$LWS) {
|
|
7926
|
+
return typeof value$LWS === 'function' || isElement$LWS(value$LWS);
|
|
7927
|
+
}
|
|
7928
|
+
function detailContainsReference$LWS(detail$LWS) {
|
|
7929
|
+
if (isDomElementOrFunction$LWS(detail$LWS)) {
|
|
7930
|
+
return true;
|
|
7931
|
+
}
|
|
7932
|
+
if (isObject$LWS$1(detail$LWS)) {
|
|
7933
|
+
const keys$LWS = ObjectKeys$LWS$1(detail$LWS);
|
|
7934
|
+
for (let i$LWS = 0, {
|
|
7935
|
+
length: length$LWS
|
|
7936
|
+
} = keys$LWS; i$LWS < length$LWS; i$LWS += 1) {
|
|
7937
|
+
if (isDomElementOrFunction$LWS(detail$LWS[keys$LWS[i$LWS]])) {
|
|
7938
|
+
return true;
|
|
7939
|
+
}
|
|
7940
|
+
}
|
|
7941
|
+
}
|
|
7942
|
+
return false;
|
|
7943
|
+
}
|
|
7944
|
+
function recordDispatchEventMetrics$LWS(instrumentation$LWS, event$LWS) {
|
|
7945
|
+
if (typeof (instrumentation$LWS == null ? void 0 : instrumentation$LWS.incrementCounter) !== 'function') {
|
|
7946
|
+
return;
|
|
7947
|
+
}
|
|
7948
|
+
// Denominator: every gated dispatch, so detailReference can be read as a rate.
|
|
7949
|
+
instrumentation$LWS.incrementCounter(DISPATCH_TOTAL_METRIC$LWS, 1, false);
|
|
7950
|
+
let hasReference$LWS = false;
|
|
7951
|
+
try {
|
|
7952
|
+
// The detail getter throws on a non-CustomEvent event; hostile detail can too.
|
|
7953
|
+
hasReference$LWS = detailContainsReference$LWS(ReflectApply$LWS$1(CustomEventProtoDetailGetter$LWS, event$LWS, []));
|
|
7954
|
+
} catch (_unused3$LWS) {
|
|
7955
|
+
return;
|
|
7956
|
+
}
|
|
7957
|
+
if (hasReference$LWS) {
|
|
7958
|
+
instrumentation$LWS.incrementCounter(DISPATCH_DETAIL_REFERENCE_METRIC$LWS, 1, false);
|
|
7959
|
+
}
|
|
7960
|
+
}
|
|
7505
7961
|
function initDistortionEventTargetDispatchEvent$LWS({
|
|
7506
7962
|
globalObject: {
|
|
7507
7963
|
EventTarget: {
|
|
@@ -7511,7 +7967,12 @@
|
|
|
7511
7967
|
}
|
|
7512
7968
|
}
|
|
7513
7969
|
}) {
|
|
7514
|
-
|
|
7970
|
+
// Read `instrumentation` from the inner factory's record, not this
|
|
7971
|
+
// initializer's: the initializer result is memoized per document and shared
|
|
7972
|
+
// across sandboxes, so capturing it here would freeze to the first sandbox.
|
|
7973
|
+
return function distortionEventTargetDispatchEvent$LWS({
|
|
7974
|
+
instrumentation: instrumentation$LWS
|
|
7975
|
+
}) {
|
|
7515
7976
|
function dispatchEvent$LWS(...args$LWS) {
|
|
7516
7977
|
const {
|
|
7517
7978
|
length: length$LWS
|
|
@@ -7525,12 +7986,41 @@
|
|
|
7525
7986
|
throw new LockerSecurityError$LWS(`Cannot dispatch '${eventType$LWS}' event.`);
|
|
7526
7987
|
}
|
|
7527
7988
|
}
|
|
7989
|
+
if (length$LWS > 0 && isGaterEnabledFeature$LWS(COUNT_DISPATCH_EVENT_DETAIL_REFERENCES_GATE$LWS)) {
|
|
7990
|
+
recordDispatchEventMetrics$LWS(instrumentation$LWS, args$LWS[0]);
|
|
7991
|
+
}
|
|
7528
7992
|
return ReflectApply$LWS$1(originalDispatchEvent$LWS, this, args$LWS);
|
|
7529
7993
|
}
|
|
7530
7994
|
return [originalDispatchEvent$LWS, dispatchEvent$LWS];
|
|
7531
7995
|
};
|
|
7532
7996
|
}
|
|
7533
7997
|
|
|
7998
|
+
// W-23969898: caches the structural "is this a distortable iframe contentWindow
|
|
7999
|
+
// realm" determination per globalObject. The globalObject key here is the
|
|
8000
|
+
// frame's WindowProxy, whose object identity is STABLE across a same-origin
|
|
8001
|
+
// navigation (createSecondaryWindowSandboxRecord runs once for the initial
|
|
8002
|
+
// about:blank realm and again, with the SAME globalObject reference, from the
|
|
8003
|
+
// frame's `load` listener after a navigation). See the caching rationale on
|
|
8004
|
+
// getDistortableFrameElement below.
|
|
8005
|
+
//
|
|
8006
|
+
// This cache is ONE of TWO co-dependent halves of the W-23969898 fix; neither
|
|
8007
|
+
// closes the leak alone (empirically: reverting either half reopens it):
|
|
8008
|
+
// 1. Record-build resilience on a torn-down realm (@locker/sandbox
|
|
8009
|
+
// util/distortion.ts, getDistortionFactories / createDistortionEntries).
|
|
8010
|
+
// A frame the component has already detached leaves its child window with
|
|
8011
|
+
// JS intrinsics intact but DOM globals stripped; a full distortion build
|
|
8012
|
+
// touches an absent DOM interface and throws, collapsing the whole record
|
|
8013
|
+
// to a containment-free opaque one — so the cross-realm family is never
|
|
8014
|
+
// even REACHED. That fix builds only the intrinsic-only distortions on
|
|
8015
|
+
// such a realm, so the family factories below actually run.
|
|
8016
|
+
// 2. This cache. Once the family factory runs, its getDistortableFrameElement
|
|
8017
|
+
// gate still does a LIVE frameElement read (below) that a detached frame
|
|
8018
|
+
// answers null — so without the cached first-sight verdict the factory
|
|
8019
|
+
// installs no entry and the realm's raw Reflect.get still leaks. The cache
|
|
8020
|
+
// supplies the truthy structural verdict recorded while the frame was
|
|
8021
|
+
// still attached.
|
|
8022
|
+
// Half 1 lets the family be reached; half 2 lets it install. Both are required.
|
|
8023
|
+
const distortableFrameElementByGlobalObject$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
|
|
7534
8024
|
// W-22602807: shared helper for distorting an iframe contentWindow realm's
|
|
7535
8025
|
// function-invocation primitives (Function.prototype.call/apply/bind,
|
|
7536
8026
|
// Reflect.apply/construct) and, as of W-23748562, its CAPTURE primitives
|
|
@@ -7562,18 +8052,60 @@
|
|
|
7562
8052
|
// changesSince.264: when the gate is off, no entry is installed and the
|
|
7563
8053
|
// primitive keeps its native behavior. One check here covers every
|
|
7564
8054
|
// invocation- and capture-primitive distortion in this family.
|
|
8055
|
+
//
|
|
8056
|
+
// CALLERS MUST capture their native primitive AFTER this returns truthy, inside
|
|
8057
|
+
// the distortion factory — never in the outer initializer's parameter
|
|
8058
|
+
// destructure. The initializer runs for every record built, including a
|
|
8059
|
+
// transitional secondary-window realm (e.g. a still-materializing
|
|
8060
|
+
// window.open()'d same-origin window) whose intrinsics are momentarily
|
|
8061
|
+
// undefined; an eager outer read dereferences them before this gate can bail
|
|
8062
|
+
// and throws (W-24222894).
|
|
8063
|
+
//
|
|
8064
|
+
// W-23969898 (changesSince.266): the "is a distortable iframe realm" verdict is
|
|
8065
|
+
// a PERMANENT structural fact, but this used to re-derive it from a LIVE
|
|
8066
|
+
// `frameElement` read on every call. Each cross-realm distortion factory runs
|
|
8067
|
+
// this at record-build time and installs no entry when it returns falsy, and
|
|
8068
|
+
// the post-navigation record is cached per document — so a single falsy read at
|
|
8069
|
+
// rebuild time skips the family PERMANENTLY for that realm. A component can
|
|
8070
|
+
// force exactly that: it registers its own capture-phase `load` listener BEFORE
|
|
8071
|
+
// reading `contentWindow` (LWS only attaches its own listener at that read, so
|
|
8072
|
+
// it runs SECOND) and detaches the frame from its listener; when LWS's listener
|
|
8073
|
+
// then rebuilds the record, the live `frameElement` read is null, the family is
|
|
8074
|
+
// skipped, and the realm's undistorted `Reflect.get` leaks the host
|
|
8075
|
+
// `document.cookie`. Caching the determination the first time the realm is seen
|
|
8076
|
+
// ATTACHED removes THIS half of the timing dependency: once a factory runs, a
|
|
8077
|
+
// later detach can no longer erase a truthy verdict already recorded. A
|
|
8078
|
+
// window.open() popup never reads a truthy frameElement even on first sight, so
|
|
8079
|
+
// first-sight truthiness still discriminates iframe realms from popup realms.
|
|
8080
|
+
//
|
|
8081
|
+
// The cache only matters AFTER a factory actually runs, though. On a
|
|
8082
|
+
// component-detached frame the record build itself throws before reaching this
|
|
8083
|
+
// family unless the build is made resilient to a torn-down realm — see the
|
|
8084
|
+
// two-halves note on the WeakMap declaration above. This half installs the
|
|
8085
|
+
// entry; the resilience half lets this half be reached.
|
|
7565
8086
|
function getDistortableFrameElement$LWS(globalObject$LWS) {
|
|
7566
8087
|
if (!isGaterEnabledFeature$LWS('changesSince.264')) {
|
|
7567
8088
|
return undefined;
|
|
7568
8089
|
}
|
|
8090
|
+
const cacheStructuralDetermination$LWS = isGaterEnabledFeature$LWS('changesSince.266');
|
|
8091
|
+
if (cacheStructuralDetermination$LWS) {
|
|
8092
|
+
const cached$LWS = distortableFrameElementByGlobalObject$LWS.get(globalObject$LWS);
|
|
8093
|
+
if (cached$LWS !== undefined) {
|
|
8094
|
+
return cached$LWS;
|
|
8095
|
+
}
|
|
8096
|
+
}
|
|
7569
8097
|
let frameElement$LWS;
|
|
7570
8098
|
try {
|
|
7571
8099
|
frameElement$LWS = ReflectApply$LWS$1(WindowFrameElementGetter$LWS, globalObject$LWS, []);
|
|
7572
|
-
} catch (
|
|
8100
|
+
} catch (_unused4$LWS) {
|
|
7573
8101
|
// Cross-origin / non-window realm: not our target.
|
|
7574
8102
|
return undefined;
|
|
7575
8103
|
}
|
|
7576
|
-
|
|
8104
|
+
const distortableFrameElement$LWS = frameElement$LWS || undefined;
|
|
8105
|
+
if (cacheStructuralDetermination$LWS && distortableFrameElement$LWS !== undefined) {
|
|
8106
|
+
distortableFrameElementByGlobalObject$LWS.set(globalObject$LWS, distortableFrameElement$LWS);
|
|
8107
|
+
}
|
|
8108
|
+
return distortableFrameElement$LWS;
|
|
7577
8109
|
}
|
|
7578
8110
|
// Re-resolve `callee` to its distorted counterpart from the root distortion
|
|
7579
8111
|
// map, if one exists; otherwise return it unchanged.
|
|
@@ -7603,18 +8135,61 @@
|
|
|
7603
8135
|
}
|
|
7604
8136
|
return callee$LWS;
|
|
7605
8137
|
}
|
|
8138
|
+
// The exotic-object internal-method (trap) names a Proxy handler may carry, per
|
|
8139
|
+
// ECMAScript 9.5. The foreign engine invokes these directly when an operation
|
|
8140
|
+
// is performed on the resulting proxy.
|
|
8141
|
+
const PROXY_TRAP_NAMES$LWS = ['apply', 'construct', 'defineProperty', 'deleteProperty', 'get', 'getOwnPropertyDescriptor', 'getPrototypeOf', 'has', 'isExtensible', 'ownKeys', 'preventExtensions', 'set', 'setPrototypeOf'];
|
|
8142
|
+
// W-24124284: substitute the trap functions on a Proxy handler the same way
|
|
8143
|
+
// substituteDistortedCallee substitutes the target. A capture primitive
|
|
8144
|
+
// (Proxy / Proxy.revocable) re-resolves only its TARGET; the handler crosses
|
|
8145
|
+
// into the native primitive untouched, so a raw cross-realm callable smuggled
|
|
8146
|
+
// as a trap (e.g. `{ getPrototypeOf: Function }`) is later invoked by the
|
|
8147
|
+
// foreign engine UNDISTORTED — it compiles `document.cookie` against the
|
|
8148
|
+
// undistorted document and leaks the top-level jar, exactly the raw-callee
|
|
8149
|
+
// leak substituteDistortedCallee closes for the target. Re-resolving each trap
|
|
8150
|
+
// at capture time re-attaches the distortion the engine's internal trap
|
|
8151
|
+
// dispatch would otherwise bypass (there is no JS-observable interception point
|
|
8152
|
+
// for a native [[Call]] on a handler trap).
|
|
8153
|
+
//
|
|
8154
|
+
// Only an OWN trap the handler actually carries is mirrored onto the fresh
|
|
8155
|
+
// handler. ObjectHasOwn is a frozen intrinsic own-property check: unlike
|
|
8156
|
+
// handler.hasOwnProperty(...) it cannot be spoofed by an attacker-controlled
|
|
8157
|
+
// handler (e.g. `{ hasOwnProperty: () => false, getPrototypeOf: rawFn }`), and
|
|
8158
|
+
// unlike a bare `in` it does not walk the prototype. Prototype-walking would be
|
|
8159
|
+
// actively wrong here: a FUNCTION is a valid Proxy handler and inherits
|
|
8160
|
+
// apply/call/bind from Function.prototype, so `'apply' in handler` would be
|
|
8161
|
+
// true and Function.prototype.apply would be mis-captured as an apply trap. A
|
|
8162
|
+
// trap the caller never defined stays absent, so the proxy keeps its default
|
|
8163
|
+
// forward-to-target behavior for that operation rather than being handed a
|
|
8164
|
+
// spurious `undefined` own property. An inherited trap is likewise not copied:
|
|
8165
|
+
// the proxy then default-forwards that operation instead of invoking a possibly
|
|
8166
|
+
// raw inherited callable -- a fail-closed divergence from the engine's
|
|
8167
|
+
// prototype-inclusive GetMethod dispatch, never a leak.
|
|
8168
|
+
//
|
|
8169
|
+
// Each present trap is read ONCE and snapshotted; besides closing the
|
|
8170
|
+
// substitution gap this removes any get-trap TOCTOU where a handler could hand
|
|
8171
|
+
// the substitution a benign trap and the engine a raw one on a later read. A
|
|
8172
|
+
// non-object/non-function handler is returned unchanged so the native primitive
|
|
8173
|
+
// throws its own TypeError for an invalid handler.
|
|
8174
|
+
function substituteDistortedHandler$LWS(root$LWS, handler$LWS) {
|
|
8175
|
+
if (handler$LWS === null || typeof handler$LWS !== 'object' && typeof handler$LWS !== 'function') {
|
|
8176
|
+
return handler$LWS;
|
|
8177
|
+
}
|
|
8178
|
+
const substituted$LWS = {};
|
|
8179
|
+
for (let i$LWS = 0, {
|
|
8180
|
+
length: length$LWS
|
|
8181
|
+
} = PROXY_TRAP_NAMES$LWS; i$LWS < length$LWS; i$LWS += 1) {
|
|
8182
|
+
const name$LWS = PROXY_TRAP_NAMES$LWS[i$LWS];
|
|
8183
|
+
if (ObjectHasOwn$LWS$1(handler$LWS, name$LWS)) {
|
|
8184
|
+
substituted$LWS[name$LWS] = substituteDistortedCallee$LWS(root$LWS, handler$LWS[name$LWS]);
|
|
8185
|
+
}
|
|
8186
|
+
}
|
|
8187
|
+
return substituted$LWS;
|
|
8188
|
+
}
|
|
7606
8189
|
|
|
7607
8190
|
// W-22602807: distort an iframe contentWindow realm's Function.prototype.apply.
|
|
7608
8191
|
// See cross-realm-invocation.ts for the threat model.
|
|
7609
|
-
function initDistortionFunctionApply$LWS({
|
|
7610
|
-
globalObject: {
|
|
7611
|
-
Function: {
|
|
7612
|
-
prototype: {
|
|
7613
|
-
apply: originalApply$LWS
|
|
7614
|
-
}
|
|
7615
|
-
}
|
|
7616
|
-
}
|
|
7617
|
-
}) {
|
|
8192
|
+
function initDistortionFunctionApply$LWS() {
|
|
7618
8193
|
return function distortionFunctionApply$LWS({
|
|
7619
8194
|
globalObject: globalObject$LWS,
|
|
7620
8195
|
root: root$LWS
|
|
@@ -7622,6 +8197,14 @@
|
|
|
7622
8197
|
if (!getDistortableFrameElement$LWS(globalObject$LWS)) {
|
|
7623
8198
|
return undefined;
|
|
7624
8199
|
}
|
|
8200
|
+
// W-24222894: read the primitive AFTER the gate — never in the outer
|
|
8201
|
+
// initializer's parameter. The initializer runs for EVERY record built,
|
|
8202
|
+
// including a transitional secondary-window realm (e.g. a freshly
|
|
8203
|
+
// window.open()'d same-origin window still materializing) whose
|
|
8204
|
+
// Function.prototype is momentarily undefined; an eager outer read
|
|
8205
|
+
// dereferences it before this gate can bail and throws. See
|
|
8206
|
+
// cross-realm-invocation.ts.
|
|
8207
|
+
const originalApply$LWS = globalObject$LWS.Function.prototype.apply;
|
|
7625
8208
|
return [originalApply$LWS,
|
|
7626
8209
|
// `this` is the callee; (thisArg, argsArray) its binding and args.
|
|
7627
8210
|
// `apply` accepts a null/undefined argsArray, which ReflectApply
|
|
@@ -7638,15 +8221,7 @@
|
|
|
7638
8221
|
// bind defers invocation: it returns a bound function invoked later. We
|
|
7639
8222
|
// substitute the callee for its distorted counterpart FIRST, then bind that,
|
|
7640
8223
|
// so the returned bound function wraps the sandbox-distorted callee.
|
|
7641
|
-
function initDistortionFunctionBind$LWS({
|
|
7642
|
-
globalObject: {
|
|
7643
|
-
Function: {
|
|
7644
|
-
prototype: {
|
|
7645
|
-
bind: originalBind$LWS
|
|
7646
|
-
}
|
|
7647
|
-
}
|
|
7648
|
-
}
|
|
7649
|
-
}) {
|
|
8224
|
+
function initDistortionFunctionBind$LWS() {
|
|
7650
8225
|
return function distortionFunctionBind$LWS({
|
|
7651
8226
|
globalObject: globalObject$LWS,
|
|
7652
8227
|
root: root$LWS
|
|
@@ -7654,6 +8229,10 @@
|
|
|
7654
8229
|
if (!getDistortableFrameElement$LWS(globalObject$LWS)) {
|
|
7655
8230
|
return undefined;
|
|
7656
8231
|
}
|
|
8232
|
+
// W-24222894: read the primitive AFTER the gate. See apply-value.ts and
|
|
8233
|
+
// cross-realm-invocation.ts for why an eager outer-parameter read
|
|
8234
|
+
// crashes on a transitional secondary-window realm.
|
|
8235
|
+
const originalBind$LWS = globalObject$LWS.Function.prototype.bind;
|
|
7657
8236
|
return [originalBind$LWS,
|
|
7658
8237
|
// `this` is the callee; (thisArg, ...boundArgs) the binding and
|
|
7659
8238
|
// partially-applied args. Bind the substituted callee with the
|
|
@@ -7666,15 +8245,7 @@
|
|
|
7666
8245
|
|
|
7667
8246
|
// W-22602807: distort an iframe contentWindow realm's Function.prototype.call.
|
|
7668
8247
|
// See cross-realm-invocation.ts for the threat model.
|
|
7669
|
-
function initDistortionFunctionCall$LWS({
|
|
7670
|
-
globalObject: {
|
|
7671
|
-
Function: {
|
|
7672
|
-
prototype: {
|
|
7673
|
-
call: originalCall$LWS
|
|
7674
|
-
}
|
|
7675
|
-
}
|
|
7676
|
-
}
|
|
7677
|
-
}) {
|
|
8248
|
+
function initDistortionFunctionCall$LWS() {
|
|
7678
8249
|
return function distortionFunctionCall$LWS({
|
|
7679
8250
|
globalObject: globalObject$LWS,
|
|
7680
8251
|
root: root$LWS
|
|
@@ -7682,6 +8253,10 @@
|
|
|
7682
8253
|
if (!getDistortableFrameElement$LWS(globalObject$LWS)) {
|
|
7683
8254
|
return undefined;
|
|
7684
8255
|
}
|
|
8256
|
+
// W-24222894: read the primitive AFTER the gate. See apply-value.ts and
|
|
8257
|
+
// cross-realm-invocation.ts for why an eager outer-parameter read
|
|
8258
|
+
// crashes on a transitional secondary-window realm.
|
|
8259
|
+
const originalCall$LWS = globalObject$LWS.Function.prototype.call;
|
|
7685
8260
|
return [originalCall$LWS,
|
|
7686
8261
|
// `this` is the callee; (thisArg, ...args) its binding and arguments.
|
|
7687
8262
|
function call$LWS(thisArg$LWS, ...args$LWS) {
|
|
@@ -7732,6 +8307,46 @@
|
|
|
7732
8307
|
}];
|
|
7733
8308
|
};
|
|
7734
8309
|
}
|
|
8310
|
+
|
|
8311
|
+
// Shared endpoint enforcement for the History URL-mutating methods
|
|
8312
|
+
// (`pushState` / `replaceState`). Their optional third argument is the new
|
|
8313
|
+
// history URL; when present and non-empty, validate its resolved destination
|
|
8314
|
+
// against the endpoint denylist so sandboxed code cannot repoint the shared
|
|
8315
|
+
// main-window document at a platform-internal endpoint. An omitted, `null` /
|
|
8316
|
+
// `undefined`, or empty URL leaves the document address unchanged, so it is
|
|
8317
|
+
// delegated untouched and the common state-only usage is preserved.
|
|
8318
|
+
function assertHistoryURLAllowed$LWS(args$LWS) {
|
|
8319
|
+
if (args$LWS.length > 2) {
|
|
8320
|
+
const {
|
|
8321
|
+
2: url$LWS
|
|
8322
|
+
} = args$LWS;
|
|
8323
|
+
// An explicit `null` / `undefined` third argument is the spec's "leave the
|
|
8324
|
+
// document address unchanged" signal (equivalent to omitting it). Delegate
|
|
8325
|
+
// it untouched: coercing it would yield the literal string `"null"` /
|
|
8326
|
+
// `"undefined"`, pin that back below, and dispatch an unintended
|
|
8327
|
+
// same-origin navigation to `/null` or `/undefined`. Mirrors
|
|
8328
|
+
// `Window/fetch-value.ts`'s null/undefined guard. This branches on the raw
|
|
8329
|
+
// argument identity (never a coercion), so a shape-shifting object — which
|
|
8330
|
+
// is neither `null` nor `undefined` — still flows through the pinning path.
|
|
8331
|
+
if (url$LWS !== null && url$LWS !== undefined) {
|
|
8332
|
+
const urlString$LWS = toSafeStringValue$LWS(url$LWS);
|
|
8333
|
+
// Pin the coerced primitive back into the argument list before the
|
|
8334
|
+
// native `pushState` / `replaceState` runs. Otherwise the browser's own
|
|
8335
|
+
// WebIDL coercion re-invokes a shape-shifting argument's `toString`,
|
|
8336
|
+
// letting it hand the guard an allowed URL and the platform a denylisted
|
|
8337
|
+
// one (TOCTOU). Writing unconditionally also closes the empty-string
|
|
8338
|
+
// variant, where the first coercion yields '' (skipping validation) and
|
|
8339
|
+
// the second yields a denylisted URL.
|
|
8340
|
+
args$LWS[2] = urlString$LWS;
|
|
8341
|
+
if (urlString$LWS !== '') {
|
|
8342
|
+
const parsedURL$LWS = parseURL$LWS(urlString$LWS);
|
|
8343
|
+
if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
|
|
8344
|
+
throw new LockerSecurityError$LWS(`Cannot set history URL to disallowed endpoint: ${toSafeTemplateStringValue$LWS(parsedURL$LWS.normalizedURL)}`);
|
|
8345
|
+
}
|
|
8346
|
+
}
|
|
8347
|
+
}
|
|
8348
|
+
}
|
|
8349
|
+
}
|
|
7735
8350
|
function initDistortionHistoryPushState$LWS({
|
|
7736
8351
|
globalObject: {
|
|
7737
8352
|
DOMException: DOMException$LWS,
|
|
@@ -7743,6 +8358,9 @@
|
|
|
7743
8358
|
}
|
|
7744
8359
|
}) {
|
|
7745
8360
|
const distortionEntry$LWS = [originalPushState$LWS, function pushState$LWS(...args$LWS) {
|
|
8361
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
8362
|
+
assertHistoryURLAllowed$LWS(args$LWS);
|
|
8363
|
+
}
|
|
7746
8364
|
try {
|
|
7747
8365
|
return ReflectApply$LWS$1(originalPushState$LWS, this, args$LWS);
|
|
7748
8366
|
} catch (error) {
|
|
@@ -7771,6 +8389,9 @@
|
|
|
7771
8389
|
}
|
|
7772
8390
|
}) {
|
|
7773
8391
|
const distortionEntry$LWS = [originalReplaceState$LWS, function replaceState$LWS(...args$LWS) {
|
|
8392
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
8393
|
+
assertHistoryURLAllowed$LWS(args$LWS);
|
|
8394
|
+
}
|
|
7774
8395
|
try {
|
|
7775
8396
|
return ReflectApply$LWS$1(originalReplaceState$LWS, this, args$LWS);
|
|
7776
8397
|
} catch (error) {
|
|
@@ -8114,6 +8735,405 @@
|
|
|
8114
8735
|
return [originalActionSetter$LWS, originalActionSetter$LWS];
|
|
8115
8736
|
};
|
|
8116
8737
|
}
|
|
8738
|
+
|
|
8739
|
+
// Shared validation for programmatic form submission (submit / requestSubmit).
|
|
8740
|
+
//
|
|
8741
|
+
// The `action` IDL getter resolves the form's effective submission destination:
|
|
8742
|
+
// per the HTML standard, when the `action` content attribute is missing or its
|
|
8743
|
+
// value is the empty string, the getter returns the element's node-document URL
|
|
8744
|
+
// rather than the empty string. Reading the resolved value through the native
|
|
8745
|
+
// getter therefore captures the actionless-form case (the current document URL)
|
|
8746
|
+
// that the `action` setter's empty-string passthrough leaves unvalidated.
|
|
8747
|
+
//
|
|
8748
|
+
// `requestSubmit(submitter)` can override the form's action: when the submitter
|
|
8749
|
+
// is a submit button carrying a `formaction` content attribute, the native
|
|
8750
|
+
// submission algorithm dispatches to *that* target instead of the form's
|
|
8751
|
+
// `action`. A submitter can acquire a denylisted `formaction` through a path the
|
|
8752
|
+
// `formAction` setter / `setAttribute` guards do not cover (e.g. HTML parsed via
|
|
8753
|
+
// `innerHTML`), so the submitter's effective target is resolved and validated
|
|
8754
|
+
// here whenever it supplies one, falling back to the form's action otherwise.
|
|
8755
|
+
// The `formaction` content attribute is read (rather than the `formAction` IDL
|
|
8756
|
+
// getter) so a missing attribute — meaning "no override" — is distinguishable
|
|
8757
|
+
// from an empty one; `parseURL` resolves a relative or empty value against the
|
|
8758
|
+
// document base, mirroring the native empty-`formaction`-to-document-URL rule.
|
|
8759
|
+
function assertFormSubmissionAllowed$LWS(form$LWS, submitter$LWS) {
|
|
8760
|
+
const submitterFormAction$LWS = submitter$LWS === undefined || submitter$LWS === null ? null : ReflectApply$LWS$1(ElementProtoGetAttribute$LWS, submitter$LWS, ['formaction']);
|
|
8761
|
+
const effectiveAction$LWS = submitterFormAction$LWS === null ? toSafeStringValue$LWS(ReflectApply$LWS$1(HTMLFormElementProtoActionGetter$LWS, form$LWS, [])) : toSafeStringValue$LWS(submitterFormAction$LWS);
|
|
8762
|
+
const parsedURL$LWS = parseURL$LWS(effectiveAction$LWS);
|
|
8763
|
+
if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
|
|
8764
|
+
throw new LockerSecurityError$LWS(`Cannot submit form to disallowed endpoint: ${toSafeTemplateStringValue$LWS(parsedURL$LWS.normalizedURL)}`);
|
|
8765
|
+
}
|
|
8766
|
+
}
|
|
8767
|
+
function initDistortionHTMLFormElementRequestSubmit$LWS({
|
|
8768
|
+
globalObject: {
|
|
8769
|
+
HTMLFormElement: {
|
|
8770
|
+
prototype: {
|
|
8771
|
+
requestSubmit: originalRequestSubmit$LWS
|
|
8772
|
+
}
|
|
8773
|
+
}
|
|
8774
|
+
}
|
|
8775
|
+
}) {
|
|
8776
|
+
const distortionEntry$LWS = [originalRequestSubmit$LWS, function requestSubmit$LWS(...args$LWS) {
|
|
8777
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
8778
|
+
// The optional submitter's `formaction` overrides the form's
|
|
8779
|
+
// action at submission time, so validate the submitter's
|
|
8780
|
+
// effective target rather than only the form's `action`.
|
|
8781
|
+
assertFormSubmissionAllowed$LWS(this, args$LWS[0]);
|
|
8782
|
+
}
|
|
8783
|
+
return ReflectApply$LWS$1(originalRequestSubmit$LWS, this, args$LWS);
|
|
8784
|
+
}];
|
|
8785
|
+
return function distortionHTMLFormElementRequestSubmit$LWS() {
|
|
8786
|
+
return distortionEntry$LWS;
|
|
8787
|
+
};
|
|
8788
|
+
}
|
|
8789
|
+
function initDistortionHTMLFormElementSubmit$LWS({
|
|
8790
|
+
globalObject: {
|
|
8791
|
+
HTMLFormElement: {
|
|
8792
|
+
prototype: {
|
|
8793
|
+
submit: originalSubmit$LWS
|
|
8794
|
+
}
|
|
8795
|
+
}
|
|
8796
|
+
}
|
|
8797
|
+
}) {
|
|
8798
|
+
const distortionEntry$LWS = [originalSubmit$LWS, function submit$LWS(...args$LWS) {
|
|
8799
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
8800
|
+
assertFormSubmissionAllowed$LWS(this);
|
|
8801
|
+
}
|
|
8802
|
+
return ReflectApply$LWS$1(originalSubmit$LWS, this, args$LWS);
|
|
8803
|
+
}];
|
|
8804
|
+
return function distortionHTMLFormElementSubmit$LWS() {
|
|
8805
|
+
return distortionEntry$LWS;
|
|
8806
|
+
};
|
|
8807
|
+
}
|
|
8808
|
+
|
|
8809
|
+
// Per-frame bookkeeping for the HTMLFrameElement.src async pre-flight
|
|
8810
|
+
const pendingURLs$1$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
|
|
8811
|
+
const inflightControllers$1$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
|
|
8812
|
+
// Frames whose pre-flight detected an attack pattern in the fetched
|
|
8813
|
+
// response body. The setter checks this set at entry and throws
|
|
8814
|
+
// synchronously on any subsequent write attempt, so the violation is
|
|
8815
|
+
// observable from sandboxed code on the *next* sync touchpoint after
|
|
8816
|
+
// the async pre-flight resolved hostile.
|
|
8817
|
+
const poisonedFrames$LWS = toSafeWeakSet$LWS$1(new WeakSetCtor$LWS$1());
|
|
8818
|
+
// Cross-frame URL rejection cache. When a pre-flight detects hostile,
|
|
8819
|
+
// the URL's pathname is added here. Any subsequent frame.src assignment
|
|
8820
|
+
// to a URL with the same pathname (regardless of the frame instance,
|
|
8821
|
+
// query string, or fragment) throws synchronously without re-fetching.
|
|
8822
|
+
// Pathname-keyed (not full URL) so query-string rotation can't evade
|
|
8823
|
+
// the cache.
|
|
8824
|
+
//
|
|
8825
|
+
// Like the iframe pipeline's equivalent cache, this Set is module-scoped
|
|
8826
|
+
// (shared across every sandbox) and entries are never evicted for the
|
|
8827
|
+
// process lifetime. The accepted tradeoff, shared with the iframe
|
|
8828
|
+
// pipeline: a validator false positive would keep every sandbox
|
|
8829
|
+
// rejecting that pathname until the page reloads. This is deemed
|
|
8830
|
+
// acceptable because a resource classified as carrying an attack pattern
|
|
8831
|
+
// is not expected to become benign within a session, and the fail-closed
|
|
8832
|
+
// direction favors security over availability.
|
|
8833
|
+
const rejectedPathnames$1$LWS = toSafeSet$LWS(new SetCtor$LWS$1());
|
|
8834
|
+
function getPendingURL$1$LWS(frame$LWS) {
|
|
8835
|
+
return pendingURLs$1$LWS.get(frame$LWS);
|
|
8836
|
+
}
|
|
8837
|
+
function setPendingURL$1$LWS(frame$LWS, url$LWS) {
|
|
8838
|
+
pendingURLs$1$LWS.set(frame$LWS, url$LWS);
|
|
8839
|
+
}
|
|
8840
|
+
function clearPendingURL$1$LWS(frame$LWS) {
|
|
8841
|
+
pendingURLs$1$LWS.delete(frame$LWS);
|
|
8842
|
+
}
|
|
8843
|
+
function abortInflightPreflight$1$LWS(frame$LWS) {
|
|
8844
|
+
const controller$LWS = inflightControllers$1$LWS.get(frame$LWS);
|
|
8845
|
+
if (controller$LWS !== undefined) {
|
|
8846
|
+
ReflectApply$LWS$1(AbortControllerProtoAbort$LWS, controller$LWS, []);
|
|
8847
|
+
inflightControllers$1$LWS.delete(frame$LWS);
|
|
8848
|
+
}
|
|
8849
|
+
}
|
|
8850
|
+
function trackInflightPreflight$1$LWS(frame$LWS, controller$LWS) {
|
|
8851
|
+
inflightControllers$1$LWS.set(frame$LWS, controller$LWS);
|
|
8852
|
+
}
|
|
8853
|
+
function clearInflightPreflight$1$LWS(frame$LWS) {
|
|
8854
|
+
inflightControllers$1$LWS.delete(frame$LWS);
|
|
8855
|
+
}
|
|
8856
|
+
// Compare-and-delete: drop the tracked controller only when it is still
|
|
8857
|
+
// the one this request installed. A superseded request's fetch settles
|
|
8858
|
+
// (or rejects from its own abort) AFTER a replacement request has already
|
|
8859
|
+
// stored its controller here; an unconditional delete from that stale
|
|
8860
|
+
// handler would evict the replacement's controller, leaving the newer
|
|
8861
|
+
// pre-flight untracked. An untracked pre-flight can no longer be aborted
|
|
8862
|
+
// by a subsequent assignment, so it could commit a superseded (stale)
|
|
8863
|
+
// URL. Deleting only on identity match keeps every clear scoped to the
|
|
8864
|
+
// request that owns it.
|
|
8865
|
+
function clearInflightPreflightIfCurrent$LWS(frame$LWS, controller$LWS) {
|
|
8866
|
+
if (inflightControllers$1$LWS.get(frame$LWS) === controller$LWS) {
|
|
8867
|
+
inflightControllers$1$LWS.delete(frame$LWS);
|
|
8868
|
+
}
|
|
8869
|
+
}
|
|
8870
|
+
function poisonFrame$LWS(frame$LWS) {
|
|
8871
|
+
poisonedFrames$LWS.add(frame$LWS);
|
|
8872
|
+
}
|
|
8873
|
+
function isPoisonedFrame$LWS(frame$LWS) {
|
|
8874
|
+
return poisonedFrames$LWS.has(frame$LWS);
|
|
8875
|
+
}
|
|
8876
|
+
function rejectPathname$1$LWS(pathname$LWS) {
|
|
8877
|
+
rejectedPathnames$1$LWS.add(pathname$LWS);
|
|
8878
|
+
}
|
|
8879
|
+
function isRejectedPathname$1$LWS(pathname$LWS) {
|
|
8880
|
+
return rejectedPathnames$1$LWS.has(pathname$LWS);
|
|
8881
|
+
}
|
|
8882
|
+
|
|
8883
|
+
// HTMLFrameElement.src getter distortion. Returns the pending URL
|
|
8884
|
+
// recorded by the src setter's same-origin pre-flight pipeline (see
|
|
8885
|
+
// src-setter.ts) when one exists, otherwise falls through to the native
|
|
8886
|
+
// getter.
|
|
8887
|
+
//
|
|
8888
|
+
// The same getter is registered into the read-side attribute getter
|
|
8889
|
+
// registry under (HTMLFrameElement, 'src'), so frame.getAttribute('src'),
|
|
8890
|
+
// frame.getAttributeNS, frame.attributes['src'].value, etc. all surface
|
|
8891
|
+
// the pending URL during the pre-flight inspection window.
|
|
8892
|
+
function initDistortionHTMLFrameElementSrcGetter$LWS({
|
|
8893
|
+
globalObject: {
|
|
8894
|
+
HTMLFrameElement: HTMLFrameElement$LWS
|
|
8895
|
+
}
|
|
8896
|
+
}) {
|
|
8897
|
+
const originalSrcGetter$LWS = ObjectLookupOwnGetter$LWS$1(HTMLFrameElement$LWS.prototype, 'src');
|
|
8898
|
+
return function distortionHTMLFrameElementSrcGetter$LWS(record$LWS) {
|
|
8899
|
+
function src$LWS() {
|
|
8900
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
8901
|
+
const pending$LWS = getPendingURL$1$LWS(this);
|
|
8902
|
+
if (pending$LWS !== undefined) {
|
|
8903
|
+
return pending$LWS;
|
|
8904
|
+
}
|
|
8905
|
+
}
|
|
8906
|
+
return ReflectApply$LWS$1(originalSrcGetter$LWS, this, []);
|
|
8907
|
+
}
|
|
8908
|
+
// The pending-URL pipeline that backs this getter is gate-266
|
|
8909
|
+
// work; only register into the read-side attribute getter registry
|
|
8910
|
+
// when the gate is on, otherwise ungated sandboxes pay the
|
|
8911
|
+
// registry-consultation cost on every frame.src read with no
|
|
8912
|
+
// behavior change to show for it.
|
|
8913
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
8914
|
+
registerAttributeGetterDistortion$LWS(record$LWS, HTMLFrameElement$LWS, 'src', NAMESPACE_DEFAULT$LWS, src$LWS);
|
|
8915
|
+
}
|
|
8916
|
+
return [originalSrcGetter$LWS, src$LWS];
|
|
8917
|
+
};
|
|
8918
|
+
}
|
|
8919
|
+
|
|
8920
|
+
// HTMLFrameElement.src coverage (W-23475830). Before this distortion,
|
|
8921
|
+
const {
|
|
8922
|
+
isIframeSrcdocAttack: isIframeSrcdocAttack$1$LWS,
|
|
8923
|
+
isXMLEntityAttack: isXMLEntityAttack$1$LWS,
|
|
8924
|
+
isXMLNamespacedScriptAttack: isXMLNamespacedScriptAttack$1$LWS
|
|
8925
|
+
} = rootValidator$LWS;
|
|
8926
|
+
const ABOUT_BLANK_TOKEN$1$LWS = 'about:blank';
|
|
8927
|
+
function initDistortionHTMLFrameElementSrcSetter$LWS({
|
|
8928
|
+
globalObject: {
|
|
8929
|
+
HTMLFrameElement: HTMLFrameElement$LWS,
|
|
8930
|
+
fetch: originalFetch$LWS
|
|
8931
|
+
}
|
|
8932
|
+
}) {
|
|
8933
|
+
const originalSrcSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLFrameElement$LWS.prototype, 'src');
|
|
8934
|
+
return function distortionHTMLFrameElementSrcSetter$LWS(record$LWS) {
|
|
8935
|
+
function src$LWS(value$LWS) {
|
|
8936
|
+
// Brand-new distortion: the entire distorted behavior is
|
|
8937
|
+
// gated on the active train. When the gate is off, fall
|
|
8938
|
+
// through to the pristine native setter so ungated orgs see
|
|
8939
|
+
// the pre-existing (native) behavior.
|
|
8940
|
+
if (!isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
8941
|
+
ReflectApply$LWS$1(originalSrcSetter$LWS, this, [value$LWS]);
|
|
8942
|
+
return;
|
|
8943
|
+
}
|
|
8944
|
+
// If a prior async pre-flight on this frame detected an
|
|
8945
|
+
// attack pattern in the fetched body, the frame is
|
|
8946
|
+
// permanently poisoned: any subsequent synchronous write
|
|
8947
|
+
// throws, so the security violation surfaces at the call
|
|
8948
|
+
// site of the FOLLOWING `frame.src = ...` (or
|
|
8949
|
+
// setAttribute('src', ...)) even though we cannot
|
|
8950
|
+
// synchronously propagate the original hostile detection
|
|
8951
|
+
// back to its triggering setter call.
|
|
8952
|
+
if (isPoisonedFrame$LWS(this)) {
|
|
8953
|
+
throw new LockerSecurityError$LWS('HTMLFrameElement is poisoned: a prior src assignment fetched a body containing an attack pattern. The frame cannot be reused.');
|
|
8954
|
+
}
|
|
8955
|
+
const normalizedSrcValue$LWS = toSafeStringValue$LWS(value$LWS);
|
|
8956
|
+
// This must run on the raw value before sanitization, because
|
|
8957
|
+
// sanitization can remove the exploit pattern.
|
|
8958
|
+
if (isAttemptingToExploitURL$LWS(normalizedSrcValue$LWS)) {
|
|
8959
|
+
throw new LockerSecurityError$LWS(`Cannot set src to "${toSafeTemplateStringValue$LWS(normalizedSrcValue$LWS)}"`);
|
|
8960
|
+
}
|
|
8961
|
+
// Sanitize non-empty values for assignment; leave the empty
|
|
8962
|
+
// string as-is.
|
|
8963
|
+
const urlString$LWS = normalizedSrcValue$LWS !== '' ? sanitizeURLForElement$LWS(normalizedSrcValue$LWS) : '';
|
|
8964
|
+
// Scheme allowlist. This is the gate that closes the reported
|
|
8965
|
+
// vector: `blob:` and `javascript:` are not valid schemes, so
|
|
8966
|
+
// a self-closing-root XML blob (or a javascript: URL) is
|
|
8967
|
+
// refused here before it can ever load.
|
|
8968
|
+
if (urlString$LWS && !isValidURLScheme$LWS(urlString$LWS)) {
|
|
8969
|
+
throw new LockerSecurityError$LWS('HTMLFrameElement.src supports http://, https:// schemes, relative urls and about:blank.');
|
|
8970
|
+
}
|
|
8971
|
+
const parsedURL$LWS = parseURL$LWS(urlString$LWS);
|
|
8972
|
+
if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
|
|
8973
|
+
const {
|
|
8974
|
+
normalizedURL: normalizedURL$LWS
|
|
8975
|
+
} = parsedURL$LWS;
|
|
8976
|
+
throw new LockerSecurityError$LWS(`Cannot request disallowed endpoint: ${toSafeTemplateStringValue$LWS(normalizedURL$LWS)}`);
|
|
8977
|
+
}
|
|
8978
|
+
// Same-origin URLs go through an async pre-flight that fetches
|
|
8979
|
+
// the resource and runs its body through the rootValidator
|
|
8980
|
+
// attack-pattern checks (XML entity smuggling, iframe+srcdoc
|
|
8981
|
+
// combos, and XML-namespaced script payloads). Same-origin
|
|
8982
|
+
// guarantees the pre-flight body is byte-identical to what the
|
|
8983
|
+
// frame load would receive (attacker-controllable content
|
|
8984
|
+
// surfaces in this threat model are deployable static
|
|
8985
|
+
// resources, which serve identical bytes for every request).
|
|
8986
|
+
// Cross-origin URLs proceed through the synchronous path
|
|
8987
|
+
// unchanged because the JS layer cannot inspect cross-origin
|
|
8988
|
+
// response bodies and SOP already contains the cross-origin
|
|
8989
|
+
// contentDocument.
|
|
8990
|
+
//
|
|
8991
|
+
// isSameOriginURL parses the URL and can throw on
|
|
8992
|
+
// pathological inputs. A parse failure means we cannot prove
|
|
8993
|
+
// the URL is same-origin, so we fall through to the
|
|
8994
|
+
// non-pre-flight write path (the same path a cross-origin
|
|
8995
|
+
// URL takes) rather than surfacing a raw parser error to
|
|
8996
|
+
// sandboxed code. Mirrors the try/catch guard the iframe
|
|
8997
|
+
// pipeline puts around its own isSameOriginURL call.
|
|
8998
|
+
let isSameOrigin$LWS = false;
|
|
8999
|
+
try {
|
|
9000
|
+
isSameOrigin$LWS = isSameOriginURL$LWS(urlString$LWS);
|
|
9001
|
+
} catch (_unused5$LWS) {
|
|
9002
|
+
isSameOrigin$LWS = false;
|
|
9003
|
+
}
|
|
9004
|
+
if (urlString$LWS !== '' && urlString$LWS !== ABOUT_BLANK_TOKEN$1$LWS && isSameOrigin$LWS) {
|
|
9005
|
+
// Cross-frame rejection cache: if any prior pre-flight
|
|
9006
|
+
// detected an attack pattern at this URL's pathname,
|
|
9007
|
+
// refuse synchronously without re-fetching. Pathname-keyed
|
|
9008
|
+
// so query-string rotation can't evade it.
|
|
9009
|
+
if (isRejectedPathname$1$LWS(parsedURL$LWS.pathname)) {
|
|
9010
|
+
throw new LockerSecurityError$LWS(`Cannot set src to "${toSafeTemplateStringValue$LWS(urlString$LWS)}": pathname previously rejected as containing an attack pattern.`);
|
|
9011
|
+
}
|
|
9012
|
+
preflightSameOriginAndCommit$LWS(this, urlString$LWS, parsedURL$LWS.pathname);
|
|
9013
|
+
return;
|
|
9014
|
+
}
|
|
9015
|
+
// Any non-pre-flight write (cross-origin, empty, about:blank)
|
|
9016
|
+
// supersedes a pending pre-flight: abort it, clear pending
|
|
9017
|
+
// state, then write native.
|
|
9018
|
+
abortInflightPreflight$1$LWS(this);
|
|
9019
|
+
clearPendingURL$1$LWS(this);
|
|
9020
|
+
clearInflightPreflight$1$LWS(this);
|
|
9021
|
+
ReflectApply$LWS$1(originalSrcSetter$LWS, this, [urlString$LWS]);
|
|
9022
|
+
}
|
|
9023
|
+
// Same-origin async pre-flight. The setter stays synchronous from
|
|
9024
|
+
// sandboxed code's perspective: it returns after recording the
|
|
9025
|
+
// pending URL and kicking off the fetch. The native attribute is
|
|
9026
|
+
// NOT written until the pre-flight approves the body, so the
|
|
9027
|
+
// browser does not begin navigating until then. Read-after-write
|
|
9028
|
+
// surfaces (frame.src, getAttribute('src')) see the pending URL
|
|
9029
|
+
// during the inspection window via the src getter distortion +
|
|
9030
|
+
// read-side attribute getter registry.
|
|
9031
|
+
function preflightSameOriginAndCommit$LWS(frame$LWS, urlString$LWS, pathname$LWS) {
|
|
9032
|
+
// Re-assignment cancels any prior pre-flight in flight on this
|
|
9033
|
+
// frame and replaces it with the new URL.
|
|
9034
|
+
abortInflightPreflight$1$LWS(frame$LWS);
|
|
9035
|
+
setPendingURL$1$LWS(frame$LWS, urlString$LWS);
|
|
9036
|
+
const controller$LWS = new AbortControllerCtor$LWS();
|
|
9037
|
+
const signal$LWS = ReflectApply$LWS$1(AbortControllerProtoSignalGetter$LWS, controller$LWS, []);
|
|
9038
|
+
trackInflightPreflight$1$LWS(frame$LWS, controller$LWS);
|
|
9039
|
+
const isSupersededOrAborted$LWS = () => signal$LWS.aborted;
|
|
9040
|
+
const onSafe$LWS = () => {
|
|
9041
|
+
if (isSupersededOrAborted$LWS()) {
|
|
9042
|
+
return;
|
|
9043
|
+
}
|
|
9044
|
+
clearPendingURL$1$LWS(frame$LWS);
|
|
9045
|
+
clearInflightPreflightIfCurrent$LWS(frame$LWS, controller$LWS);
|
|
9046
|
+
ReflectApply$LWS$1(originalSrcSetter$LWS, frame$LWS, [urlString$LWS]);
|
|
9047
|
+
};
|
|
9048
|
+
const onHostile$LWS = () => {
|
|
9049
|
+
if (isSupersededOrAborted$LWS()) {
|
|
9050
|
+
return;
|
|
9051
|
+
}
|
|
9052
|
+
clearPendingURL$1$LWS(frame$LWS);
|
|
9053
|
+
clearInflightPreflightIfCurrent$LWS(frame$LWS, controller$LWS);
|
|
9054
|
+
// Native src is intentionally left unwritten; the frame
|
|
9055
|
+
// never navigates to the hostile URL. Mark it poisoned so
|
|
9056
|
+
// the next synchronous write throws, and add the pathname
|
|
9057
|
+
// to the cross-frame rejection cache so any future frame
|
|
9058
|
+
// whose src lands at the same pathname throws synchronously
|
|
9059
|
+
// without re-fetching.
|
|
9060
|
+
poisonFrame$LWS(frame$LWS);
|
|
9061
|
+
rejectPathname$1$LWS(pathname$LWS);
|
|
9062
|
+
};
|
|
9063
|
+
const onAborted$LWS = () => {
|
|
9064
|
+
// This handler runs for a request that was superseded, so
|
|
9065
|
+
// by the time it fires a replacement request has typically
|
|
9066
|
+
// already stored ITS controller. Clear on identity match
|
|
9067
|
+
// only: an unconditional delete here would evict the
|
|
9068
|
+
// replacement's controller, leaving the newer pre-flight
|
|
9069
|
+
// untracked (and therefore un-abortable by a later
|
|
9070
|
+
// assignment, which could then let a stale URL commit).
|
|
9071
|
+
clearInflightPreflightIfCurrent$LWS(frame$LWS, controller$LWS);
|
|
9072
|
+
};
|
|
9073
|
+
// Fail-closed handler for a pre-flight fetch that rejected
|
|
9074
|
+
// (network error, or — the security-critical case — a CSP
|
|
9075
|
+
// `connect-src` block). A same-origin `fetch` is governed by
|
|
9076
|
+
// `connect-src`, while a `<frame>` navigation is governed by
|
|
9077
|
+
// `frame-src` / `child-src`: a deployment can block the fetch
|
|
9078
|
+
// yet still permit the frame to navigate. Committing here would
|
|
9079
|
+
// hand the frame an UNVALIDATED same-origin body — the exact
|
|
9080
|
+
// escape this pipeline exists to close. Because the frame
|
|
9081
|
+
// setter never writes native `src` eagerly, failing closed is
|
|
9082
|
+
// simply "do not write": clear the pending/in-flight
|
|
9083
|
+
// bookkeeping and leave the frame un-navigated. We do NOT
|
|
9084
|
+
// poison — a transport failure is not proof of an attack
|
|
9085
|
+
// pattern, so a later assignment of the same URL may re-attempt
|
|
9086
|
+
// the pre-flight. (Deliberate divergence from the iframe
|
|
9087
|
+
// pipeline, which commits on fetch failure because it writes
|
|
9088
|
+
// native eagerly for detached iframes and cannot cleanly
|
|
9089
|
+
// withhold the write; `<frame>` never writes eagerly, so it
|
|
9090
|
+
// can.)
|
|
9091
|
+
const onUninspectable$LWS = () => {
|
|
9092
|
+
clearPendingURL$1$LWS(frame$LWS);
|
|
9093
|
+
clearInflightPreflightIfCurrent$LWS(frame$LWS, controller$LWS);
|
|
9094
|
+
};
|
|
9095
|
+
ReflectApply$LWS$1(originalFetch$LWS, undefined, [urlString$LWS, {
|
|
9096
|
+
__proto__: null,
|
|
9097
|
+
credentials: 'same-origin',
|
|
9098
|
+
signal: signal$LWS
|
|
9099
|
+
}])
|
|
9100
|
+
// Read the body regardless of HTTP status: a same-origin
|
|
9101
|
+
// 4xx/5xx whose error-page body carries a hostile pattern
|
|
9102
|
+
// must still poison the frame, because the browser would
|
|
9103
|
+
// render that error-page body into the frame too. (Only a
|
|
9104
|
+
// rejected fetch — network error, CSP `connect-src` block,
|
|
9105
|
+
// or abort — reaches .catch below; a non-abort rejection
|
|
9106
|
+
// fails closed there, leaving `src` unwritten rather than
|
|
9107
|
+
// committing an un-inspected body.)
|
|
9108
|
+
.then(response$LWS => response$LWS.text()).then(body$LWS => {
|
|
9109
|
+
if (isSupersededOrAborted$LWS()) {
|
|
9110
|
+
onAborted$LWS();
|
|
9111
|
+
return;
|
|
9112
|
+
}
|
|
9113
|
+
if (isIframeSrcdocAttack$1$LWS(body$LWS) || isXMLEntityAttack$1$LWS(body$LWS) || isXMLNamespacedScriptAttack$1$LWS(body$LWS)) {
|
|
9114
|
+
onHostile$LWS();
|
|
9115
|
+
} else {
|
|
9116
|
+
onSafe$LWS();
|
|
9117
|
+
}
|
|
9118
|
+
}).catch(() => {
|
|
9119
|
+
if (isSupersededOrAborted$LWS()) {
|
|
9120
|
+
onAborted$LWS();
|
|
9121
|
+
return;
|
|
9122
|
+
}
|
|
9123
|
+
// The pre-flight fetch rejected, so the body was never
|
|
9124
|
+
// inspected. Fail closed: leave native `src` unwritten
|
|
9125
|
+
// (see onUninspectable). We must NOT commit here — a CSP
|
|
9126
|
+
// `connect-src` block can reject the fetch while
|
|
9127
|
+
// `frame-src` still permits the navigation, so
|
|
9128
|
+
// committing would navigate the frame to an unvalidated
|
|
9129
|
+
// body and reopen the escape path.
|
|
9130
|
+
onUninspectable$LWS();
|
|
9131
|
+
});
|
|
9132
|
+
}
|
|
9133
|
+
registerAttributeSetterDistortion$LWS(record$LWS, HTMLFrameElement$LWS, 'src', NAMESPACE_DEFAULT$LWS, src$LWS);
|
|
9134
|
+
return [originalSrcSetter$LWS, src$LWS];
|
|
9135
|
+
};
|
|
9136
|
+
}
|
|
8117
9137
|
function initDistortionHTMLFrameSetElementOnrejectionhandled$LWS({
|
|
8118
9138
|
globalObject: {
|
|
8119
9139
|
HTMLFrameSetElement: HTMLFrameSetElement$LWS
|
|
@@ -8343,7 +9363,7 @@
|
|
|
8343
9363
|
if (!isSameOriginURL$LWS(srcValue$LWS)) {
|
|
8344
9364
|
return;
|
|
8345
9365
|
}
|
|
8346
|
-
} catch (
|
|
9366
|
+
} catch (_unused6$LWS) {
|
|
8347
9367
|
/* empty */
|
|
8348
9368
|
}
|
|
8349
9369
|
if (!ReflectApply$LWS$1(DOMTokenListProtoContains$LWS, sandboxTokenList$LWS, [ALLOW_SCRIPTS_TOKEN$LWS])) {
|
|
@@ -8382,7 +9402,7 @@
|
|
|
8382
9402
|
// FOLLOWING `iframe.src = ...` (or setAttribute('src',...) etc.)
|
|
8383
9403
|
// even though we cannot synchronously propagate the original
|
|
8384
9404
|
// hostile-detection back to its triggering setter call.
|
|
8385
|
-
if (isGaterEnabledFeature$LWS('
|
|
9405
|
+
if (isGaterEnabledFeature$LWS('iframeSrcSameOriginPreflightCheck') && isPoisonedIframe$LWS(this)) {
|
|
8386
9406
|
throw new LockerSecurityError$LWS('HTMLIFrameElement is poisoned: a prior src assignment fetched a body containing an attack pattern. The iframe cannot be reused.');
|
|
8387
9407
|
}
|
|
8388
9408
|
const normalizedSrcValue$LWS = toSafeStringValue$LWS(value$LWS);
|
|
@@ -8433,7 +9453,7 @@
|
|
|
8433
9453
|
// resolves. Pending URL is recorded normally so read paths
|
|
8434
9454
|
// (iframe.src, getAttribute('src'), attributes['src'].value)
|
|
8435
9455
|
// surface what sandbox code wrote.
|
|
8436
|
-
if (isGaterEnabledFeature$LWS('
|
|
9456
|
+
if (isGaterEnabledFeature$LWS('iframeSrcSameOriginPreflightCheck') && urlString$LWS !== '' && urlString$LWS !== ABOUT_BLANK_TOKEN$LWS && isSameOriginURL$LWS(urlString$LWS)) {
|
|
8437
9457
|
// Cross-iframe rejection cache: if any prior pre-flight
|
|
8438
9458
|
// (on this iframe or any other) detected an attack
|
|
8439
9459
|
// pattern at this URL's pathname, refuse the assignment
|
|
@@ -9034,7 +10054,14 @@
|
|
|
9034
10054
|
};
|
|
9035
10055
|
}
|
|
9036
10056
|
const descriptorCaches$LWS = toSafeWeakMap$LWS$1(new WeakMapCtor$LWS$1());
|
|
9037
|
-
function createBlockedAttributeSetterDistortionFactoryInitializer$LWS(Ctor$LWS, ctorName$LWS, attributeName$LWS) {
|
|
10057
|
+
function createBlockedAttributeSetterDistortionFactoryInitializer$LWS(Ctor$LWS, ctorName$LWS, attributeName$LWS, blockedTagName$LWS) {
|
|
10058
|
+
// When the interface has a single canonical HTML tag name (iframe, embed,
|
|
10059
|
+
// script), record it so a foreign generic node that would reparse into this
|
|
10060
|
+
// interface is still matched for this blocked attribute. See W-23590867 and
|
|
10061
|
+
// elementMatchesCtor's tag-name fallback.
|
|
10062
|
+
if (blockedTagName$LWS !== undefined) {
|
|
10063
|
+
registerBlockedAttributeTagName$LWS(Ctor$LWS, blockedTagName$LWS, attributeName$LWS);
|
|
10064
|
+
}
|
|
9038
10065
|
return function initDistortionBlockedAttribute$LWS() {
|
|
9039
10066
|
const enquotedAttributeName$LWS = enquote$LWS(attributeName$LWS);
|
|
9040
10067
|
const distortionName$LWS = `blocked${capitalizeFirstChar$LWS(attributeName$LWS)}Attribute`;
|
|
@@ -9093,14 +10120,14 @@
|
|
|
9093
10120
|
return valueThrowerDistortionFactory$LWS;
|
|
9094
10121
|
};
|
|
9095
10122
|
}
|
|
9096
|
-
function addBlockedAttributeSetterDistortionFactoryInitializers$LWS(Ctor$LWS, ctorName$LWS, attributes$LWS, factoryInitializers$LWS) {
|
|
10123
|
+
function addBlockedAttributeSetterDistortionFactoryInitializers$LWS(Ctor$LWS, ctorName$LWS, attributes$LWS, factoryInitializers$LWS, blockedTagName$LWS) {
|
|
9097
10124
|
let {
|
|
9098
10125
|
length: factoryInitializersOffset$LWS
|
|
9099
10126
|
} = factoryInitializers$LWS;
|
|
9100
10127
|
for (let i$LWS = 0, {
|
|
9101
10128
|
length: length$LWS
|
|
9102
10129
|
} = attributes$LWS; i$LWS < length$LWS; i$LWS += 1) {
|
|
9103
|
-
factoryInitializers$LWS[factoryInitializersOffset$LWS++] = createBlockedAttributeSetterDistortionFactoryInitializer$LWS(Ctor$LWS, ctorName$LWS, attributes$LWS[i$LWS]);
|
|
10130
|
+
factoryInitializers$LWS[factoryInitializersOffset$LWS++] = createBlockedAttributeSetterDistortionFactoryInitializer$LWS(Ctor$LWS, ctorName$LWS, attributes$LWS[i$LWS], blockedTagName$LWS);
|
|
9104
10131
|
}
|
|
9105
10132
|
}
|
|
9106
10133
|
// Read-side counterpart of createBlockedAttributeSetterDistortionFactoryInitializer:
|
|
@@ -9925,6 +10952,49 @@
|
|
|
9925
10952
|
}];
|
|
9926
10953
|
};
|
|
9927
10954
|
}
|
|
10955
|
+
function initDistortionNavigationNavigate$LWS({
|
|
10956
|
+
globalObject: globalObject$LWS
|
|
10957
|
+
}) {
|
|
10958
|
+
var _Navigation$prototype$LWS;
|
|
10959
|
+
// The Navigation API is not exposed in every browser LWS supports, so it is
|
|
10960
|
+
// read defensively rather than destructured (a missing `Navigation` global
|
|
10961
|
+
// would throw at factory-initialization time and break sandbox creation).
|
|
10962
|
+
const {
|
|
10963
|
+
Navigation: Navigation$LWS
|
|
10964
|
+
} = globalObject$LWS;
|
|
10965
|
+
const originalNavigate$LWS = Navigation$LWS == null || (_Navigation$prototype$LWS = Navigation$LWS.prototype) == null ? void 0 : _Navigation$prototype$LWS.navigate;
|
|
10966
|
+
return function distortionNavigationNavigate$LWS() {
|
|
10967
|
+
// Nothing to distort when the Navigation API is unavailable.
|
|
10968
|
+
if (originalNavigate$LWS === undefined) {
|
|
10969
|
+
return undefined;
|
|
10970
|
+
}
|
|
10971
|
+
const distortionEntry$LWS = [originalNavigate$LWS, function navigate$LWS(...args$LWS) {
|
|
10972
|
+
// `navigate(url)` has a required `url` argument. A zero-argument
|
|
10973
|
+
// call must reach the native method untouched so it throws its own
|
|
10974
|
+
// WebIDL "1 argument required" `TypeError`. Coercing the missing
|
|
10975
|
+
// argument would synthesize the string `"undefined"`, pin it into a
|
|
10976
|
+
// now-length-1 argument list below, and either navigate to a URL the
|
|
10977
|
+
// caller never supplied or throw the wrong error type. (A present
|
|
10978
|
+
// `null` / `undefined` *value* is left to native, which coerces it
|
|
10979
|
+
// to `"null"` / `"undefined"` and navigates — the required-argument
|
|
10980
|
+
// contract only concerns the missing case.)
|
|
10981
|
+
if (args$LWS.length > 0 && isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
10982
|
+
const parsedURL$LWS = parseURL$LWS(toSafeStringValue$LWS(args$LWS[0]));
|
|
10983
|
+
if (!isAllowedEndpointURL$LWS(parsedURL$LWS)) {
|
|
10984
|
+
throw new LockerSecurityError$LWS(`Cannot navigate to disallowed endpoint: ${toSafeTemplateStringValue$LWS(parsedURL$LWS.normalizedURL)}`);
|
|
10985
|
+
}
|
|
10986
|
+
// Pin the validated primitive so the native `navigate` cannot
|
|
10987
|
+
// re-run a shape-shifting argument's `toString` /
|
|
10988
|
+
// `Symbol.toPrimitive` and dispatch to a different (denylisted)
|
|
10989
|
+
// URL after the guard passed (TOCTOU). Mirrors `fetch`'s
|
|
10990
|
+
// `args[0] = url` arg-reassignment before dispatch.
|
|
10991
|
+
args$LWS[0] = parsedURL$LWS.normalizedURL;
|
|
10992
|
+
}
|
|
10993
|
+
return ReflectApply$LWS$1(originalNavigate$LWS, this, args$LWS);
|
|
10994
|
+
}];
|
|
10995
|
+
return distortionEntry$LWS;
|
|
10996
|
+
};
|
|
10997
|
+
}
|
|
9928
10998
|
function initDistortionNavigatorSendBeacon$LWS({
|
|
9929
10999
|
globalObject: {
|
|
9930
11000
|
Navigator: {
|
|
@@ -9963,6 +11033,95 @@
|
|
|
9963
11033
|
return distortionEntry$LWS;
|
|
9964
11034
|
};
|
|
9965
11035
|
}
|
|
11036
|
+
|
|
11037
|
+
// A genuine `<script>` reports `nodeName` "SCRIPT" (HTML) or "script" (SVG). The
|
|
11038
|
+
// value is read straight from the native `nodeName` accessor, so it is
|
|
11039
|
+
// unforgeable and cheap — used as a pre-filter before the brand-checking nonce
|
|
11040
|
+
// setter runs.
|
|
11041
|
+
const HTML_SCRIPT_NODE_NAME$LWS = 'SCRIPT';
|
|
11042
|
+
const SVG_SCRIPT_NODE_NAME$LWS = 'script';
|
|
11043
|
+
function initDistortionNodeCloneNode$LWS({
|
|
11044
|
+
globalObject: {
|
|
11045
|
+
Node: {
|
|
11046
|
+
prototype: {
|
|
11047
|
+
cloneNode: originalCloneNode$LWS
|
|
11048
|
+
}
|
|
11049
|
+
},
|
|
11050
|
+
HTMLElement: HTMLElement$LWS,
|
|
11051
|
+
SVGElement: SVGElement$LWS
|
|
11052
|
+
}
|
|
11053
|
+
}) {
|
|
11054
|
+
// The CSP `nonce` is exposed through the `nonce` IDL attribute, which comes
|
|
11055
|
+
// from the `HTMLOrSVGElement` WebIDL mixin. That mixin installs the accessor
|
|
11056
|
+
// as an OWN property of `HTMLElement.prototype` and `SVGElement.prototype`,
|
|
11057
|
+
// NOT of `HTMLScriptElement.prototype` (where it is merely inherited).
|
|
11058
|
+
// Capturing from the subclass prototype would yield `undefined` and turn this
|
|
11059
|
+
// distortion into a silent no-op, so the native setter is captured from the
|
|
11060
|
+
// mixin hosts. Applying that setter with '' is the only way to clear the
|
|
11061
|
+
// element's internal `[[CryptographicNonce]]` slot: the sandbox-facing
|
|
11062
|
+
// `.nonce` accessor is blocked (it throws) and therefore cannot clear it.
|
|
11063
|
+
const htmlNonceSetter$LWS = ObjectLookupOwnSetter$LWS(HTMLElement$LWS.prototype, 'nonce');
|
|
11064
|
+
const svgNonceSetter$LWS = ObjectLookupOwnSetter$LWS(SVGElement$LWS.prototype, 'nonce');
|
|
11065
|
+
function clearScriptNonce$LWS(node$LWS) {
|
|
11066
|
+
// Try the HTML setter first (the common `<script>` case), then the SVG
|
|
11067
|
+
// setter. Each native setter brand-checks its receiver, so applying the
|
|
11068
|
+
// wrong one simply throws and is safely ignored.
|
|
11069
|
+
if (htmlNonceSetter$LWS !== undefined) {
|
|
11070
|
+
try {
|
|
11071
|
+
ReflectApply$LWS$1(htmlNonceSetter$LWS, node$LWS, ['']);
|
|
11072
|
+
return;
|
|
11073
|
+
} catch (_unused7$LWS) {
|
|
11074
|
+
// Not an HTMLElement; fall through to the SVG setter.
|
|
11075
|
+
}
|
|
11076
|
+
}
|
|
11077
|
+
if (svgNonceSetter$LWS !== undefined) {
|
|
11078
|
+
try {
|
|
11079
|
+
ReflectApply$LWS$1(svgNonceSetter$LWS, node$LWS, ['']);
|
|
11080
|
+
} catch (_unused8$LWS) {
|
|
11081
|
+
// Not an SVGElement either; there is no nonce slot to clear.
|
|
11082
|
+
}
|
|
11083
|
+
}
|
|
11084
|
+
}
|
|
11085
|
+
function stripClonedScriptNonces$LWS(root$LWS) {
|
|
11086
|
+
// Iterative depth-first walk of the freshly cloned subtree. A shallow
|
|
11087
|
+
// clone copies no children, so the stack drains after visiting the single
|
|
11088
|
+
// root — matching native `cloneNode(false)` cost. `getNodeName` is a cheap
|
|
11089
|
+
// native read used as a pre-filter so the brand-checking `try/catch` in
|
|
11090
|
+
// `clearScriptNonce` runs only for the rare `<script>` node, keeping the
|
|
11091
|
+
// LWC template-cloning hot path fast.
|
|
11092
|
+
const stack$LWS = [root$LWS];
|
|
11093
|
+
while (stack$LWS.length > 0) {
|
|
11094
|
+
const node$LWS = stack$LWS.pop();
|
|
11095
|
+
const nodeName$LWS = getNodeName$LWS(node$LWS);
|
|
11096
|
+
if (nodeName$LWS === HTML_SCRIPT_NODE_NAME$LWS || nodeName$LWS === SVG_SCRIPT_NODE_NAME$LWS) {
|
|
11097
|
+
clearScriptNonce$LWS(node$LWS);
|
|
11098
|
+
}
|
|
11099
|
+
const childNodes$LWS = ReflectApply$LWS$1(NodeProtoChildNodesGetter$LWS, node$LWS, []);
|
|
11100
|
+
for (let i$LWS = 0, {
|
|
11101
|
+
length: length$LWS
|
|
11102
|
+
} = childNodes$LWS; i$LWS < length$LWS; i$LWS += 1) {
|
|
11103
|
+
stack$LWS[stack$LWS.length] = childNodes$LWS[i$LWS];
|
|
11104
|
+
}
|
|
11105
|
+
}
|
|
11106
|
+
}
|
|
11107
|
+
const distortionEntry$LWS = [originalCloneNode$LWS, function cloneNode$LWS(...args$LWS) {
|
|
11108
|
+
const result$LWS = ReflectApply$LWS$1(originalCloneNode$LWS, this, args$LWS);
|
|
11109
|
+
// W-23859662: Chromium's node-cloning steps copy a script element's
|
|
11110
|
+
// internal `[[CryptographicNonce]]` slot to the clone. That slot is
|
|
11111
|
+
// NOT a content attribute, so the sandbox's `.nonce` property/attribute
|
|
11112
|
+
// block never touches it — the clone would otherwise carry a CSP-valid
|
|
11113
|
+
// nonce the sandbox could never have produced, letting it run a forged
|
|
11114
|
+
// inline script natively in the host realm. Strip the nonce from every
|
|
11115
|
+
// cloned script element to close that bypass.
|
|
11116
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
11117
|
+
stripClonedScriptNonces$LWS(result$LWS);
|
|
11118
|
+
}
|
|
11119
|
+
return result$LWS;
|
|
11120
|
+
}];
|
|
11121
|
+
return function distortionNodeCloneNode$LWS() {
|
|
11122
|
+
return distortionEntry$LWS;
|
|
11123
|
+
};
|
|
11124
|
+
}
|
|
9966
11125
|
function initDistortionNodeGetRootNode$LWS({
|
|
9967
11126
|
globalObject: {
|
|
9968
11127
|
Node: Node$LWS,
|
|
@@ -10033,6 +11192,22 @@
|
|
|
10033
11192
|
const originalNodeValueSetter$LWS = ObjectLookupOwnSetter$LWS(Node$LWS.prototype, 'nodeValue');
|
|
10034
11193
|
return function distortionNodeValueSetter$LWS(record$LWS) {
|
|
10035
11194
|
return [originalNodeValueSetter$LWS, function nodeValue$LWS(value$LWS) {
|
|
11195
|
+
// W-23596015: `nodeValue` aliases `Attr.prototype.value`, so it
|
|
11196
|
+
// shares the same reentrant Attr owner-state TOCTOU. Coerce
|
|
11197
|
+
// `value` to a string EXACTLY ONCE, up front — before reading
|
|
11198
|
+
// `ownerElement` — so the routing decision is made against the
|
|
11199
|
+
// resolved string. Otherwise a `{ toString() {...} }` value
|
|
11200
|
+
// reaches the native setter unconverted, and native WebIDL
|
|
11201
|
+
// DOMString coercion runs the attacker's `toString()` AFTER LWS
|
|
11202
|
+
// has committed to a route (native passthrough for a detached
|
|
11203
|
+
// Attr, or a no-distortion element); that reentrant call can
|
|
11204
|
+
// attach the Attr to a <script> so the final value lands via a
|
|
11205
|
+
// raw native write that skips the script-`src` distortion.
|
|
11206
|
+
// Coercing first makes any such reentrant attach visible to the
|
|
11207
|
+
// `ownerElement` read below. `null`/`undefined` pass through
|
|
11208
|
+
// untouched so the native setter keeps its nullable-`DOMString?`
|
|
11209
|
+
// "treat as the empty string" behavior.
|
|
11210
|
+
const coercedValue$LWS = isGaterEnabledFeature$LWS('changesSince.266') && value$LWS !== null && value$LWS !== undefined ? toSafeStringValue$LWS(value$LWS) : value$LWS;
|
|
10036
11211
|
// W-10476944 Window access via nodeValue/textContent:
|
|
10037
11212
|
// This distortion sanitizes the given text to prevent window
|
|
10038
11213
|
// access from being achieved via the nodeValue property.
|
|
@@ -10040,21 +11215,21 @@
|
|
|
10040
11215
|
if (this instanceof Attr$LWS) {
|
|
10041
11216
|
const ownerEl$LWS = ReflectApply$LWS$1(AttrProtoOwnerElementGetter$LWS, this, []);
|
|
10042
11217
|
if (ownerEl$LWS === null) {
|
|
10043
|
-
ReflectApply$LWS$1(originalNodeValueSetter$LWS, this, [
|
|
11218
|
+
ReflectApply$LWS$1(originalNodeValueSetter$LWS, this, [coercedValue$LWS]);
|
|
10044
11219
|
return;
|
|
10045
11220
|
}
|
|
10046
|
-
const attrName$LWS = ReflectApply$LWS$1(AttrProtoNameGetter$LWS, this, []);
|
|
11221
|
+
const attrName$LWS = normalizeAttributeName$LWS(ReflectApply$LWS$1(AttrProtoNameGetter$LWS, this, []));
|
|
10047
11222
|
const attrNamespace$LWS = ReflectApply$LWS$1(AttrProtoNamespaceURIGetter$LWS, this, []);
|
|
10048
11223
|
const normalizedNamespace$LWS = normalizeNamespace$LWS(attrNamespace$LWS);
|
|
10049
11224
|
const distortion$LWS = getAttributeSetterDistortion$LWS(record$LWS, ownerEl$LWS, attrName$LWS, normalizedNamespace$LWS);
|
|
10050
11225
|
// istanbul ignore next: needs default platform behavior test
|
|
10051
11226
|
if (distortion$LWS) {
|
|
10052
|
-
ReflectApply$LWS$1(distortion$LWS, ownerEl$LWS, [
|
|
11227
|
+
ReflectApply$LWS$1(distortion$LWS, ownerEl$LWS, [coercedValue$LWS]);
|
|
10053
11228
|
return;
|
|
10054
11229
|
}
|
|
10055
11230
|
}
|
|
10056
11231
|
// istanbul ignore next: needs default platform behavior test
|
|
10057
|
-
ReflectApply$LWS$1(originalNodeValueSetter$LWS, this, [
|
|
11232
|
+
ReflectApply$LWS$1(originalNodeValueSetter$LWS, this, [coercedValue$LWS]);
|
|
10058
11233
|
}];
|
|
10059
11234
|
};
|
|
10060
11235
|
}
|
|
@@ -10237,7 +11412,24 @@
|
|
|
10237
11412
|
sandboxEvaluator: sandboxEvaluator$LWS
|
|
10238
11413
|
} = record$LWS;
|
|
10239
11414
|
return [originalTextContentSetter$LWS, function textContent$LWS(value$LWS) {
|
|
10240
|
-
|
|
11415
|
+
// W-23596015: `textContent` aliases `Attr.prototype.value` on an
|
|
11416
|
+
// Attr, so it shares the same reentrant Attr owner-state TOCTOU.
|
|
11417
|
+
// `trusted.createScript` only performs a DOMString coercion on
|
|
11418
|
+
// engines that support Trusted Types; on a TT-less engine the
|
|
11419
|
+
// fallback policy returns its argument unchanged, so a
|
|
11420
|
+
// `{ toString() {...} }` value would reach the native setter
|
|
11421
|
+
// unconverted and native WebIDL DOMString coercion would run the
|
|
11422
|
+
// attacker's `toString()` AFTER LWS committed to a route,
|
|
11423
|
+
// letting it reentrantly attach the Attr to a <script> and land
|
|
11424
|
+
// the final value via a raw native write that skips the
|
|
11425
|
+
// script-`src` distortion. Coerce `value` to a string EXACTLY
|
|
11426
|
+
// ONCE, up front, so the coercion is DOMString-strength on every
|
|
11427
|
+
// engine and any reentrant attach is visible to the
|
|
11428
|
+
// `ownerElement` read below. `null`/`undefined` pass through
|
|
11429
|
+
// untouched so the native setter keeps its nullable-`DOMString?`
|
|
11430
|
+
// "treat as the empty string" behavior.
|
|
11431
|
+
const coercedValue$LWS = isGaterEnabledFeature$LWS('changesSince.266') && value$LWS !== null && value$LWS !== undefined ? toSafeStringValue$LWS(value$LWS) : value$LWS;
|
|
11432
|
+
const valueAsString$LWS = trusted.createScript(coercedValue$LWS);
|
|
10241
11433
|
// There are two existence of the attribute textContent, one on
|
|
10242
11434
|
// Attr and one on Node. This first if statement is checking to
|
|
10243
11435
|
// figure out which distortion should be applied. The instanceof
|
|
@@ -10254,7 +11446,7 @@
|
|
|
10254
11446
|
ReflectApply$LWS$1(originalTextContentSetter$LWS, this, [valueAsString$LWS]);
|
|
10255
11447
|
return;
|
|
10256
11448
|
}
|
|
10257
|
-
const attrName$LWS = ReflectApply$LWS$1(AttrProtoNameGetter$LWS, this, []);
|
|
11449
|
+
const attrName$LWS = normalizeAttributeName$LWS(ReflectApply$LWS$1(AttrProtoNameGetter$LWS, this, []));
|
|
10258
11450
|
const attrNamespace$LWS = ReflectApply$LWS$1(AttrProtoNamespaceURIGetter$LWS, this, []);
|
|
10259
11451
|
const normalizedNamespace$LWS = normalizeNamespace$LWS(attrNamespace$LWS);
|
|
10260
11452
|
const distortion$LWS = getAttributeSetterDistortion$LWS(record$LWS, ownerEl$LWS, attrName$LWS, normalizedNamespace$LWS);
|
|
@@ -11307,16 +12499,21 @@
|
|
|
11307
12499
|
// substitutes the callee before binding it. Returning an object from a
|
|
11308
12500
|
// constructor call short-circuits [[Construct]] (ECMAScript 10.2.2) so this
|
|
11309
12501
|
// behaves identically whether reached via `new`, Reflect.construct, or a
|
|
11310
|
-
// .call/.apply/.bind chain on the constructor itself.
|
|
12502
|
+
// .call/.apply/.bind chain on the constructor itself. (`new cw.Proxy(...)` is
|
|
12503
|
+
// separately contained by near-membrane's non-constructible arrow shadow; the
|
|
12504
|
+
// reachable doorway for this distortion is Reflect.construct(cw.Proxy, ...).)
|
|
12505
|
+
//
|
|
12506
|
+
// W-24124284: the HANDLER is substituted the same way (substituteDistorted
|
|
12507
|
+
// Handler). A raw callable smuggled as a handler trap (e.g.
|
|
12508
|
+
// `{ getPrototypeOf: Function }`) is otherwise invoked UNDISTORTED by the
|
|
12509
|
+
// engine's internal trap dispatch and leaks the raw document.cookie, exactly
|
|
12510
|
+
// as it does for Proxy.revocable (Proxy/revocable-value.ts) -- the target-only
|
|
12511
|
+
// substitution never covered it.
|
|
11311
12512
|
//
|
|
11312
12513
|
// Gated on changesSince.266: this is new distortion behavior, distinct from
|
|
11313
12514
|
// getDistortableFrameElement's own changesSince.264 gate on the underlying
|
|
11314
12515
|
// cross-realm scoping helper.
|
|
11315
|
-
function initDistortionProxyCtor$LWS({
|
|
11316
|
-
globalObject: {
|
|
11317
|
-
Proxy: originalProxyCtor$LWS
|
|
11318
|
-
}
|
|
11319
|
-
}) {
|
|
12516
|
+
function initDistortionProxyCtor$LWS() {
|
|
11320
12517
|
return function distortionProxyCtor$LWS({
|
|
11321
12518
|
globalObject: globalObject$LWS,
|
|
11322
12519
|
root: root$LWS
|
|
@@ -11324,8 +12521,15 @@
|
|
|
11324
12521
|
if (!isGaterEnabledFeature$LWS('changesSince.266') || !getDistortableFrameElement$LWS(globalObject$LWS)) {
|
|
11325
12522
|
return undefined;
|
|
11326
12523
|
}
|
|
12524
|
+
// W-24222894: read the primitive AFTER the gate, per the capture-after-
|
|
12525
|
+
// gate invariant in Function/cross-realm-invocation.ts. Unlike its
|
|
12526
|
+
// Proxy.revocable sibling's deeper read, this shallow `globalObject.Proxy`
|
|
12527
|
+
// read would not itself throw on a transitional secondary-window realm,
|
|
12528
|
+
// but keeping the read inside the gated factory holds every capture
|
|
12529
|
+
// primitive to one rule.
|
|
12530
|
+
const originalProxyCtor$LWS = globalObject$LWS.Proxy;
|
|
11327
12531
|
return [originalProxyCtor$LWS, function Proxy$LWS(target$LWS, handler$LWS) {
|
|
11328
|
-
return new ProxyCtor$LWS(substituteDistortedCallee$LWS(root$LWS, target$LWS), handler$LWS);
|
|
12532
|
+
return new ProxyCtor$LWS(substituteDistortedCallee$LWS(root$LWS, target$LWS), substituteDistortedHandler$LWS(root$LWS, handler$LWS));
|
|
11329
12533
|
}];
|
|
11330
12534
|
};
|
|
11331
12535
|
}
|
|
@@ -11345,13 +12549,7 @@
|
|
|
11345
12549
|
// Gated on changesSince.266: this is new distortion behavior, distinct from
|
|
11346
12550
|
// getDistortableFrameElement's own changesSince.264 gate on the underlying
|
|
11347
12551
|
// cross-realm scoping helper.
|
|
11348
|
-
function initDistortionProxyRevocable$LWS({
|
|
11349
|
-
globalObject: {
|
|
11350
|
-
Proxy: {
|
|
11351
|
-
revocable: originalRevocable$LWS
|
|
11352
|
-
}
|
|
11353
|
-
}
|
|
11354
|
-
}) {
|
|
12552
|
+
function initDistortionProxyRevocable$LWS() {
|
|
11355
12553
|
return function distortionProxyRevocable$LWS({
|
|
11356
12554
|
globalObject: globalObject$LWS,
|
|
11357
12555
|
root: root$LWS
|
|
@@ -11359,8 +12557,17 @@
|
|
|
11359
12557
|
if (!isGaterEnabledFeature$LWS('changesSince.266') || !getDistortableFrameElement$LWS(globalObject$LWS)) {
|
|
11360
12558
|
return undefined;
|
|
11361
12559
|
}
|
|
12560
|
+
// W-24222894: read the primitive AFTER the gate — never in the outer
|
|
12561
|
+
// initializer's parameter. The initializer runs for EVERY record built,
|
|
12562
|
+
// including a transitional secondary-window realm (e.g. a freshly
|
|
12563
|
+
// window.open()'d same-origin window still materializing) whose Proxy is
|
|
12564
|
+
// momentarily undefined; the deep `Proxy.revocable` outer read
|
|
12565
|
+
// dereferences that undefined before this gate can bail and throws,
|
|
12566
|
+
// exactly as it did for Function.prototype.apply. See
|
|
12567
|
+
// ../Function/cross-realm-invocation.ts.
|
|
12568
|
+
const originalRevocable$LWS = globalObject$LWS.Proxy.revocable;
|
|
11362
12569
|
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]);
|
|
12570
|
+
return ReflectApply$LWS$1(originalRevocable$LWS, undefined, [substituteDistortedCallee$LWS(root$LWS, target$LWS), substituteDistortedHandler$LWS(root$LWS, handler$LWS)]);
|
|
11364
12571
|
}];
|
|
11365
12572
|
};
|
|
11366
12573
|
}
|
|
@@ -11370,19 +12577,32 @@
|
|
|
11370
12577
|
function initDistortionRangeCloneContents$LWS({
|
|
11371
12578
|
globalObject: {
|
|
11372
12579
|
AbstractRange: AbstractRange$LWS,
|
|
11373
|
-
Range:
|
|
11374
|
-
|
|
11375
|
-
|
|
11376
|
-
|
|
11377
|
-
|
|
11378
|
-
|
|
11379
|
-
|
|
12580
|
+
Range: Range$LWS
|
|
12581
|
+
}
|
|
12582
|
+
}) {
|
|
12583
|
+
// endContainer/startContainer have migrated across the Range interface
|
|
12584
|
+
// hierarchy over time:
|
|
12585
|
+
// Chrome <= 89: defined on Range.prototype
|
|
12586
|
+
// Chrome 90-151: defined on AbstractRange.prototype
|
|
12587
|
+
// Chrome >= 152: defined on NodeRange.prototype (a new interface
|
|
12588
|
+
// inserted as Range -> NodeRange -> AbstractRange)
|
|
12589
|
+
// walkRangeProtoChainForMethods (default on) walks up from the realm's own
|
|
12590
|
+
// Range.prototype so the accessors resolve wherever the platform currently
|
|
12591
|
+
// defines them; disabling it restores the legacy own-property lookup on
|
|
12592
|
+
// AbstractRange.prototype (broken on Chrome >= 152).
|
|
12593
|
+
const walkRangeProtoChain$LWS = isGaterEnabledFeature$LWS('walkRangeProtoChainForMethods');
|
|
12594
|
+
const {
|
|
12595
|
+
prototype: RangeProto$LWS
|
|
12596
|
+
} = Range$LWS;
|
|
12597
|
+
const {
|
|
12598
|
+
cloneContents: originalCloneContents$LWS
|
|
12599
|
+
} = RangeProto$LWS;
|
|
11380
12600
|
// istanbul ignore next: the null path and right side of the expression for this code is not reachable in the version of chrome used to measure coverage.
|
|
11381
12601
|
const {
|
|
11382
12602
|
prototype: AbstractRangeProto$LWS
|
|
11383
|
-
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
|
|
11384
|
-
const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
11385
|
-
const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
12603
|
+
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range$LWS;
|
|
12604
|
+
const originalEndContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'endContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
12605
|
+
const originalStartContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'startContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
11386
12606
|
const distortionEntry$LWS = [originalCloneContents$LWS, function cloneContents$LWS(...args$LWS) {
|
|
11387
12607
|
if (isGaterEnabledFeature$LWS('changesSince.262')) {
|
|
11388
12608
|
const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
|
|
@@ -11407,19 +12627,32 @@
|
|
|
11407
12627
|
function initDistortionRangeCloneRange$LWS({
|
|
11408
12628
|
globalObject: {
|
|
11409
12629
|
AbstractRange: AbstractRange$LWS,
|
|
11410
|
-
Range:
|
|
11411
|
-
|
|
11412
|
-
|
|
11413
|
-
|
|
11414
|
-
|
|
11415
|
-
|
|
11416
|
-
|
|
12630
|
+
Range: Range$LWS
|
|
12631
|
+
}
|
|
12632
|
+
}) {
|
|
12633
|
+
// endContainer/startContainer have migrated across the Range interface
|
|
12634
|
+
// hierarchy over time:
|
|
12635
|
+
// Chrome <= 89: defined on Range.prototype
|
|
12636
|
+
// Chrome 90-151: defined on AbstractRange.prototype
|
|
12637
|
+
// Chrome >= 152: defined on NodeRange.prototype (a new interface
|
|
12638
|
+
// inserted as Range -> NodeRange -> AbstractRange)
|
|
12639
|
+
// walkRangeProtoChainForMethods (default on) walks up from the realm's own
|
|
12640
|
+
// Range.prototype so the accessors resolve wherever the platform currently
|
|
12641
|
+
// defines them; disabling it restores the legacy own-property lookup on
|
|
12642
|
+
// AbstractRange.prototype (broken on Chrome >= 152).
|
|
12643
|
+
const walkRangeProtoChain$LWS = isGaterEnabledFeature$LWS('walkRangeProtoChainForMethods');
|
|
12644
|
+
const {
|
|
12645
|
+
prototype: RangeProto$LWS
|
|
12646
|
+
} = Range$LWS;
|
|
12647
|
+
const {
|
|
12648
|
+
cloneRange: originalCloneRange$LWS
|
|
12649
|
+
} = RangeProto$LWS;
|
|
11417
12650
|
// istanbul ignore next: the null path and right side of the expression for this code is not reachable in the version of chrome used to measure coverage.
|
|
11418
12651
|
const {
|
|
11419
12652
|
prototype: AbstractRangeProto$LWS
|
|
11420
|
-
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
|
|
11421
|
-
const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
11422
|
-
const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
12653
|
+
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range$LWS;
|
|
12654
|
+
const originalEndContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'endContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
12655
|
+
const originalStartContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'startContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
11423
12656
|
const distortionEntry$LWS = [originalCloneRange$LWS, function cloneRange$LWS(...args$LWS) {
|
|
11424
12657
|
if (isGaterEnabledFeature$LWS('changesSince.262')) {
|
|
11425
12658
|
const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
|
|
@@ -11481,24 +12714,32 @@
|
|
|
11481
12714
|
function initDistortionRangeDeleteContents$LWS({
|
|
11482
12715
|
globalObject: {
|
|
11483
12716
|
AbstractRange: AbstractRange$LWS,
|
|
11484
|
-
Range:
|
|
11485
|
-
|
|
11486
|
-
|
|
11487
|
-
|
|
11488
|
-
|
|
11489
|
-
|
|
11490
|
-
|
|
11491
|
-
//
|
|
11492
|
-
//
|
|
11493
|
-
//
|
|
11494
|
-
//
|
|
11495
|
-
//
|
|
12717
|
+
Range: Range$LWS
|
|
12718
|
+
}
|
|
12719
|
+
}) {
|
|
12720
|
+
// endContainer/startContainer have migrated across the Range interface
|
|
12721
|
+
// hierarchy over time:
|
|
12722
|
+
// Chrome <= 89: defined on Range.prototype
|
|
12723
|
+
// Chrome 90-151: defined on AbstractRange.prototype
|
|
12724
|
+
// Chrome >= 152: defined on NodeRange.prototype (a new interface
|
|
12725
|
+
// inserted as Range -> NodeRange -> AbstractRange)
|
|
12726
|
+
// walkRangeProtoChainForMethods (default on) walks up from the realm's own
|
|
12727
|
+
// Range.prototype so the accessors resolve wherever the platform currently
|
|
12728
|
+
// defines them; disabling it restores the legacy own-property lookup on
|
|
12729
|
+
// AbstractRange.prototype (broken on Chrome >= 152).
|
|
12730
|
+
const walkRangeProtoChain$LWS = isGaterEnabledFeature$LWS('walkRangeProtoChainForMethods');
|
|
12731
|
+
const {
|
|
12732
|
+
prototype: RangeProto$LWS
|
|
12733
|
+
} = Range$LWS;
|
|
12734
|
+
const {
|
|
12735
|
+
deleteContents: originalDeleteContents$LWS
|
|
12736
|
+
} = RangeProto$LWS;
|
|
11496
12737
|
// istanbul ignore next: the null path and right side of the expression for this code is not reachable in the version of chrome used to measure coverage.
|
|
11497
12738
|
const {
|
|
11498
12739
|
prototype: AbstractRangeProto$LWS
|
|
11499
|
-
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
|
|
11500
|
-
const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
11501
|
-
const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
12740
|
+
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range$LWS;
|
|
12741
|
+
const originalEndContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'endContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
12742
|
+
const originalStartContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'startContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
11502
12743
|
const distortionEntry$LWS = [originalDeleteContents$LWS, function deleteContents$LWS(...args$LWS) {
|
|
11503
12744
|
const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
|
|
11504
12745
|
for (let i$LWS = 0, {
|
|
@@ -11521,24 +12762,32 @@
|
|
|
11521
12762
|
function initDistortionRangeExtractContents$LWS({
|
|
11522
12763
|
globalObject: {
|
|
11523
12764
|
AbstractRange: AbstractRange$LWS,
|
|
11524
|
-
Range:
|
|
11525
|
-
|
|
11526
|
-
|
|
11527
|
-
|
|
11528
|
-
|
|
11529
|
-
|
|
11530
|
-
|
|
11531
|
-
//
|
|
11532
|
-
//
|
|
11533
|
-
//
|
|
11534
|
-
//
|
|
11535
|
-
//
|
|
12765
|
+
Range: Range$LWS
|
|
12766
|
+
}
|
|
12767
|
+
}) {
|
|
12768
|
+
// endContainer/startContainer have migrated across the Range interface
|
|
12769
|
+
// hierarchy over time:
|
|
12770
|
+
// Chrome <= 89: defined on Range.prototype
|
|
12771
|
+
// Chrome 90-151: defined on AbstractRange.prototype
|
|
12772
|
+
// Chrome >= 152: defined on NodeRange.prototype (a new interface
|
|
12773
|
+
// inserted as Range -> NodeRange -> AbstractRange)
|
|
12774
|
+
// walkRangeProtoChainForMethods (default on) walks up from the realm's own
|
|
12775
|
+
// Range.prototype so the accessors resolve wherever the platform currently
|
|
12776
|
+
// defines them; disabling it restores the legacy own-property lookup on
|
|
12777
|
+
// AbstractRange.prototype (broken on Chrome >= 152).
|
|
12778
|
+
const walkRangeProtoChain$LWS = isGaterEnabledFeature$LWS('walkRangeProtoChainForMethods');
|
|
12779
|
+
const {
|
|
12780
|
+
prototype: RangeProto$LWS
|
|
12781
|
+
} = Range$LWS;
|
|
12782
|
+
const {
|
|
12783
|
+
extractContents: originalExtractContents$LWS
|
|
12784
|
+
} = RangeProto$LWS;
|
|
11536
12785
|
// istanbul ignore next: the null path and right side of the expression for this code is not reachable in the version of chrome used to measure coverage.
|
|
11537
12786
|
const {
|
|
11538
12787
|
prototype: AbstractRangeProto$LWS
|
|
11539
|
-
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
|
|
11540
|
-
const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
11541
|
-
const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
12788
|
+
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range$LWS;
|
|
12789
|
+
const originalEndContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'endContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
12790
|
+
const originalStartContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'startContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
11542
12791
|
const distortionEntry$LWS = [originalExtractContents$LWS, function extractContents$LWS(...args$LWS) {
|
|
11543
12792
|
const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
|
|
11544
12793
|
for (let i$LWS = 0, {
|
|
@@ -11561,19 +12810,32 @@
|
|
|
11561
12810
|
function initDistortionRangeGetBoundingClientRect$LWS({
|
|
11562
12811
|
globalObject: {
|
|
11563
12812
|
AbstractRange: AbstractRange$LWS,
|
|
11564
|
-
Range:
|
|
11565
|
-
|
|
11566
|
-
|
|
11567
|
-
|
|
11568
|
-
|
|
11569
|
-
|
|
11570
|
-
|
|
12813
|
+
Range: Range$LWS
|
|
12814
|
+
}
|
|
12815
|
+
}) {
|
|
12816
|
+
// endContainer/startContainer have migrated across the Range interface
|
|
12817
|
+
// hierarchy over time:
|
|
12818
|
+
// Chrome <= 89: defined on Range.prototype
|
|
12819
|
+
// Chrome 90-151: defined on AbstractRange.prototype
|
|
12820
|
+
// Chrome >= 152: defined on NodeRange.prototype (a new interface
|
|
12821
|
+
// inserted as Range -> NodeRange -> AbstractRange)
|
|
12822
|
+
// walkRangeProtoChainForMethods (default on) walks up from the realm's own
|
|
12823
|
+
// Range.prototype so the accessors resolve wherever the platform currently
|
|
12824
|
+
// defines them; disabling it restores the legacy own-property lookup on
|
|
12825
|
+
// AbstractRange.prototype (broken on Chrome >= 152).
|
|
12826
|
+
const walkRangeProtoChain$LWS = isGaterEnabledFeature$LWS('walkRangeProtoChainForMethods');
|
|
12827
|
+
const {
|
|
12828
|
+
prototype: RangeProto$LWS
|
|
12829
|
+
} = Range$LWS;
|
|
12830
|
+
const {
|
|
12831
|
+
getBoundingClientRect: originalGetBoundingClientRect$LWS
|
|
12832
|
+
} = RangeProto$LWS;
|
|
11571
12833
|
// istanbul ignore next: the null path and right side of the expression for this code is not reachable in the version of chrome used to measure coverage.
|
|
11572
12834
|
const {
|
|
11573
12835
|
prototype: AbstractRangeProto$LWS
|
|
11574
|
-
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
|
|
11575
|
-
const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
11576
|
-
const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
12836
|
+
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range$LWS;
|
|
12837
|
+
const originalEndContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'endContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
12838
|
+
const originalStartContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'startContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
11577
12839
|
const distortionEntry$LWS = [originalGetBoundingClientRect$LWS, function getBoundingClientRect$LWS(...args$LWS) {
|
|
11578
12840
|
if (isGaterEnabledFeature$LWS('changesSince.262')) {
|
|
11579
12841
|
const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
|
|
@@ -11677,19 +12939,32 @@
|
|
|
11677
12939
|
function initDistortionRangeToString$LWS({
|
|
11678
12940
|
globalObject: {
|
|
11679
12941
|
AbstractRange: AbstractRange$LWS,
|
|
11680
|
-
Range:
|
|
11681
|
-
|
|
11682
|
-
|
|
11683
|
-
|
|
11684
|
-
|
|
11685
|
-
|
|
11686
|
-
|
|
12942
|
+
Range: Range$LWS
|
|
12943
|
+
}
|
|
12944
|
+
}) {
|
|
12945
|
+
// endContainer/startContainer have migrated across the Range interface
|
|
12946
|
+
// hierarchy over time:
|
|
12947
|
+
// Chrome <= 89: defined on Range.prototype
|
|
12948
|
+
// Chrome 90-151: defined on AbstractRange.prototype
|
|
12949
|
+
// Chrome >= 152: defined on NodeRange.prototype (a new interface
|
|
12950
|
+
// inserted as Range -> NodeRange -> AbstractRange)
|
|
12951
|
+
// walkRangeProtoChainForMethods (default on) walks up from the realm's own
|
|
12952
|
+
// Range.prototype so the accessors resolve wherever the platform currently
|
|
12953
|
+
// defines them; disabling it restores the legacy own-property lookup on
|
|
12954
|
+
// AbstractRange.prototype (broken on Chrome >= 152).
|
|
12955
|
+
const walkRangeProtoChain$LWS = isGaterEnabledFeature$LWS('walkRangeProtoChainForMethods');
|
|
12956
|
+
const {
|
|
12957
|
+
prototype: RangeProto$LWS
|
|
12958
|
+
} = Range$LWS;
|
|
12959
|
+
const {
|
|
12960
|
+
toString: originalRangeToString$LWS
|
|
12961
|
+
} = RangeProto$LWS;
|
|
11687
12962
|
// istanbul ignore next: the null path and right side of the expression for this code is not reachable in the version of chrome used to measure coverage.
|
|
11688
12963
|
const {
|
|
11689
12964
|
prototype: AbstractRangeProto$LWS
|
|
11690
|
-
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range;
|
|
11691
|
-
const originalEndContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
11692
|
-
const originalStartContainerGetter$LWS = ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
12965
|
+
} = AbstractRange$LWS != null ? AbstractRange$LWS : Range$LWS;
|
|
12966
|
+
const originalEndContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'endContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'endContainer');
|
|
12967
|
+
const originalStartContainerGetter$LWS = walkRangeProtoChain$LWS ? ObjectLookupGetter$LWS(RangeProto$LWS, 'startContainer') : ObjectLookupOwnGetter$LWS$1(AbstractRangeProto$LWS, 'startContainer');
|
|
11693
12968
|
const distortionEntry$LWS = [originalRangeToString$LWS, function toString$LWS(...args$LWS) {
|
|
11694
12969
|
if (isGaterEnabledFeature$LWS('changesSince.262')) {
|
|
11695
12970
|
const containers$LWS = [ReflectApply$LWS$1(originalEndContainerGetter$LWS, this, []), ReflectApply$LWS$1(originalStartContainerGetter$LWS, this, [])];
|
|
@@ -11715,13 +12990,7 @@
|
|
|
11715
12990
|
// Unlike Function.prototype.apply, the callee is the FIRST ARGUMENT (not
|
|
11716
12991
|
// `this`) and the invocation never routes through Function.prototype.call, so
|
|
11717
12992
|
// it is an independent doorway that must be distorted separately.
|
|
11718
|
-
function initDistortionReflectApply$LWS({
|
|
11719
|
-
globalObject: {
|
|
11720
|
-
Reflect: {
|
|
11721
|
-
apply: originalReflectApply$LWS
|
|
11722
|
-
}
|
|
11723
|
-
}
|
|
11724
|
-
}) {
|
|
12993
|
+
function initDistortionReflectApply$LWS() {
|
|
11725
12994
|
return function distortionReflectApply$LWS({
|
|
11726
12995
|
globalObject: globalObject$LWS,
|
|
11727
12996
|
root: root$LWS
|
|
@@ -11729,6 +12998,11 @@
|
|
|
11729
12998
|
if (!getDistortableFrameElement$LWS(globalObject$LWS)) {
|
|
11730
12999
|
return undefined;
|
|
11731
13000
|
}
|
|
13001
|
+
// W-24222894: read the primitive AFTER the gate. See
|
|
13002
|
+
// ../Function/apply-value.ts and ../Function/cross-realm-invocation.ts
|
|
13003
|
+
// for why an eager outer-parameter read crashes on a transitional
|
|
13004
|
+
// secondary-window realm.
|
|
13005
|
+
const originalReflectApply$LWS = globalObject$LWS.Reflect.apply;
|
|
11732
13006
|
return [originalReflectApply$LWS, function apply$LWS(target$LWS, thisArg$LWS, argsArray$LWS) {
|
|
11733
13007
|
return ReflectApply$LWS$1(substituteDistortedCallee$LWS(root$LWS, target$LWS), thisArg$LWS, argsArray$LWS == null ? [] : argsArray$LWS);
|
|
11734
13008
|
}];
|
|
@@ -11742,13 +13016,7 @@
|
|
|
11742
13016
|
// invoked as a constructor. Substitute it for its distorted counterpart, then
|
|
11743
13017
|
// construct with the sandbox-realm Reflect.construct, preserving the optional
|
|
11744
13018
|
// newTarget argument.
|
|
11745
|
-
function initDistortionReflectConstruct$LWS({
|
|
11746
|
-
globalObject: {
|
|
11747
|
-
Reflect: {
|
|
11748
|
-
construct: originalReflectConstruct$LWS
|
|
11749
|
-
}
|
|
11750
|
-
}
|
|
11751
|
-
}) {
|
|
13019
|
+
function initDistortionReflectConstruct$LWS() {
|
|
11752
13020
|
return function distortionReflectConstruct$LWS({
|
|
11753
13021
|
globalObject: globalObject$LWS,
|
|
11754
13022
|
root: root$LWS
|
|
@@ -11756,6 +13024,11 @@
|
|
|
11756
13024
|
if (!getDistortableFrameElement$LWS(globalObject$LWS)) {
|
|
11757
13025
|
return undefined;
|
|
11758
13026
|
}
|
|
13027
|
+
// W-24222894: read the primitive AFTER the gate. See
|
|
13028
|
+
// ../Function/apply-value.ts and ../Function/cross-realm-invocation.ts
|
|
13029
|
+
// for why an eager outer-parameter read crashes on a transitional
|
|
13030
|
+
// secondary-window realm.
|
|
13031
|
+
const originalReflectConstruct$LWS = globalObject$LWS.Reflect.construct;
|
|
11759
13032
|
return [originalReflectConstruct$LWS, function construct$LWS(target$LWS, argsArray$LWS, newTarget$LWS) {
|
|
11760
13033
|
const substituted$LWS = substituteDistortedCallee$LWS(root$LWS, target$LWS);
|
|
11761
13034
|
if (arguments.length > 2) {
|
|
@@ -11891,7 +13164,7 @@
|
|
|
11891
13164
|
}
|
|
11892
13165
|
current$LWS = ReflectGetPrototypeOf$LWS$1(current$LWS);
|
|
11893
13166
|
}
|
|
11894
|
-
} catch (
|
|
13167
|
+
} catch (_unused9$LWS) {
|
|
11895
13168
|
// Not the confused-deputy path: defer to native below.
|
|
11896
13169
|
}
|
|
11897
13170
|
if (distortedGetter$LWS !== undefined) {
|
|
@@ -11966,6 +13239,57 @@
|
|
|
11966
13239
|
return distortionEntry$LWS;
|
|
11967
13240
|
};
|
|
11968
13241
|
}
|
|
13242
|
+
|
|
13243
|
+
// W-23526613. `Response.json(data)` is an un-distorted, blue-realm native that
|
|
13244
|
+
// serializes `data` to JSON using the engine's own value-to-JSON-bytes walk.
|
|
13245
|
+
// That walk enumerates the argument's real own properties in native code,
|
|
13246
|
+
// below the near-membrane's `get`/`ownKeys` traps, so handing it a raw host
|
|
13247
|
+
// object (e.g. `document`) lets HTML's named-element-access algorithm fall back
|
|
13248
|
+
// to `Document.prototype.cookie` and leak the raw, un-namespaced cookie -- a
|
|
13249
|
+
// bypass of the property-access filtering the sandbox applies to ordinary
|
|
13250
|
+
// sandboxed JS reads.
|
|
13251
|
+
//
|
|
13252
|
+
// A `JSON.stringify` replacer neutralizes the leak. Values the sandbox itself
|
|
13253
|
+
// created round-trip to the blue realm as near-membrane proxies, whose native
|
|
13254
|
+
// walk goes through the membrane's proxy traps and is therefore already
|
|
13255
|
+
// filtered; any other object reachable from `data` is a raw blue host
|
|
13256
|
+
// reference the sandbox merely holds, and is replaced with an empty object so
|
|
13257
|
+
// the native serializer never enumerates it. The replacer runs before native
|
|
13258
|
+
// enumeration of each node, so it closes both the reported top-level
|
|
13259
|
+
// `Response.json(document)` call and nested carriers such as
|
|
13260
|
+
// `Response.json({ leak: document })`.
|
|
13261
|
+
function neutralizeHostObjectReplacer$LWS(_key$LWS, value$LWS) {
|
|
13262
|
+
if (value$LWS !== null && typeof value$LWS === 'object' && !isNearMembraneProxy$LWS$1(value$LWS)) {
|
|
13263
|
+
return {};
|
|
13264
|
+
}
|
|
13265
|
+
return value$LWS;
|
|
13266
|
+
}
|
|
13267
|
+
function initDistortionResponseJson$LWS({
|
|
13268
|
+
globalObject: {
|
|
13269
|
+
Response: Response$LWS
|
|
13270
|
+
}
|
|
13271
|
+
}) {
|
|
13272
|
+
const originalJson$LWS = Response$LWS == null ? void 0 : Response$LWS.json;
|
|
13273
|
+
// istanbul ignore if: Response.json is unavailable in some coverage environments
|
|
13274
|
+
if (typeof originalJson$LWS !== 'function') {
|
|
13275
|
+
return noop$LWS$1;
|
|
13276
|
+
}
|
|
13277
|
+
const distortionEntry$LWS = [originalJson$LWS, function json$LWS(...args$LWS) {
|
|
13278
|
+
if (isGaterEnabledFeature$LWS('changesSince.266') && args$LWS.length) {
|
|
13279
|
+
const safeString$LWS = JSONStringify$LWS$1(args$LWS[0], neutralizeHostObjectReplacer$LWS);
|
|
13280
|
+
// A top-level value that JSON serialization drops (undefined, a
|
|
13281
|
+
// function, a symbol) produces no bytes. Delegate to the native
|
|
13282
|
+
// implementation with `undefined` -- never the raw argument --
|
|
13283
|
+
// so it throws its own TypeError without a raw host object ever
|
|
13284
|
+
// reaching the native serializer.
|
|
13285
|
+
args$LWS[0] = safeString$LWS === undefined ? undefined : JSONParse$LWS(safeString$LWS);
|
|
13286
|
+
}
|
|
13287
|
+
return ReflectApply$LWS$1(originalJson$LWS, this, args$LWS);
|
|
13288
|
+
}];
|
|
13289
|
+
return function distortionResponseJson$LWS() {
|
|
13290
|
+
return distortionEntry$LWS;
|
|
13291
|
+
};
|
|
13292
|
+
}
|
|
11969
13293
|
const {
|
|
11970
13294
|
isSharedElement: isSharedElement$7$LWS
|
|
11971
13295
|
} = rootValidator$LWS;
|
|
@@ -12548,7 +13872,7 @@
|
|
|
12548
13872
|
try {
|
|
12549
13873
|
originalStorageObject$LWS = globalObject$LWS[storageName$LWS];
|
|
12550
13874
|
// eslint-disable-next-line no-empty
|
|
12551
|
-
} catch (
|
|
13875
|
+
} catch (_unused0$LWS) {}
|
|
12552
13876
|
// istanbul ignore if: currently unreachable via tests
|
|
12553
13877
|
if (!isObject$LWS$1(originalStorageObject$LWS)) {
|
|
12554
13878
|
return noop$LWS$1;
|
|
@@ -12776,6 +14100,63 @@
|
|
|
12776
14100
|
registerAttributeSetterDistortion$LWS(record$LWS, SVGAnimateElement$LWS, 'values', NAMESPACE_DEFAULT$LWS, values$LWS);
|
|
12777
14101
|
};
|
|
12778
14102
|
}
|
|
14103
|
+
|
|
14104
|
+
// W-23525040: SMIL animation of a script element's `href`/`xlink:href` is a
|
|
14105
|
+
// script-execution primitive that bypasses LWS's script-URL gate. LWS routes
|
|
14106
|
+
// every JS-level script-href write (attribute setter, property setter,
|
|
14107
|
+
// `SVGAnimatedString.baseVal`) through `createScriptDistortion` ->
|
|
14108
|
+
// `lwsInternalPolicy.createScriptURL`. Starting a SMIL animation via
|
|
14109
|
+
// `beginElement()`/`beginElementAt()` makes the engine write the target's
|
|
14110
|
+
// animated `href` inside its own implementation, never surfacing as a
|
|
14111
|
+
// JS-observable attribute mutation, so none of those gates ever see it and the
|
|
14112
|
+
// resolved URL loads and executes outside the membrane.
|
|
14113
|
+
//
|
|
14114
|
+
// A `<script>` is the only SVG element whose `href` is executable, and there is
|
|
14115
|
+
// no legitimate reason to SMIL-animate a script element, so both programmatic
|
|
14116
|
+
// begin methods refuse to start when the resolved animation target is a script
|
|
14117
|
+
// element. This is scheme-agnostic: legitimate script loading (including
|
|
14118
|
+
// `blob:` URLs) continues to work through the normal, gated `href` setter.
|
|
14119
|
+
const CANNOT_ANIMATE_SCRIPT_ELEMENT$LWS = 'Cannot begin an SVG animation that targets a script element.';
|
|
14120
|
+
// `beginElement()` and `beginElementAt(offset)` are the two programmatic SMIL
|
|
14121
|
+
// begin methods, and both need the identical guard: refuse to start when the
|
|
14122
|
+
// resolved animation target is a script element. `makeGuard` builds the init
|
|
14123
|
+
// function for either one so the guard exists as a single audited code path --
|
|
14124
|
+
// keeping future extensions (e.g. `endElement`/`endElementAt`, or the
|
|
14125
|
+
// declarative-trigger surface called out in the commit message) in lockstep
|
|
14126
|
+
// instead of drifting across copy-pasted bodies.
|
|
14127
|
+
function makeGuard$LWS(methodName$LWS) {
|
|
14128
|
+
return function initDistortionSVGAnimationElementBegin$LWS({
|
|
14129
|
+
globalObject: {
|
|
14130
|
+
SVGAnimationElement: SVGAnimationElement$LWS
|
|
14131
|
+
}
|
|
14132
|
+
}) {
|
|
14133
|
+
const SVGAnimationElementProto$LWS = SVGAnimationElement$LWS == null ? void 0 : SVGAnimationElement$LWS.prototype;
|
|
14134
|
+
// Defensive: if a future engine drops the begin method or the
|
|
14135
|
+
// `targetElement` getter off the prototype, install no distortion
|
|
14136
|
+
// rather than capture `undefined` and later crash on invocation.
|
|
14137
|
+
// Consistent with the `typeof ... !== 'function'` init guards used by
|
|
14138
|
+
// the CookieStore / Notification / TrustedTypePolicy distortions.
|
|
14139
|
+
if (!SVGAnimationElementProto$LWS) {
|
|
14140
|
+
return noop$LWS$1;
|
|
14141
|
+
}
|
|
14142
|
+
const originalBegin$LWS = SVGAnimationElementProto$LWS[methodName$LWS];
|
|
14143
|
+
const originalTargetElementGetter$LWS = ObjectLookupOwnGetter$LWS$1(SVGAnimationElementProto$LWS, 'targetElement');
|
|
14144
|
+
if (typeof originalBegin$LWS !== 'function' || typeof originalTargetElementGetter$LWS !== 'function') {
|
|
14145
|
+
return noop$LWS$1;
|
|
14146
|
+
}
|
|
14147
|
+
const distortionEntry$LWS = [originalBegin$LWS, function begin$LWS(...args$LWS) {
|
|
14148
|
+
if (isGaterEnabledFeature$LWS('changesSince.266') && isScriptElement$LWS(ReflectApply$LWS$1(originalTargetElementGetter$LWS, this, []))) {
|
|
14149
|
+
throw new LockerSecurityError$LWS(CANNOT_ANIMATE_SCRIPT_ELEMENT$LWS);
|
|
14150
|
+
}
|
|
14151
|
+
ReflectApply$LWS$1(originalBegin$LWS, this, args$LWS);
|
|
14152
|
+
}];
|
|
14153
|
+
return function distortionSVGAnimationElementBegin$LWS() {
|
|
14154
|
+
return distortionEntry$LWS;
|
|
14155
|
+
};
|
|
14156
|
+
};
|
|
14157
|
+
}
|
|
14158
|
+
const initDistortionSVGAnimationElementBeginElement$LWS = makeGuard$LWS('beginElement');
|
|
14159
|
+
const initDistortionSVGAnimationElementBeginElementAt$LWS = makeGuard$LWS('beginElementAt');
|
|
12779
14160
|
function initDistortionSVGElementDatasetGetter$LWS({
|
|
12780
14161
|
globalObject: {
|
|
12781
14162
|
SVGElement: SVGElement$LWS
|
|
@@ -12974,7 +14355,7 @@
|
|
|
12974
14355
|
try {
|
|
12975
14356
|
// istanbul ignore next: needs default platform behavior test
|
|
12976
14357
|
return ReflectApply$LWS$1(originalCreatePolicy$LWS, this, args$LWS);
|
|
12977
|
-
} catch (
|
|
14358
|
+
} catch (_unused1$LWS) {
|
|
12978
14359
|
// istanbul ignore next: this is tested, but currently cannot be tested in the coverage environment
|
|
12979
14360
|
consoleWarn$LWS(`${createTrustedTypesExceptionMessage$LWS(name$LWS)} Substituting with Lightning Web Security policy.`);
|
|
12980
14361
|
}
|
|
@@ -13101,15 +14482,25 @@
|
|
|
13101
14482
|
}
|
|
13102
14483
|
const loweredBlobType$LWS = ReflectApply$LWS$1(StringProtoToLowerCase$LWS, blobType$LWS, []);
|
|
13103
14484
|
if (HTML_MIME_TYPES_LIST$LWS.includes(loweredBlobType$LWS)) {
|
|
14485
|
+
// The `includes` gate above is an exact-string match against
|
|
14486
|
+
// HTML_MIME_TYPES_LIST, whose entries carry no parameters
|
|
14487
|
+
// (`text/html`, `image/svg+xml`, `text/xml`). A blob type that
|
|
14488
|
+
// arrived with a `;charset=` parameter (e.g.
|
|
14489
|
+
// `text/html;charset=utf-16`) fails that exact match and never
|
|
14490
|
+
// reaches this branch, so `loweredBlobType` here is always bare
|
|
14491
|
+
// and appending `;charset=utf-8` cannot produce a doubled
|
|
14492
|
+
// charset parameter. Both the validation slice and the
|
|
14493
|
+
// re-issued Blob reuse this one normalized content type.
|
|
14494
|
+
const normalizedContentType$LWS = `${loweredBlobType$LWS};charset=utf-8`;
|
|
13104
14495
|
const blobSize$LWS = ReflectApply$LWS$1(BlobProtoSizeGetter$LWS, blobObject$LWS, []);
|
|
13105
|
-
const normalizedBlob$LWS = ReflectApply$LWS$1(BlobProtoSlice$LWS, blobObject$LWS, [0, blobSize$LWS,
|
|
14496
|
+
const normalizedBlob$LWS = ReflectApply$LWS$1(BlobProtoSlice$LWS, blobObject$LWS, [0, blobSize$LWS, normalizedContentType$LWS]);
|
|
13106
14497
|
URLRevokeObjectURL$LWS(outURL$LWS);
|
|
13107
14498
|
outURL$LWS = ReflectApply$LWS$1(originalCreateObjectURL$LWS, this, [normalizedBlob$LWS]);
|
|
13108
14499
|
const xhr$LWS = new XhrCtor$LWS();
|
|
13109
14500
|
ReflectApply$LWS$1(XhrProtoOpen$LWS, xhr$LWS, ['GET', outURL$LWS, false]);
|
|
13110
14501
|
try {
|
|
13111
14502
|
ReflectApply$LWS$1(XhrProtoSend$LWS, xhr$LWS, []);
|
|
13112
|
-
} catch (
|
|
14503
|
+
} catch (_unused10$LWS) {
|
|
13113
14504
|
throw new LockerSecurityError$LWS(`Unable to verify ${toSafeTemplateStringValue$LWS(blobObject$LWS)} is secure.`);
|
|
13114
14505
|
}
|
|
13115
14506
|
const responseText$LWS = ReflectApply$LWS$1(XhrProtoResponseTextGetter$LWS, xhr$LWS, []);
|
|
@@ -13122,6 +14513,27 @@
|
|
|
13122
14513
|
URLRevokeObjectURL$LWS(outURL$LWS);
|
|
13123
14514
|
throw new LockerSecurityError$LWS(createInsecureBlobErrorMessage$LWS(blobObject$LWS));
|
|
13124
14515
|
}
|
|
14516
|
+
// W-23558036: the validated bytes were read from a URL over
|
|
14517
|
+
// `normalizedBlob`, which is a `slice()` of the caller's
|
|
14518
|
+
// original Blob/File. For a filesystem-backed File (e.g. an
|
|
14519
|
+
// OPFS-derived File on WebKit) that slice can stay bound to
|
|
14520
|
+
// the live on-disk resource rather than an immutable snapshot,
|
|
14521
|
+
// so the bytes the URL resolves to can be swapped AFTER this
|
|
14522
|
+
// validation returns — the classic time-of-check/time-of-use
|
|
14523
|
+
// gap. Re-issue the URL over a fresh in-memory Blob built from
|
|
14524
|
+
// the exact `responseText` we just validated. An in-memory Blob
|
|
14525
|
+
// has no backing filesystem path to mutate, so the returned URL
|
|
14526
|
+
// is anchored to the validated bytes regardless of how the
|
|
14527
|
+
// input Blob/File was obtained (OPFS, <input type=file>,
|
|
14528
|
+
// drag-drop, etc.).
|
|
14529
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
14530
|
+
URLRevokeObjectURL$LWS(outURL$LWS);
|
|
14531
|
+
const validatedBlob$LWS = new BlobCtor$LWS([responseText$LWS], {
|
|
14532
|
+
__proto__: null,
|
|
14533
|
+
type: normalizedContentType$LWS
|
|
14534
|
+
});
|
|
14535
|
+
outURL$LWS = ReflectApply$LWS$1(originalCreateObjectURL$LWS, this, [validatedBlob$LWS]);
|
|
14536
|
+
}
|
|
13125
14537
|
return outURL$LWS;
|
|
13126
14538
|
}
|
|
13127
14539
|
if (isMIMETypeAllowed$LWS(loweredBlobType$LWS)) {
|
|
@@ -13797,7 +15209,7 @@
|
|
|
13797
15209
|
// Same-browsing-context targets (_self, _parent, _top) are excluded:
|
|
13798
15210
|
// they navigate the current context (no new unsandboxed page), and the
|
|
13799
15211
|
// existing URL validation (gate 262) already guards them.
|
|
13800
|
-
if (isGaterEnabledFeature$LWS('
|
|
15212
|
+
if (isGaterEnabledFeature$LWS('blockWindowOpenSameOriginSameContext') && !willOpenInSameBrowsingContext$LWS) {
|
|
13801
15213
|
if (isSameOriginURL$LWS(resourceUrl$LWS)) {
|
|
13802
15214
|
throw new LockerSecurityError$LWS('Cannot open same-origin URL in a new browsing context.');
|
|
13803
15215
|
}
|
|
@@ -14019,6 +15431,53 @@
|
|
|
14019
15431
|
return distortionEntry$LWS;
|
|
14020
15432
|
};
|
|
14021
15433
|
}
|
|
15434
|
+
|
|
15435
|
+
// A genuine `Document` (from any realm) carries the internal slot that backs
|
|
15436
|
+
// `Document.prototype.documentElement`, so reading it through the raw getter
|
|
15437
|
+
// succeeds; every other value (plain object, primitive, null, a foreign sink
|
|
15438
|
+
// object) throws and is treated as not-a-Document. This is also exactly the
|
|
15439
|
+
// set of objects for which the exploit is live: the Streams sink protocol
|
|
15440
|
+
// invokes the captured `write` algorithm with the sink as its `this`, so only
|
|
15441
|
+
// an object that actually owns the `Document` internal slot can drive the
|
|
15442
|
+
// native `Document.write`.
|
|
15443
|
+
function isDocument$LWS(value$LWS) {
|
|
15444
|
+
try {
|
|
15445
|
+
ReflectApply$LWS$1(DocumentProtoDocumentElementGetter$LWS, value$LWS, []);
|
|
15446
|
+
return true;
|
|
15447
|
+
} catch (_unused11$LWS) {
|
|
15448
|
+
return false;
|
|
15449
|
+
}
|
|
15450
|
+
}
|
|
15451
|
+
function initDistortionWritableStreamCtor$LWS({
|
|
15452
|
+
globalObject: {
|
|
15453
|
+
WritableStream: originalWritableStreamCtor$LWS
|
|
15454
|
+
}
|
|
15455
|
+
}) {
|
|
15456
|
+
// istanbul ignore if: WritableStream is always available in coverage environments
|
|
15457
|
+
if (typeof originalWritableStreamCtor$LWS !== 'function') {
|
|
15458
|
+
return noop$LWS$1;
|
|
15459
|
+
}
|
|
15460
|
+
function WritableStream$LWS(...args$LWS) {
|
|
15461
|
+
// A `WritableStream` extracts its `start`/`write`/`close`/`abort` sink
|
|
15462
|
+
// algorithms off the underlying sink object at construction time, via
|
|
15463
|
+
// WebIDL member reads on the raw host object that happen outside the
|
|
15464
|
+
// near-membrane's call-interception layer. Passing a `Document` as the
|
|
15465
|
+
// sink captures the native `Document.prototype.write` (which LWS blocks
|
|
15466
|
+
// with a value-thrower on the method itself) as the stream's write
|
|
15467
|
+
// algorithm; each later `writer.write(chunk)` then runs the raw
|
|
15468
|
+
// `Document.write` through the browser's internal stream machinery,
|
|
15469
|
+
// never re-entering the thrower. Refuse a `Document` sink so the blocked
|
|
15470
|
+
// method cannot be laundered into a live reference.
|
|
15471
|
+
if (isGaterEnabledFeature$LWS('changesSince.266') && args$LWS.length && isDocument$LWS(args$LWS[0])) {
|
|
15472
|
+
throw new LockerSecurityError$LWS('Cannot create WritableStream with a Document sink.');
|
|
15473
|
+
}
|
|
15474
|
+
return ReflectConstruct$LWS(originalWritableStreamCtor$LWS, args$LWS);
|
|
15475
|
+
}
|
|
15476
|
+
const distortionEntry$LWS = [originalWritableStreamCtor$LWS, WritableStream$LWS];
|
|
15477
|
+
return function distortionWritableStreamCtor$LWS() {
|
|
15478
|
+
return distortionEntry$LWS;
|
|
15479
|
+
};
|
|
15480
|
+
}
|
|
14022
15481
|
function initDistortionXMLHttpRequestOpen$LWS({
|
|
14023
15482
|
globalObject: {
|
|
14024
15483
|
XMLHttpRequest: {
|
|
@@ -14094,7 +15553,7 @@
|
|
|
14094
15553
|
try {
|
|
14095
15554
|
docEl$LWS = ReflectApply$LWS$1(DocumentProtoDocumentElementGetter$LWS, rawResponse$LWS, []);
|
|
14096
15555
|
isDocument$LWS = true;
|
|
14097
|
-
} catch (
|
|
15556
|
+
} catch (_unused12$LWS) {
|
|
14098
15557
|
isDocument$LWS = false;
|
|
14099
15558
|
}
|
|
14100
15559
|
}
|
|
@@ -14166,6 +15625,8 @@
|
|
|
14166
15625
|
initDistortionHistoryPushState$LWS, initDistortionHistoryReplaceState$LWS,
|
|
14167
15626
|
// HTMLElement
|
|
14168
15627
|
initDistortionHTMLElementDatasetGetter$LWS, initDistortionHTMLElementInnerTextGetter$LWS, initDistortionHTMLElementInnerTextSetter$LWS, initDistortionHTMLElementOuterTextSetter$LWS, initDistortionHTMLElementStyleGetter$LWS,
|
|
15628
|
+
// HTMLFrameElement
|
|
15629
|
+
initDistortionHTMLFrameElementSrcGetter$LWS, initDistortionHTMLFrameElementSrcSetter$LWS,
|
|
14169
15630
|
// HTMLIFrameElement
|
|
14170
15631
|
initDistortionIFrameElementContentDocumentGetter$LWS, initDistortionIFrameElementContentWindowGetter$LWS, initDistortionHTMLIFrameElementSandboxGetter$LWS, initDistortionHTMLIFrameElementSandboxSetter$LWS, initDistortionHTMLIFrameElementSrcGetter$LWS, initDistortionHTMLIFrameElementSrcSetter$LWS,
|
|
14171
15632
|
// HTMLImageElement
|
|
@@ -14198,12 +15659,14 @@
|
|
|
14198
15659
|
initDistortionReportingObserverCtor$LWS, initDistortionReportingObserverProto$LWS,
|
|
14199
15660
|
// ResizeObserver
|
|
14200
15661
|
initDistortionResizeObserverObserve$LWS,
|
|
15662
|
+
// Navigation
|
|
15663
|
+
initDistortionNavigationNavigate$LWS,
|
|
14201
15664
|
// Navigator
|
|
14202
15665
|
initDistortionNavigatorSendBeacon$LWS, initDistortionNavigatorServiceWorkerGetter$LWS,
|
|
14203
15666
|
// Observable
|
|
14204
15667
|
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,
|
|
14205
15668
|
// Node
|
|
14206
|
-
initDistortionNodeGetRootNode$LWS, initDistortionNodeParentElementGetter$LWS, initDistortionNodeParentNodeGetter$LWS, initDistortionNodeRemoveChild$LWS, initDistortionNodeReplaceChild$LWS,
|
|
15669
|
+
initDistortionNodeCloneNode$LWS, initDistortionNodeGetRootNode$LWS, initDistortionNodeParentElementGetter$LWS, initDistortionNodeParentNodeGetter$LWS, initDistortionNodeRemoveChild$LWS, initDistortionNodeReplaceChild$LWS,
|
|
14207
15670
|
// Performance
|
|
14208
15671
|
initDistortionPerformanceMark$LWS, initDistortionPerformanceMeasure$LWS,
|
|
14209
15672
|
// PerformanceMark
|
|
@@ -14220,6 +15683,8 @@
|
|
|
14220
15683
|
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,
|
|
14221
15684
|
// Reflect
|
|
14222
15685
|
initDistortionReflectApply$LWS, initDistortionReflectConstruct$LWS, initDistortionReflectDefineProperty$LWS, initDistortionReflectGet$LWS,
|
|
15686
|
+
// Response
|
|
15687
|
+
initDistortionResponseJson$LWS,
|
|
14223
15688
|
// Selection
|
|
14224
15689
|
initDistortionSelectionAnchorNodeGetter$LWS, initDistortionSelectionCollapse$LWS, initDistortionSelectionExtend$LWS, initDistortionSelectionFocusNodeGetter$LWS, initDistortionSelectionSelectAllChildren$LWS, initDistortionSelectionSetBaseAndExtent$LWS, initDistortionSelectionSetPosition$LWS, initDistortionSelectionToString$LWS,
|
|
14225
15690
|
// ServiceWorkerContainer
|
|
@@ -14232,6 +15697,8 @@
|
|
|
14232
15697
|
initDistortionSVGAnimatedStringBaseValSetter$LWS,
|
|
14233
15698
|
// SVGAnimateElement
|
|
14234
15699
|
initDistortionSVGAnimateElementFromAttribute$LWS, initDistortionSVGAnimateElementToAttribute$LWS, initDistortionSVGAnimateElementValuesAttribute$LWS,
|
|
15700
|
+
// SVGAnimationElement
|
|
15701
|
+
initDistortionSVGAnimationElementBeginElement$LWS, initDistortionSVGAnimationElementBeginElementAt$LWS,
|
|
14235
15702
|
// SVGElement
|
|
14236
15703
|
initDistortionSVGElementDatasetGetter$LWS, initDistortionSVGElementStyleGetter$LWS,
|
|
14237
15704
|
// SVGSetElement
|
|
@@ -14248,6 +15715,8 @@
|
|
|
14248
15715
|
initDistortionWindowFetch$LWS, initDistortionWindowFetchLater$LWS, initDistortionWindowFramesGetter$LWS, initDistortionWindowGetComputedStyle$LWS, initDistortionWindowLengthGetter$LWS, initDistortionWindowNameGetter$LWS, initDistortionWindowNameSetter$LWS, initDistortionWindowOpen$LWS, initDistortionWindowPostMessage$LWS, initDistortionWindowStructuredClone$LWS,
|
|
14249
15716
|
// Worker
|
|
14250
15717
|
initDistortionWorkerCtor$LWS, initDistortionWorkerProto$LWS,
|
|
15718
|
+
// WritableStream
|
|
15719
|
+
initDistortionWritableStreamCtor$LWS,
|
|
14251
15720
|
// XHR
|
|
14252
15721
|
initDistortionXMLHttpRequestOpen$LWS];
|
|
14253
15722
|
const internalKeyedDistortionFactoryInitializers$LWS = [
|
|
@@ -14286,7 +15755,7 @@
|
|
|
14286
15755
|
// HTMLButtonElement
|
|
14287
15756
|
initDistortionHTMLButtonElementFormActionSetter$LWS,
|
|
14288
15757
|
// HTMLFormElement
|
|
14289
|
-
initDistortionHTMLFormElementActionSetter$LWS,
|
|
15758
|
+
initDistortionHTMLFormElementActionSetter$LWS, initDistortionHTMLFormElementRequestSubmit$LWS, initDistortionHTMLFormElementSubmit$LWS,
|
|
14290
15759
|
// HTMLInputElement
|
|
14291
15760
|
initDistortionHTMLInputElementFormActionSetter$LWS,
|
|
14292
15761
|
// HTMLFrameSetElement
|
|
@@ -14328,7 +15797,7 @@
|
|
|
14328
15797
|
// initDistortionNodeAppendChild,
|
|
14329
15798
|
initDistortionNodeInsertBefore$LWS]);
|
|
14330
15799
|
const externalKeyedDistortionFactoryInitializers$LWS = internalKeyedDistortionFactoryInitializers$LWS;
|
|
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']]));
|
|
15800
|
+
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'], [initDistortionHTMLFormElementRequestSubmit$LWS, 'form'], [initDistortionHTMLFormElementSubmit$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'], [initDistortionNavigationNavigate$LWS, 'navigation'], [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'], [initDistortionNodeCloneNode$LWS, 'node'], [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'], [initDistortionSVGAnimationElementBeginElement$LWS, 'script'], [initDistortionSVGAnimationElementBeginElementAt$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']]));
|
|
14332
15801
|
const DocumentBlockedProperties$LWS = ['parseHTMLUnsafe'];
|
|
14333
15802
|
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'];
|
|
14334
15803
|
const ElementProtoBlockedProperties$LWS = ['mozRequestFullScreen', 'onfullscreenchange', 'onfullscreenerror', 'requestFullscreen', 'webkitRequestFullScreen', 'webkitRequestFullscreen'];
|
|
@@ -14338,6 +15807,9 @@
|
|
|
14338
15807
|
const HTMLEmbedElementBlockedAttributes$LWS = ['src'];
|
|
14339
15808
|
const HTMLEmbedElementProtoBlockedProperties$LWS = ['getSVGDocument', 'src'];
|
|
14340
15809
|
|
|
15810
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/frame
|
|
15811
|
+
const HTMLFrameElementBlockedAttributes$LWS = ['srcdoc'];
|
|
15812
|
+
|
|
14341
15813
|
// https://www.w3schools.com/tags/tag_iframe.asp
|
|
14342
15814
|
const HTMLIFrameElementBlockedAttributes$LWS = ['srcdoc'];
|
|
14343
15815
|
const HTMLIFrameElementProtoBlockedProperties$LWS = ['getSVGDocument', 'srcdoc'];
|
|
@@ -14357,7 +15829,7 @@
|
|
|
14357
15829
|
const UIEventProtoBlockedProperties$LWS = ['rangeParent'];
|
|
14358
15830
|
const WindowBlockedProperties$LWS = ['find', 'requestFileSystem', 'webkitRequestFileSystem'];
|
|
14359
15831
|
const XSLTProcessorProtoBlockedProperties$LWS = ['transformToDocument', 'transformToFragment'];
|
|
14360
|
-
/*! version: 0.29.
|
|
15832
|
+
/*! version: 0.29.2 */
|
|
14361
15833
|
|
|
14362
15834
|
/*!
|
|
14363
15835
|
* Copyright (C) 2021 salesforce.com, inc.
|
|
@@ -14366,7 +15838,7 @@
|
|
|
14366
15838
|
function getPdpSchema$LWS() {
|
|
14367
15839
|
return pdpSchema$LWS;
|
|
14368
15840
|
}
|
|
14369
|
-
/*! version: 0.29.
|
|
15841
|
+
/*! version: 0.29.2 */
|
|
14370
15842
|
|
|
14371
15843
|
/*!
|
|
14372
15844
|
* Copyright (C) 2019 salesforce.com, inc.
|
|
@@ -14549,11 +16021,30 @@
|
|
|
14549
16021
|
function createDistortionEntries$LWS(record$LWS, factories$LWS) {
|
|
14550
16022
|
const distortionEntryToToggleSwitch$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1());
|
|
14551
16023
|
const entries$LWS = [];
|
|
16024
|
+
// W-23969898: on a torn-down same-origin iframe realm (DOM globals stripped
|
|
16025
|
+
// to `undefined`, JS intrinsics intact) getDistortionFactories returns only
|
|
16026
|
+
// the factories whose initializers survived, but a surviving factory can
|
|
16027
|
+
// still touch an absent DOM global when it BUILDS its entry here. Tolerate
|
|
16028
|
+
// such a failure so the intrinsic-only cross-realm family (Reflect.get et
|
|
16029
|
+
// al.) is still installed instead of the whole build throwing and dropping
|
|
16030
|
+
// the realm to a containment-free opaque record. Detected the same way as in
|
|
16031
|
+
// getDistortionFactories: a live window always exposes its Document.
|
|
16032
|
+
const tolerateFactoryBuildErrors$LWS = isGaterEnabledFeature$LWS('changesSince.266') && record$LWS.globalObject.Document === undefined;
|
|
14552
16033
|
for (let i$LWS = 0, {
|
|
14553
16034
|
length: length$LWS
|
|
14554
16035
|
} = factories$LWS; i$LWS < length$LWS; i$LWS += 1) {
|
|
14555
16036
|
const factory$LWS = factories$LWS[i$LWS];
|
|
14556
|
-
|
|
16037
|
+
let entry$LWS;
|
|
16038
|
+
if (tolerateFactoryBuildErrors$LWS) {
|
|
16039
|
+
try {
|
|
16040
|
+
entry$LWS = factory$LWS(record$LWS);
|
|
16041
|
+
} catch (_unused0$LWS) {
|
|
16042
|
+
// Cannot build this distortion on the torn-down realm; skip it.
|
|
16043
|
+
continue;
|
|
16044
|
+
}
|
|
16045
|
+
} else {
|
|
16046
|
+
entry$LWS = factory$LWS(record$LWS);
|
|
16047
|
+
}
|
|
14557
16048
|
if (entry$LWS) {
|
|
14558
16049
|
const {
|
|
14559
16050
|
0: originalValue$LWS,
|
|
@@ -14617,6 +16108,7 @@
|
|
|
14617
16108
|
Element: Element$LWS,
|
|
14618
16109
|
Event: Event$LWS,
|
|
14619
16110
|
HTMLElement: HTMLElement$LWS,
|
|
16111
|
+
HTMLFrameElement: HTMLFrameElement$LWS,
|
|
14620
16112
|
HTMLIFrameElement: HTMLIFrameElement$LWS,
|
|
14621
16113
|
HTMLScriptElement: HTMLScriptElement$LWS,
|
|
14622
16114
|
SVGElement: SVGElement$LWS,
|
|
@@ -14626,10 +16118,52 @@
|
|
|
14626
16118
|
const initializers$LWS = type$LWS === 1 /* SandboxType.Internal */ ?
|
|
14627
16119
|
// instanbul ignore next: coverage is collected on the external sandbox test run
|
|
14628
16120
|
ArrayConcat$LWS(internalDistortionFactoryInitializers$LWS, internalKeyedDistortionFactoryInitializers$LWS) : ArrayConcat$LWS(externalDistortionFactoryInitializers$LWS, externalKeyedDistortionFactoryInitializers$LWS);
|
|
16121
|
+
// W-23969898: a same-origin iframe whose browsing context has been torn
|
|
16122
|
+
// down (e.g. detached from the DOM before LWS rebuilds the post-navigation
|
|
16123
|
+
// record) keeps its JavaScript intrinsics — Reflect, Function, Proxy — but
|
|
16124
|
+
// strips its DOM globals: `globalObject.Document` and the other DOM
|
|
16125
|
+
// constructors read back `undefined`. A full record build destructures
|
|
16126
|
+
// those absent interfaces and throws, and the caller's rebuild fallback
|
|
16127
|
+
// then installs a containment-free opaque record — leaving the realm's raw
|
|
16128
|
+
// `Reflect.get` free to leak the host `document.cookie` across the membrane.
|
|
16129
|
+
//
|
|
16130
|
+
// On such a realm, build only the distortions whose intrinsics survived the
|
|
16131
|
+
// teardown by skipping any initializer that throws. This preserves the
|
|
16132
|
+
// cross-realm containment family (Reflect.get/apply/construct,
|
|
16133
|
+
// Function.call/apply/bind, Proxy) — exactly what a leaked
|
|
16134
|
+
// `child.Reflect.get` needs — while dropping the DOM-interface distortions,
|
|
16135
|
+
// which cannot build and have nothing to protect on a realm with no live
|
|
16136
|
+
// DOM. `Document === undefined` distinguishes a torn-down window from a live
|
|
16137
|
+
// one (a live secondary window always exposes its DOM constructors).
|
|
16138
|
+
if (isGaterEnabledFeature$LWS('changesSince.266') && Document$LWS === undefined) {
|
|
16139
|
+
const survivingFactories$LWS = [];
|
|
16140
|
+
for (let i$LWS = 0, {
|
|
16141
|
+
length: length$LWS
|
|
16142
|
+
} = initializers$LWS; i$LWS < length$LWS; i$LWS += 1) {
|
|
16143
|
+
let factory$LWS;
|
|
16144
|
+
try {
|
|
16145
|
+
factory$LWS = initializers$LWS[i$LWS](record$LWS);
|
|
16146
|
+
} catch (_unused1$LWS) {
|
|
16147
|
+
// A DOM-dependent distortion cannot build on a torn-down realm;
|
|
16148
|
+
// skip it. The intrinsic-only cross-realm family still builds.
|
|
16149
|
+
continue;
|
|
16150
|
+
}
|
|
16151
|
+
survivingFactories$LWS[survivingFactories$LWS.length] = factory$LWS;
|
|
16152
|
+
}
|
|
16153
|
+
distortionFactoriesCache$LWS.set(document$LWS, survivingFactories$LWS);
|
|
16154
|
+
return survivingFactories$LWS;
|
|
16155
|
+
}
|
|
14629
16156
|
addBlockedAttributeSetterDistortionFactoryInitializers$LWS(HTMLElement$LWS, 'HTMLElement', HTMLElementBlockedAttributes$LWS, initializers$LWS);
|
|
14630
|
-
addBlockedAttributeSetterDistortionFactoryInitializers$LWS(HTMLEmbedElement, 'HTMLEmbedElement', HTMLEmbedElementBlockedAttributes$LWS, initializers$LWS);
|
|
14631
|
-
addBlockedAttributeSetterDistortionFactoryInitializers$LWS(HTMLIFrameElement$LWS, 'HTMLIFrameElement', HTMLIFrameElementBlockedAttributes$LWS, initializers$LWS);
|
|
14632
|
-
|
|
16157
|
+
addBlockedAttributeSetterDistortionFactoryInitializers$LWS(HTMLEmbedElement, 'HTMLEmbedElement', HTMLEmbedElementBlockedAttributes$LWS, initializers$LWS, 'embed');
|
|
16158
|
+
addBlockedAttributeSetterDistortionFactoryInitializers$LWS(HTMLIFrameElement$LWS, 'HTMLIFrameElement', HTMLIFrameElementBlockedAttributes$LWS, initializers$LWS, 'iframe');
|
|
16159
|
+
// A legacy `<frame>` is an HTMLFrameElement (sibling of HTMLIFrameElement),
|
|
16160
|
+
// never `instanceof HTMLIFrameElement`, so the iframe `srcdoc` block above
|
|
16161
|
+
// does not cover it. Without this, `setAttribute('srcdoc', ...)` on a
|
|
16162
|
+
// `<frame>` reparses into an unmembraned same-origin browsing context.
|
|
16163
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
16164
|
+
addBlockedAttributeSetterDistortionFactoryInitializers$LWS(HTMLFrameElement$LWS, 'HTMLFrameElement', HTMLFrameElementBlockedAttributes$LWS, initializers$LWS);
|
|
16165
|
+
}
|
|
16166
|
+
addBlockedAttributeSetterDistortionFactoryInitializers$LWS(HTMLScriptElement$LWS, 'HTMLScriptElement', HTMLScriptElementBlockedAttributes$LWS, initializers$LWS, 'script');
|
|
14633
16167
|
addBlockedAttributeSetterDistortionFactoryInitializers$LWS(SVGElement$LWS, 'SVGElement', SVGElementBlockedAttributes$LWS, initializers$LWS);
|
|
14634
16168
|
// Read-side block list: only the subset of write-blocked attributes that
|
|
14635
16169
|
// ALSO must not be readable. Today this is `nonce` only; attributes like
|
|
@@ -17125,22 +18659,9 @@
|
|
|
17125
18659
|
// Replace pending traps with live traps that can work with the
|
|
17126
18660
|
// target without taking snapshots.
|
|
17127
18661
|
this.deleteProperty = BoundaryProxyHandler$LWS.passthruDeletePropertyTrap;
|
|
18662
|
+
this.defineProperty = BoundaryProxyHandler$LWS.passthruDefinePropertyTrap;
|
|
17128
18663
|
this.preventExtensions = BoundaryProxyHandler$LWS.passthruPreventExtensionsTrap;
|
|
17129
18664
|
this.set = BoundaryProxyHandler$LWS.passthruSetTrap;
|
|
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
18665
|
// `[[SetPrototypeOf]]` is the one live trap we do not
|
|
17145
18666
|
// passthru. The passthru variant calls `ReflectSetPrototypeOf`
|
|
17146
18667
|
// on the RAW foreign target, which lets sandbox code splice a
|
|
@@ -17151,9 +18672,9 @@
|
|
|
17151
18672
|
// shadow target. It also lets sandbox code wipe a host-shared
|
|
17152
18673
|
// object's prototype to `null`. Scoping the proto change to the
|
|
17153
18674
|
// shadow target makes both observably inert while leaving
|
|
17154
|
-
// `set`/`deleteProperty` passthru (the
|
|
17155
|
-
// actually need) untouched. No
|
|
17156
|
-
// itself across the membrane.
|
|
18675
|
+
// `set`/`defineProperty`/`deleteProperty` passthru (the
|
|
18676
|
+
// capabilities live targets actually need) untouched. No
|
|
18677
|
+
// legitimate live target re-parents itself across the membrane.
|
|
17157
18678
|
this.setPrototypeOf = BoundaryProxyHandler$LWS.staticSetPrototypeOfTrap;
|
|
17158
18679
|
} : noop$LWS;
|
|
17159
18680
|
this.makeProxyStatic = IS_IN_SHADOW_REALM$LWS ? function () {
|
|
@@ -17759,76 +19280,6 @@
|
|
|
17759
19280
|
}
|
|
17760
19281
|
return result$LWS;
|
|
17761
19282
|
} : 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;
|
|
17832
19283
|
BoundaryProxyHandler$LWS.passthruGetTrap = IS_NOT_IN_SHADOW_REALM$LWS ? function (_shadowTarget$LWS, key$LWS, receiver$LWS) {
|
|
17833
19284
|
// Only allow accessing handshake property values if the
|
|
17834
19285
|
// "has" trap has been triggered immediately BEFORE and
|
|
@@ -19664,7 +21115,7 @@
|
|
|
19664
21115
|
// eslint-disable-next-line no-unused-expressions
|
|
19665
21116
|
bindings$LWS[i$LWS];
|
|
19666
21117
|
// eslint-disable-next-line no-empty
|
|
19667
|
-
} catch (
|
|
21118
|
+
} catch (_unused35$LWS) {}
|
|
19668
21119
|
}
|
|
19669
21120
|
return spreadable$LWS(args$LWS);
|
|
19670
21121
|
};
|
|
@@ -20063,7 +21514,7 @@
|
|
|
20063
21514
|
// tools from mistaking the regexp or the replacement string for an
|
|
20064
21515
|
// actual source mapping URL.
|
|
20065
21516
|
/\/\/# sandbox(?=MappingURL=.*?\s*$)/, '//# source']);
|
|
20066
|
-
sourceText$LWS = `\n//# LWS Version = "0.29.
|
|
21517
|
+
sourceText$LWS = `\n//# LWS Version = "0.29.2"\n${sourceText$LWS}`;
|
|
20067
21518
|
return sourceType$LWS === 1 /* SourceType.Module */ && indexOfPragma$LWS(sourceText$LWS, 'use strict') === -1 ?
|
|
20068
21519
|
// Append "'use strict'" to the extracted function body so it is
|
|
20069
21520
|
// evaluated in strict mode.
|
|
@@ -20085,6 +21536,15 @@
|
|
|
20085
21536
|
// causing the check to bail out and the DOMContentLoaded listener to never be
|
|
20086
21537
|
// attached.
|
|
20087
21538
|
const childWindowDocuments$LWS = toSafeMap$LWS$1(new MapCtor$LWS$1());
|
|
21539
|
+
// Sentinel "last document" recorded in childWindowDocuments for opaque child
|
|
21540
|
+
// windows whose real document cannot be read (cross-origin access throws). It
|
|
21541
|
+
// is a fresh object identity, so it is guaranteed distinct from any real
|
|
21542
|
+
// Document. The first same-origin document observed after an
|
|
21543
|
+
// opaque→same-origin transition therefore fails the `currentDoc !==
|
|
21544
|
+
// lastDocument` check in distortionCallback, causing a fresh secondary record
|
|
21545
|
+
// to be created for the new realm before its raw built-ins can be handed to
|
|
21546
|
+
// sandboxed code.
|
|
21547
|
+
const OPAQUE_CHILD_WINDOW_DOCUMENT_SENTINEL$LWS = {};
|
|
20088
21548
|
function createGetVirtualEnvironment$LWS(record$LWS) {
|
|
20089
21549
|
let virtualEnvironment$LWS;
|
|
20090
21550
|
return () => {
|
|
@@ -20218,7 +21678,7 @@
|
|
|
20218
21678
|
type: type$LWS
|
|
20219
21679
|
}, _root$LWS);
|
|
20220
21680
|
}
|
|
20221
|
-
} catch (
|
|
21681
|
+
} catch (_unused36$LWS) {
|
|
20222
21682
|
// Cross-origin window — document access throws.
|
|
20223
21683
|
// Opaque sandbox record was already created on first
|
|
20224
21684
|
// encounter; nothing more to do.
|
|
@@ -20239,6 +21699,13 @@
|
|
|
20239
21699
|
// map with entries for the new realm's objects so the
|
|
20240
21700
|
// re-lookup below can succeed.
|
|
20241
21701
|
if (isGaterEnabledFeature$LWS('changesSince.262') && childWindowDocuments$LWS.size > 0) {
|
|
21702
|
+
// `lastDocument` is typed Document but may be
|
|
21703
|
+
// OPAQUE_CHILD_WINDOW_DOCUMENT_SENTINEL (a fresh `{}` cast to
|
|
21704
|
+
// Document) for an opaque child window whose real document
|
|
21705
|
+
// could not be read. It is a type-lie: only ever compare it
|
|
21706
|
+
// by identity (below); never read a property off it, or a
|
|
21707
|
+
// sentinel entry would fault instead of tripping the swap
|
|
21708
|
+
// check. See createOpaqueSecondaryWindowSandboxRecord.
|
|
20242
21709
|
for (const [childGlobalObject$LWS, lastDocument$LWS] of childWindowDocuments$LWS) {
|
|
20243
21710
|
// Only process child windows belonging to this
|
|
20244
21711
|
// sandbox (each sandbox has its own distortion map).
|
|
@@ -20260,7 +21727,7 @@
|
|
|
20260
21727
|
return newDistortedTarget$LWS;
|
|
20261
21728
|
}
|
|
20262
21729
|
}
|
|
20263
|
-
} catch (
|
|
21730
|
+
} catch (_unused37$LWS) {
|
|
20264
21731
|
// Cross-origin window — document access throws.
|
|
20265
21732
|
}
|
|
20266
21733
|
}
|
|
@@ -20277,7 +21744,7 @@
|
|
|
20277
21744
|
if (!ObjectHasOwn$LWS$1(originalTarget$LWS, 'location')) {
|
|
20278
21745
|
return originalTarget$LWS;
|
|
20279
21746
|
}
|
|
20280
|
-
} catch (
|
|
21747
|
+
} catch (_unused38$LWS) {
|
|
20281
21748
|
// Likely an opaque object of a cross-origin window.
|
|
20282
21749
|
// istanbul ignore next: an access of property iframe.contentWindow.location.href on an opaque window, that should reach this catch clause IS tested (see packages/integration-karma/test/distortions/HTMLIFrameElement/untrusted/snippets.js, "doesNotThrowOnCreationOrAccessOfCrossOriginIframeContentWindow"), but reported as uncovered
|
|
20283
21750
|
return originalTarget$LWS;
|
|
@@ -20286,14 +21753,29 @@
|
|
|
20286
21753
|
let originalTargetWindow$LWS;
|
|
20287
21754
|
// Do the safe cross-origin window object check first to avoid
|
|
20288
21755
|
// failure caused by touching non-cross-origin-safe properties.
|
|
20289
|
-
|
|
21756
|
+
//
|
|
21757
|
+
// Reading `window` invokes a getter when the target defines one, and a
|
|
21758
|
+
// hostile or exotic object can define `get window()` that throws. Guard
|
|
21759
|
+
// it exactly like the `location` check above: an unguarded throw here
|
|
21760
|
+
// propagates out of classification and through near-membrane's
|
|
21761
|
+
// pushErrorAcrossBoundary as a raw, unclassified value, letting an
|
|
21762
|
+
// undistorted host object escape the boundary into sandboxed code.
|
|
21763
|
+
let isSelfReferencingWindow$LWS = false;
|
|
21764
|
+
try {
|
|
21765
|
+
isSelfReferencingWindow$LWS = ObjectHasOwn$LWS$1(originalTarget$LWS, 'window') && originalTarget$LWS.window === originalTarget$LWS;
|
|
21766
|
+
} catch (_unused39$LWS) {
|
|
21767
|
+
// Not a window we can safely classify; treat it as a plain object
|
|
21768
|
+
// and let near-membrane wrap it normally.
|
|
21769
|
+
return originalTarget$LWS;
|
|
21770
|
+
}
|
|
21771
|
+
if (isSelfReferencingWindow$LWS) {
|
|
20290
21772
|
// Slower check to detect a window object.
|
|
20291
21773
|
try {
|
|
20292
21774
|
// `WindowDocumentGetter` will throw if `originalTarget` is
|
|
20293
21775
|
// not a window object, or if it is an opaque cross-origin window.
|
|
20294
21776
|
originalTargetDocument$LWS = ReflectApply$LWS$1(WindowDocumentGetter$LWS, originalTarget$LWS, []);
|
|
20295
21777
|
originalTargetWindow$LWS = originalTarget$LWS;
|
|
20296
|
-
} catch (
|
|
21778
|
+
} catch (_unused40$LWS) {
|
|
20297
21779
|
try {
|
|
20298
21780
|
// istanbul ignore else: current tests have no way of expressing a state that would cause this condition to evaluate false
|
|
20299
21781
|
if (ReflectApply$LWS$1(WindowLocationGetter$LWS, originalTarget$LWS, [])) {
|
|
@@ -20305,7 +21787,7 @@
|
|
|
20305
21787
|
return originalTarget$LWS;
|
|
20306
21788
|
}
|
|
20307
21789
|
// eslint-disable-next-line no-empty
|
|
20308
|
-
} catch (
|
|
21790
|
+
} catch (_unused41$LWS) {}
|
|
20309
21791
|
}
|
|
20310
21792
|
// Check if originalTarget is a document and get its defaultView.
|
|
20311
21793
|
} else if ('defaultView' in originalTarget$LWS) {
|
|
@@ -20319,7 +21801,7 @@
|
|
|
20319
21801
|
// This will throw if `originalTarget` is not a document object.
|
|
20320
21802
|
defaultView$LWS = ReflectApply$LWS$1(DocumentProtoDefaultViewGetter$LWS, originalTarget$LWS, []);
|
|
20321
21803
|
// eslint-disable-next-line no-empty
|
|
20322
|
-
} catch (
|
|
21804
|
+
} catch (_unused42$LWS) {}
|
|
20323
21805
|
if (defaultView$LWS) {
|
|
20324
21806
|
originalTargetDocument$LWS = originalTarget$LWS;
|
|
20325
21807
|
originalTargetWindow$LWS = defaultView$LWS;
|
|
@@ -20476,6 +21958,31 @@
|
|
|
20476
21958
|
if (!seenGlobalObjects$LWS.has(globalObject$LWS)) {
|
|
20477
21959
|
distortions$LWS.set(globalObject$LWS, globalObject$LWS);
|
|
20478
21960
|
}
|
|
21961
|
+
// W-23475955: Track this opaque child window for document-swap detection,
|
|
21962
|
+
// mirroring the same-origin path in createSecondaryWindowSandboxRecord.
|
|
21963
|
+
// Without this, an opaque→same-origin transition (a cross-origin/opaque
|
|
21964
|
+
// browsing context later navigated to a same-origin document) is invisible
|
|
21965
|
+
// to the swap-detection loop in distortionCallback, which only walks
|
|
21966
|
+
// windows present in childWindowDocuments. The near-membrane caches the
|
|
21967
|
+
// WindowProxy's proxy pointer, so distortionCallback is never re-invoked
|
|
21968
|
+
// for the WindowProxy itself; the loop is the mechanism that eagerly
|
|
21969
|
+
// creates a secondary record for the new realm before its undistorted
|
|
21970
|
+
// built-ins can be reached. The opaque document is unreadable
|
|
21971
|
+
// (cross-origin access throws), so a sentinel is stored; the first
|
|
21972
|
+
// same-origin document observed after the transition differs from it and
|
|
21973
|
+
// trips the loop. The globalObject is not added to seenGlobalObjects here
|
|
21974
|
+
// so that, upon transition, createSecondaryWindowSandboxRecord still wires
|
|
21975
|
+
// up event-based navigation detection for the now-same-origin realm.
|
|
21976
|
+
//
|
|
21977
|
+
// Note on map growth: childWindowDocuments is a strong Map with no delete
|
|
21978
|
+
// path (pre-existing since the same-origin producer below, added in #2078).
|
|
21979
|
+
// This line adds one more producer of entries and inherits that same
|
|
21980
|
+
// characteristic — it does not change the growth profile. Bounding the map
|
|
21981
|
+
// is a separate, cross-cutting concern that also covers the same-origin
|
|
21982
|
+
// producer and is out of scope for this record-tracking fix.
|
|
21983
|
+
if (isGaterEnabledFeature$LWS('changesSince.266')) {
|
|
21984
|
+
childWindowDocuments$LWS.set(globalObject$LWS, OPAQUE_CHILD_WINDOW_DOCUMENT_SENTINEL$LWS);
|
|
21985
|
+
}
|
|
20479
21986
|
// Add opaque window postMessage distortion for the child window to the root
|
|
20480
21987
|
// window's distortion map.
|
|
20481
21988
|
const opaqueWindowPostMessageDistortionFactory$LWS = getOpaqueWindowPostMessageDistortionFactory$LWS(record$LWS);
|
|
@@ -20609,7 +22116,7 @@
|
|
|
20609
22116
|
type: type$LWS
|
|
20610
22117
|
}, _root$LWS);
|
|
20611
22118
|
}
|
|
20612
|
-
} catch (
|
|
22119
|
+
} catch (_unused43$LWS) {
|
|
20613
22120
|
// istanbul ignore next: this is a safety precaution that is unreachable via tests
|
|
20614
22121
|
createOpaqueSecondaryWindowSandboxRecord$LWS({
|
|
20615
22122
|
globalObject: globalObject$LWS,
|
|
@@ -20648,7 +22155,7 @@
|
|
|
20648
22155
|
ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, globalObject$LWS, ['DOMContentLoaded', onDOMContentLoadedOrWindowLoad$LWS, true]);
|
|
20649
22156
|
// istanbul ignore next: currently unreachable via tests
|
|
20650
22157
|
ReflectApply$LWS$1(EventTargetProtoAddEventListener$LWS, globalObject$LWS, ['unload', onWindowUnload$LWS, true]);
|
|
20651
|
-
} catch (
|
|
22158
|
+
} catch (_unused44$LWS) {
|
|
20652
22159
|
// istanbul ignore next: this is a safety precaution that is unreachable via tests
|
|
20653
22160
|
createOpaqueSecondaryWindowSandboxRecord$LWS({
|
|
20654
22161
|
globalObject: globalObject$LWS,
|
|
@@ -20762,7 +22269,7 @@
|
|
|
20762
22269
|
// surrounding-whitespace variant of the two known separators back onto the
|
|
20763
22270
|
// sandbox-scoped facade.
|
|
20764
22271
|
toSafeSet$LWS(new SetCtor$LWS$1(['lightning/platformresourceloader', 'lightning:platformresourceloader', 'lightningmobileruntime/platformresourceloader', 'lightningmobileruntime:platformresourceloader']));
|
|
20765
|
-
/*! version: 0.29.
|
|
22272
|
+
/*! version: 0.29.2 */
|
|
20766
22273
|
|
|
20767
22274
|
// Expose evaluateInSandbox on the window global so the browser harness page
|
|
20768
22275
|
// (eval.html / component.html) can invoke it against source delivered by the
|