The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
Refuse nested frames, links and speculation rules in the lens frame
Claude423f46296cd7
diff --git a/cli/beacon/internal/endpoint/dashboard/lenses/prelude.js b/cli/beacon/internal/endpoint/dashboard/lenses/prelude.jsindex 92d76bfd..463e4dee 100644--- a/cli/beacon/internal/endpoint/dashboard/lenses/prelude.js+++ b/cli/beacon/internal/endpoint/dashboard/lenses/prelude.js@@ -14,13 +14,18 @@(function () {"use strict";- // WebRTC is the one network API the frame's CSP does not govern: connect-src does not apply to- // ICE, and sandbox="allow-scripts" leaves RTCPeerConnection working, so a lens could hand trace- // data to a STUN/TURN server it names. Remove every RTC* interface (and the webkit alias) before- // any lens code runs, as non-configurable, non-writable undefined properties so a lens can neither- // delete nor redefine them. This is hardening inside the lens's own realm, not a browser-enforced- // boundary: it holds because the lens cannot reach a fresh realm (the CSP refuses frames and- // workers, the sandbox refuses popups, and a sandboxed about:blank child is cross-origin to it).+ // Everything from here to the host protocol is best-effort hardening, not a boundary. The CSP and+ // the sandbox are what the browser enforces; they keep a lens away from Beacon and the dashboard+ // and refuse the ordinary network APIs. They do not govern WebRTC or every resource hint, and no+ // CSP or Permissions Policy directive does, so a lens is code trusted with the trace it is shown.+ // These guards close the common paths to those features; a determined lens can find others.++ // WebRTC: connect-src does not apply to ICE, so a lens could hand trace data to a STUN/TURN server+ // it names. Remove every RTC* interface (and the webkit alias) from this realm as non-configurable,+ // non-writable undefined properties, so lens code can neither delete nor redefine them. A frame+ // the lens creates is a fresh realm where they still exist: the parent cannot reach into it (a+ // sandboxed child has its own opaque origin), but a srcdoc child runs its own scripts. The+ // document guard below refuses such frames.Object.getOwnPropertyNames(window).forEach(function (name) {if (!/^(webkit)?RTC/.test(name)) return;try {@@ -30,6 +35,214 @@}});+ // Document guard. A lens may not put into its document a nested browsing context (iframe, frame,+ // object, embed, portal, fencedframe: a fresh realm with WebRTC intact), a <link> (a lens loads+ // nothing by URL, and rel=preconnect/prefetch/prerender/dns-prefetch/preload can start a request+ // the CSP does not see), or a <script type=speculationrules>. Creating, inserting or parsing one+ // in through the DOM APIs throws; document.write is refused outright; a mutation observer removes+ // any that the parser puts in from the lens file's own markup. Not covered: what the browser's+ // preload scanner does with the file's own markup before any script runs, closed declarative+ // shadow roots, and attribute changes made through Attr nodes. `beacon lenses lint` warns on these+ // elements and on declarative shadow roots in source. Everything the guard calls is captured+ // here, before lens code can patch it.+ (function guardDocument() {+ var apply = Reflect.apply;+ var Refusal = DOMException;+ var HTML_NS = "http://www.w3.org/1999/xhtml";+ var REFUSED = Object.create(null);+ ["iframe", "frame", "frameset", "object", "embed", "portal", "fencedframe", "link"].forEach(function (name) {+ REFUSED[name] = true;+ });+ var SELECTOR = "iframe,frame,frameset,object,embed,portal,fencedframe,link,script,template";++ function getter(proto, name) {+ var get = Object.getOwnPropertyDescriptor(proto, name).get;+ return function (target) { return apply(get, target, []); };+ }+ function method(proto, name) {+ var fn = proto[name];+ return function (target, args) { return apply(fn, target, args); };+ }+ var nodeType = getter(Node.prototype, "nodeType");+ var localName = getter(Element.prototype, "localName");+ var namespaceURI = getter(Element.prototype, "namespaceURI");+ var templateContent = getter(HTMLTemplateElement.prototype, "content");+ var shadowRoot = getter(Element.prototype, "shadowRoot");+ var listLength = getter(NodeList.prototype, "length");+ var addedNodes = getter(MutationRecord.prototype, "addedNodes");+ var getAttribute = method(Element.prototype, "getAttribute");+ var removeElement = method(Element.prototype, "remove");+ var trim = method(String.prototype, "trim");+ var lower = method(String.prototype, "toLowerCase");+ var parseHTML = method(DOMParser.prototype, "parseFromString");+ var parser = new DOMParser();+ var queryAll = Object.create(null);+ queryAll[1] = method(Element.prototype, "querySelectorAll");+ queryAll[9] = method(Document.prototype, "querySelectorAll");+ queryAll[11] = method(DocumentFragment.prototype, "querySelectorAll");++ function refuse(what) {+ throw new Refusal("a Beacon lens cannot " + what, "NotSupportedError");+ }+ // Strings are converted once, here, so a value whose toString changes between calls cannot show+ // the check one string and the browser another. nullToEmpty matches innerHTML and outerHTML.+ function text(value) {+ return typeof value === "string" ? value : "" + value;+ }+ function nullToEmpty(value) {+ return value === null ? "" : text(value);+ }+ function isSpeculationRules(type) {+ return type !== null && lower(trim(text(type), []), []) === "speculationrules";+ }+ function isRefused(el) {+ if (namespaceURI(el) !== HTML_NS) return false;+ var name = localName(el);+ return REFUSED[name] === true || (name === "script" && isSpeculationRules(getAttribute(el, ["type"])));+ }+ // Calls found(el) for every refused element in node and its subtree, template contents and open+ // shadow roots included.+ function eachRefused(node, found) {+ var type;+ try {+ type = nodeType(node);+ } catch (e) {+ return; // not a node+ }+ if (type === 1) {+ if (isRefused(node)) return found(node);+ if (namespaceURI(node) === HTML_NS && localName(node) === "template") eachRefused(templateContent(node), found);+ var root = shadowRoot(node);+ if (root) eachRefused(root, found);+ }+ if (!queryAll[type]) return;+ var list = queryAll[type](node, [SELECTOR]);+ for (var i = 0, n = listLength(list); i < n; i++) eachRefused(list[i], found);+ }+ function checkNode(node) {+ eachRefused(node, function (el) { refuse("add a <" + localName(el) + "> element"); });+ }+ function checkMarkup(markup) {+ checkNode(parseHTML(parser, [markup, "text/html"]));+ }++ function wrapMethod(proto, name, check) {+ var original = proto && proto[name];+ if (typeof original !== "function") return;+ proto[name] = function () {+ check(this, arguments);+ return apply(original, this, arguments);+ };+ }+ function wrapSetter(proto, name, check, convert) {+ var desc = proto && Object.getOwnPropertyDescriptor(proto, name);+ if (!desc || !desc.set) return;+ var set = desc.set;+ Object.defineProperty(proto, name, {+ get: desc.get,+ set: function (value) {+ var converted = (convert || text)(value);+ check(this, converted);+ apply(set, this, [converted]);+ },+ enumerable: desc.enumerable,+ configurable: true+ });+ }+ function checkNodeArgs(target, args) {+ for (var i = 0; i < args.length; i++) checkNode(args[i]);+ }++ // Creation and insertion. A refused element is refused when it is created, whatever its case or+ // prefix, and again whenever it would enter a tree.+ ["createElement", "createElementNS"].forEach(function (name) {+ var create = Document.prototype[name];+ Document.prototype[name] = function () {+ var el = apply(create, this, arguments);+ checkNode(el);+ return el;+ };+ });+ ["appendChild", "insertBefore", "replaceChild"].forEach(function (name) {+ wrapMethod(Node.prototype, name, checkNodeArgs);+ });+ [Element, Document, DocumentFragment, CharacterData, DocumentType].forEach(function (type) {+ ["append", "prepend", "replaceChildren", "before", "after", "replaceWith", "moveBefore", "insertAdjacentElement"].forEach(function (name) {+ if (Object.prototype.hasOwnProperty.call(type.prototype, name)) wrapMethod(type.prototype, name, checkNodeArgs);+ });+ });+ wrapMethod(Range.prototype, "insertNode", checkNodeArgs);+ wrapMethod(Range.prototype, "surroundContents", checkNodeArgs);++ // HTML parsing into the live document. Markup is parsed once into an inert document and refused+ // if it holds a refused element; the converted string is what then reaches the real parser.+ [Element, ShadowRoot].forEach(function (type) {+ wrapSetter(type.prototype, "innerHTML", function (target, markup) { checkMarkup(markup); }, nullToEmpty);+ ["setHTMLUnsafe", "setHTML"].forEach(function (name) {+ wrapMethod(type.prototype, name, function (target, args) {+ args[0] = text(args[0]);+ checkMarkup(args[0]);+ });+ });+ });+ wrapSetter(Element.prototype, "outerHTML", function (target, markup) { checkMarkup(markup); }, nullToEmpty);+ wrapMethod(Element.prototype, "insertAdjacentHTML", function (target, args) {+ args[1] = text(args[1]);+ checkMarkup(args[1]);+ });+ wrapMethod(Document.prototype, "execCommand", function (doc, args) {+ if (args.length < 3 || lower(text(args[0]), []) !== "inserthtml") return;+ args[2] = text(args[2]);+ checkMarkup(args[2]);+ });+ // document.write can split one element across calls, so no single call can be checked.+ ["write", "writeln"].forEach(function (name) {+ wrapMethod(Document.prototype, name, function () { refuse("use document." + name); });+ });++ // A frame that is somehow detached and kept cannot be given a document, and a script cannot+ // become speculation rules after it was created.+ [[HTMLIFrameElement, "srcdoc"], [HTMLIFrameElement, "src"], [HTMLFrameElement, "src"], [HTMLObjectElement, "data"], [HTMLEmbedElement, "src"]]+ .forEach(function (entry) {+ wrapSetter(entry[0].prototype, entry[1], function () { refuse("load a nested frame"); });+ });+ wrapSetter(HTMLScriptElement.prototype, "type", function (el, type) {+ if (isSpeculationRules(type)) refuse("add speculation rules");+ });+ function checkScriptType(el, name, value) {+ if (lower(text(name), []) === "type" && namespaceURI(el) === HTML_NS && localName(el) === "script" && isSpeculationRules(value)) {+ refuse("add speculation rules");+ }+ }+ wrapMethod(Element.prototype, "setAttribute", function (el, args) {+ args[1] = text(args[1]);+ checkScriptType(el, args[0], args[1]);+ });+ wrapMethod(Element.prototype, "setAttributeNS", function (el, args) {+ args[2] = text(args[2]);+ if (args[0] === null || args[0] === undefined || args[0] === "") checkScriptType(el, args[1], args[2]);+ });++ // The lens file's own markup reaches the document through the parser, which calls none of the+ // above. Remove what it inserts at the next microtask checkpoint: before the next script runs+ // and before a frame's document loads.+ var Observer = MutationObserver;+ var observe = method(Observer.prototype, "observe");+ var options = Object.create(null);+ options.childList = true;+ options.subtree = true;+ var observer = new Observer(function (records) {+ for (var i = 0; i < records.length; i++) {+ var nodes = addedNodes(records[i]);+ for (var j = 0, n = listLength(nodes); j < n; j++) {+ eachRefused(nodes[j], function (el) { removeElement(el, []); });+ if (nodeType(nodes[j]) === 1 && shadowRoot(nodes[j])) observe(observer, [shadowRoot(nodes[j]), options]);+ }+ }+ });+ observe(observer, [document, options]);+ })();+var TIMEOUT_MS = 10000;var port = null;var pending = [];diff --git a/cli/beacon/internal/endpoint/dashboard/testdata/lens-e2e/fixtures/probe.lens.html b/cli/beacon/internal/endpoint/dashboard/testdata/lens-e2e/fixtures/probe.lens.htmlindex 751554a7..b5ebad86 100644--- a/cli/beacon/internal/endpoint/dashboard/testdata/lens-e2e/fixtures/probe.lens.html+++ b/cli/beacon/internal/endpoint/dashboard/testdata/lens-e2e/fixtures/probe.lens.html@@ -3,9 +3,20 @@<head><meta charset="utf-8"><script type="application/beacon-lens+json">{"id":"probe","title":"Probe","version":1,"api":"beacon.lens.v1"}</script>+<script>+// Registered before the static markup below is parsed, so a static child that ran would be heard.+var staticChildMessages = [];+window.addEventListener("message", function (event) {+ if (event.data && typeof event.data === "object" && "staticChild" in event.data) staticChildMessages.push(event.data.staticChild);+});+</script></head><body><pre id="results"></pre>+<!-- The lens file's own markup reaches the document through the parser, not the DOM APIs. -->+<iframe id="static-frame" srcdoc="<script>parent.postMessage({staticChild: typeof RTCPeerConnection}, '*')</script>"></iframe>+<link id="static-preconnect" rel="preconnect" href="http://127.0.0.1:9/?via=static-preconnect">+<script id="static-rules" type="speculationrules">{"prefetch":[{"source":"list","urls":["http://127.0.0.1:9/?via=static-rules"]}]}</script><script>// Hostile on purpose: tries every way out of the sandbox and records what happened.var seenPorts = 0;@@ -98,6 +109,111 @@ window.beacon.getTrace().then(async function (data) {try { window.RTCPeerConnection = function () {}; } catch (e) {}return window.RTCPeerConnection;});+ // A child frame is a fresh realm the prelude never ran in. The prelude refuses to create one, and+ // each of these probes would still pass if it did not, as long as the parent cannot reach a peer+ // connection constructor through the child.+ function childFrame(setup) {+ var f = document.createElement("iframe");+ if (setup) setup(f);+ document.body.appendChild(f);+ return f;+ }+ r.rtcChildNoSrc = await rtcReachable(function () { return childFrame().contentWindow.RTCPeerConnection; });+ r.rtcChildAboutBlank = await rtcReachable(function () {+ return childFrame(function (f) { f.src = "about:blank"; }).contentWindow.RTCPeerConnection;+ });+ r.rtcChildSrcdoc = await rtcReachable(function () {+ var f = childFrame(function (f) { f.srcdoc = "<p>child</p>"; });+ return new Promise(function (resolve, reject) {+ f.onload = function () { try { resolve(f.contentWindow.RTCPeerConnection); } catch (e) { reject(e); } };+ setTimeout(function () { reject(new Error("timeout")); }, 2000);+ });+ });+ r.rtcChildDocumentWrite = await rtcReachable(function () {+ var d = childFrame().contentDocument;+ d.open(); d.write("<p>child</p>"); d.close();+ return d.defaultView.RTCPeerConnection;+ });+ r.rtcChildIndexed = await rtcReachable(function () {+ childFrame();+ return window[window.length - 1].RTCPeerConnection;+ });+ r.rtcChildFrames = await rtcReachable(function () {+ childFrame();+ return window.frames[window.frames.length - 1].RTCPeerConnection;+ });+ // A srcdoc child runs its own scripts, so it is asked what it sees rather than read from outside.+ // Only the prelude's refusal to create the frame stops this one.+ r.rtcChildOwnScript = await attempt(function () {+ return new Promise(function (resolve, reject) {+ var f = childFrame(function (f) {+ f.srcdoc = "<script>parent.postMessage({rtcChild: typeof RTCPeerConnection}, '*')<\/script>";+ });+ window.addEventListener("message", function (event) {+ if (event.source !== f.contentWindow || !event.data || !("rtcChild" in event.data)) return;+ if (event.data.rtcChild === "function") resolve(event.data.rtcChild); else reject(new Error(event.data.rtcChild));+ });+ setTimeout(function () { reject(new Error("timeout")); }, 2000);+ });+ });+ // Every other way of putting a frame, a resource hint or speculation rules into the document.+ // Each passes only if the prelude refused it (or, for the file's own markup, removed it).+ var childMarkup = '<iframe srcdoc="<script>parent.postMessage({rtcChild: typeof RTCPeerConnection}, \'*\')<\/script>"></iframe>';+ var hintMarkup = '<link rel="preconnect" href="http://127.0.0.1:9/?via=markup-preconnect">';+ var rulesMarkup = '<script type="speculationrules">{"prefetch":[{"source":"list","urls":["http://127.0.0.1:9/?via=markup-rules"]}]}<\/script>';+ function added(fn) { return attempt(function () { fn(); return "added"; }); }+ function holder() { var d = document.createElement("div"); document.body.appendChild(d); return d; }+ r.frameCreateNS = await added(function () { document.createElementNS("http://www.w3.org/1999/xhtml", "x:IFRAME".toLowerCase()); });+ r.frameInnerHTML = await added(function () { holder().innerHTML = childMarkup; });+ r.frameOuterHTML = await added(function () { holder().outerHTML = childMarkup; });+ r.frameInsertAdjacentHTML = await added(function () { holder().insertAdjacentHTML("beforeend", childMarkup); });+ r.frameSetHTMLUnsafe = await added(function () {+ holder().setHTMLUnsafe('<div><template shadowrootmode="open">' + childMarkup + "</template></div>");+ });+ // Writing to the lens's own document after load would replace it, results and all; the guard is on+ // Document.prototype, so a spare document shows whether write is refused.+ r.frameDocumentWrite = await added(function () { document.implementation.createHTMLDocument("").write(childMarkup); });+ r.frameParsedAdopt = await added(function () {+ var parsed = new DOMParser().parseFromString(childMarkup, "text/html");+ holder().appendChild(document.importNode(parsed.body.firstChild, true));+ });+ r.frameFragment = await added(function () {+ holder().append(document.createRange().createContextualFragment(childMarkup));+ });+ r.frameShadow = await added(function () {+ var root = holder().attachShadow({ mode: "closed" });+ root.innerHTML = childMarkup;+ });+ r.frameTemplateClone = await added(function () {+ var t = document.createElement("template");+ t.innerHTML = "<p>inert</p>";+ t.content.firstChild.replaceWith(new DOMParser().parseFromString(childMarkup, "text/html").body.firstChild);+ holder().appendChild(t.content.cloneNode(true));+ });+ r.frameStatic = staticChildMessages.length ? "allowed:" + staticChildMessages[0]+ : document.getElementById("static-frame") ? "present" : "blocked";+ r.hintCreate = await added(function () { document.createElement("LINK"); });+ r.hintInnerHTML = await added(function () { holder().innerHTML = hintMarkup; });+ r.hintStatic = document.getElementById("static-preconnect") ? "present" : "blocked";+ r.rulesTypeProperty = await added(function () {+ var sc = document.createElement("script");+ sc.type = " SpeculationRules ";+ sc.textContent = '{"prefetch":[{"source":"list","urls":["http://127.0.0.1:9/?via=dom-rules"]}]}';+ document.head.appendChild(sc);+ });+ r.rulesSetAttribute = await added(function () {+ var sc = document.createElement("script");+ sc.setAttribute("TYPE", "speculationrules");+ });+ r.rulesMutateManifest = await added(function () {+ var manifest = document.querySelector('script[type="application/beacon-lens+json"]');+ manifest.setAttribute("type", "speculationrules");+ });+ r.rulesInnerHTML = await added(function () { holder().innerHTML = rulesMarkup; });+ r.rulesStatic = document.getElementById("static-rules") ? "present" : "blocked";+ // A static child that escaped the guard would have posted by now.+ await new Promise(function (resolve) { setTimeout(resolve, 500); });+ if (staticChildMessages.length) r.frameStatic = "allowed:" + staticChildMessages[0];r.dnsPrefetchMeta = !!document.querySelector('meta[http-equiv="x-dns-prefetch-control"][content="off"]');r.origin = self.origin;r.seenPorts = seenPorts;diff --git a/cli/beacon/internal/endpoint/dashboard/testdata/lens-e2e/tests/lenses.spec.ts b/cli/beacon/internal/endpoint/dashboard/testdata/lens-e2e/tests/lenses.spec.tsindex 1d5d7b39..d1aa52e8 100644--- a/cli/beacon/internal/endpoint/dashboard/testdata/lens-e2e/tests/lenses.spec.ts+++ b/cli/beacon/internal/endpoint/dashboard/testdata/lens-e2e/tests/lenses.spec.ts@@ -79,6 +79,15 @@ test('a lens cannot reach the network, the dashboard, storage or code evaluation'fetchSameOrigin', 'fetchRemote', 'xhr', 'websocket', 'image', 'nestedFrame','parentDocument', 'topLocation', 'localStorage', 'cookie', 'eval', 'newFunction', 'popup', 'worker','rtcDirect', 'rtcComputed', 'rtcWebkit', 'rtcDataChannel', 'rtcDelete', 'rtcRedefine',+ // Reaching a fresh realm through a child frame, then every way to put a frame, a resource hint+ // or speculation rules into the document. The prelude's guard is best-effort hardening; these+ // pin the paths it covers.+ 'rtcChildNoSrc', 'rtcChildAboutBlank', 'rtcChildSrcdoc', 'rtcChildDocumentWrite', 'rtcChildIndexed',+ 'rtcChildFrames', 'rtcChildOwnScript',+ 'frameCreateNS', 'frameInnerHTML', 'frameOuterHTML', 'frameInsertAdjacentHTML', 'frameSetHTMLUnsafe',+ 'frameDocumentWrite', 'frameParsedAdopt', 'frameFragment', 'frameShadow', 'frameTemplateClone', 'frameStatic',+ 'hintCreate', 'hintInnerHTML', 'hintStatic',+ 'rulesTypeProperty', 'rulesSetAttribute', 'rulesMutateManifest', 'rulesInnerHTML', 'rulesStatic',]) {expect(r[probe], probe).toBe('blocked');}diff --git a/cli/beacon/internal/endpoint/lensstore/lint.go b/cli/beacon/internal/endpoint/lensstore/lint.goindex 319f0d9c..210fc762 100644--- a/cli/beacon/internal/endpoint/lensstore/lint.go+++ b/cli/beacon/internal/endpoint/lensstore/lint.go@@ -28,8 +28,10 @@ var lintChecks = []struct {pattern *regexp.Regexpmessage string}{- {regexp.MustCompile(`\.(innerHTML|outerHTML)\s*[+]?=|insertAdjacentHTML\s*\(|document\.write(ln)?\s*\(`),+ {regexp.MustCompile(`\.(innerHTML|outerHTML)\s*[+]?=|insertAdjacentHTML\s*\(`),"parses a string as HTML; trace content is untrusted, so build nodes with textContent"},+ {regexp.MustCompile(`document\.write(ln)?\s*\(`),+ "uses document.write, which the lens frame refuses; build nodes with textContent"},{regexp.MustCompile(`\beval\s*\(|\bnew\s+Function\s*\(|setTimeout\s*\(\s*["'` + "`" + `]`),"evaluates a string as code, which the lens CSP blocks"},{regexp.MustCompile(`\bfetch\s*\(|\bXMLHttpRequest\b|\bnew\s+WebSocket\b|\bnew\s+EventSource\b|\bsendBeacon\s*\(`),@@ -48,6 +50,14 @@ var lintChecks = []struct {"starts a worker, which the lens CSP blocks"},{regexp.MustCompile(`\b(webkit)?RTC(PeerConnection|DataChannel)\b`),"uses WebRTC, which the lens frame removes; everything comes from getTrace()"},+ {regexp.MustCompile(`(?i)<\s*(iframe|frame|frameset|object|embed|portal|fencedframe)\b|createElement(NS)?\s*\([^)]*["'](\w+:)?(iframe|frame|object|embed|portal|fencedframe)["']|\bsrcdoc\b`),+ "creates a nested frame, which the lens frame refuses; a frame is a fresh page outside the lens's hardening"},+ {regexp.MustCompile(`(?i)<\s*link\b|createElement(NS)?\s*\([^)]*["'](\w+:)?link["']|\b(preconnect|prefetch|prerender|dns-prefetch|modulepreload)\b`),+ "adds a <link> or resource hint, which the lens frame refuses: a lens loads nothing by URL, and hints like preconnect can start requests the CSP does not see"},+ {regexp.MustCompile(`(?i)\bspeculationrules\b`),+ "adds speculation rules, which the lens frame refuses: they can start requests the CSP does not see"},+ {regexp.MustCompile(`(?i)\bshadowrootmode\b`),+ "declares a shadow root in markup; keep the lens in its own document, where the lens frame's hardening can see it"},}// Lint checks a lens file against spec/lenses/SPEC.md. The file-level rules (size, manifest) arediff --git a/cli/beacon/internal/endpoint/lensstore/lint_test.go b/cli/beacon/internal/endpoint/lensstore/lint_test.goindex 79430221..38944ed3 100644--- a/cli/beacon/internal/endpoint/lensstore/lint_test.go+++ b/cli/beacon/internal/endpoint/lensstore/lint_test.go@@ -26,6 +26,16 @@ func TestLintFlagsWhatTheSandboxBlocks(t *testing.T) {`main { height: 100vh }`: "viewport",`new Worker(url)`: "worker",`new RTCPeerConnection(config)`: "WebRTC",+ `document.write("<p>x</p>")`: "document.write",+ `<iframe srcdoc="<p>x</p>"></iframe>`: "nested frame",+ `document.createElement("IFRAME")`: "nested frame",+ `frame.srcdoc = markup`: "nested frame",+ `<embed src="data:,x">`: "nested frame",+ `<link rel="preconnect" href="https://x">`: "resource hint",+ `document.createElement('link')`: "resource hint",+ `hint.rel = "dns-prefetch"`: "resource hint",+ `script.type = "speculationrules"`: "speculation rules",+ `<template shadowrootmode="closed"></template>`: "shadow root",}for line, want := range cases {html := "<!doctype html>\n" + lintManifest + "\n<script>window.beacon.getTrace()</script>\n" + line + "\n"