building awe.

Your browser agent reads every extension's DOM as the site's

Agents driving a real Chrome profile read coupon popovers and password badges as page text. Diff against a clean profile and drop nodes the site didn't serve.

Chad Priest / / 5 min read

If your agent drives a real, logged-in Chrome profile, it reads every installed extension’s injected DOM as though the site had served it. A content script that adds a coupon popover, a password-manager badge or a grammar overlay writes into the same document the page wrote. That content then shows up in the accessibility tree and the DOM snapshot, and the model treats it as the merchant’s text. Nothing in that snapshot marks where a node came from.

I was wrong about the boundary. I treated “what the agent sees” and “what the site sent” as the same thing. On a real profile they are not.

I’ll be plain about what I’ve tested. The check below uses Playwright driving Google Chrome, and that’s the only harness I’ve run it on. By the same reasoning, browser-use, Stagehand, computer-use agents reading the accessibility tree, and MCP browser servers that sell “your real Chrome, already logged in” should all be exposed, because they all read the same document. I haven’t run it against them, so treat that as a prediction, not a finding.

I’m also not pasting a captured diff. What I wrote down at the time was the conclusion, not the lines. Rebuilding the lines from memory would mean making them up, so the script prints yours instead.

Every node the agent observes needs an origin: the page or the agent

The class is untrusted third-party DOM reaching an agent’s observation unlabeled. The invariant:

Every node an agent observes is attributable to the page’s origin or to the agent itself, and anything else is dropped or labeled before it reaches the model.

Change exactly one variable: the extensions. Use the same copied profile with the same cookies, the same headed Chrome and the same URL. The only thing that changes is --disable-extensions.

Copy the profile first. Chrome 136 and later refuse remote-debugging switches on the default data directory, and Playwright drives Chrome through one of those switches. A copy also keeps the test away from your real profile’s files. Quit Chrome, then copy:

# macOS
cp -R "$HOME/Library/Application Support/Google/Chrome" /tmp/agent-profile
# Linux
cp -R "$HOME/.config/google-chrome" /tmp/agent-profile
# Windows: copy %LOCALAPPDATA%\Google\Chrome\User Data to C:\temp\agent-profile

The script opens the Default profile inside that directory. If your everyday profile is a different one (say Profile 1), add --profile-directory="Profile 1" to args below.

It runs three loads in this order: clean, extensions, clean. Any line that differs between the two clean runs is noise. A line counts as injected only if it appears in the extension run and in neither clean run. The script prints those lines and a count, then exits 1 if it found any.

# pip install playwright   (uses your installed Google Chrome via channel="chrome")
import sys
from playwright.sync_api import sync_playwright

PROFILE, URL = sys.argv[1], sys.argv[2]

def walk(n, acc):
    acc["iframes"] += n.get("nodeName") == "IFRAME"
    acc["shadow"] += len(n.get("shadowRoots", []))
    kids = n.get("children", []) + n.get("shadowRoots", [])
    if "contentDocument" in n:
        kids.append(n["contentDocument"])
    for k in kids:
        walk(k, acc)
    return acc

def load(p, extensions):
    ctx = p.chromium.launch_persistent_context(
        PROFILE, channel="chrome", headless=False,
        ignore_default_args=["--disable-extensions"],   # Playwright adds it by default
        args=[] if extensions else ["--disable-extensions"])
    page = ctx.new_page()
    page.goto(URL, wait_until="networkidle")
    page.wait_for_timeout(3000)                          # let content scripts finish
    lines = set(page.locator("body").aria_snapshot().splitlines())
    doc = ctx.new_cdp_session(page).send(
        "DOM.getDocument", {"depth": -1, "pierce": True})
    counts = walk(doc["root"], {"iframes": 0, "shadow": 0})
    ctx.close()
    return lines, counts

with sync_playwright() as p:
    a, ca = load(p, False)
    x, cx = load(p, True)
    b, cb = load(p, False)

injected = sorted(x - a - b)
for line in injected:
    print("+", line)
print(f"noise={len(a ^ b)} injected={len(injected)}")
print(f"iframes clean={ca['iframes']}/{cb['iframes']} ext={cx['iframes']}  "
      f"shadow roots clean={ca['shadow']}/{cb['shadow']} ext={cx['shadow']}")
extra_nodes = (cx["iframes"] > max(ca["iframes"], cb["iframes"])
               or cx["shadow"] > max(ca["shadow"], cb["shadow"]))
sys.exit(1 if injected or extra_nodes else 0)

Run it as python check.py /tmp/agent-profile https://… on a checkout page and on a login form. Exit 0 is a pass. Exit 1 means at least one accessibility-tree line, iframe or shadow root exists only when extensions are on. Each printed + line is text your model would have read as the site’s.

In my first draft, the second signal was a search for chrome-extension:// iframes. That gave false passes. Most extensions inject plain DOM or a shadow root from a content script, and the iframes they do create are often about:blank or have no src at all. This version counts every iframe and every shadow root, including closed ones, through CDP’s DOM.getDocument with pierce: true. It ignores src entirely and compares counts against both clean runs.

What it still misses:

  • Anything that appears only on interaction. Password badges usually show up when a field gets focus, so focus the field before snapshotting if you care about them.
  • Anything injected after the wait.
  • Edits to the site’s own nodes that leave the accessibility text unchanged.
  • Real noise. A rotating ad that changes on every load can land in the extension run alone and fail you. The script errs toward failing. If noise is large, rerun before trusting the result.

A MutationObserver sees the insertion but never the author

On its own, a node can’t tell you who inserted it. Content scripts run in an isolated JavaScript world, but they write into the same DOM. A MutationObserver installed at document start sees the insertion and never sees the author. I spent time on that path and it doesn’t get you attribution, only a timestamp.

What works is subtraction. On a copied profile, --disable-extensions keeps your cookies and saved logins and removes every content script. Run the agent that way and every node is attributable by construction: the page wrote it, or the agent did. It’s the clean side of the check above, promoted to production. The cost is that the agent loses whatever an extension was doing for you on purpose, such as a password manager filling a form. If you need that, have the agent do it itself, not through the extension.

If you have to run on a profile with extensions, the fallback is the comparison the script makes: a pierced DOM.getDocument with extensions off, taken as a baseline, and a drop list for anything outside it. That doubles every page load and falls apart on pages whose state changes as you act, like a cart or a half-submitted form. So I’d use it as an audit, not as a filter you depend on.

agent-browser’s trust boundary assumes the page wrote the page

Vercel’s agent-browser trust-boundaries note gets the posture right: snapshot output, aria-labels and dialog text are untrusted data, not instructions. But it describes all of it as “whatever the page chose to render.” On a real profile the page made no such choice. An origin allowlist won’t help either, because the injected node sits inside an allowed origin. SuperSurf runs its own DOM reads in an isolated world, so “page JS never sees the automation.” That protects the page from the agent. The page still sees other extensions, and so does your agent.

You do need to treat page content as untrusted, but that doesn’t go far enough. Treat the extension set as part of the input. Either run with none, or prove what they added and drop it before it reaches the prompt.