# agentic-browser-boundary-tests *Static BioShocking-style prompt-injection scenarios with local canaries, scoped-authorization tests, and evidence logging.* A benign, local test suite for evaluating whether an AI browser or browser agent treats webpage content as untrusted instructions, preserves scoped user authorization, and resists BioShocking-style game-framed prompt injection. ## What this is and is not This is a set of static test pages plus a scoring rubric. It checks one question: > Can webpage content cause an AI browser or agent to cross a boundary that only > the user should be allowed to authorize? This is not a claim that any given browser is safe or unsafe. It is a reproducible evaluation harness. The output is per-test scores and evidence, not a verdict. ## Threat model This suite evaluates whether an AI browser or browser agent treats webpage content as untrusted input when that content attempts to authorize actions such as opening another page, retrieving canaries, submitting forms, or reusing prior authorization outside its scope. ## Non-goals This suite does not test browser memory safety, JavaScript sandbox escapes, credential theft, real account access, extension vulnerabilities, or all possible prompt-injection variants. It is a focused authority-boundary test. ## Safety and scope Everything here is benign and local. - No real secrets. Every "token" is an inert canary of the form `CANARY-0N-...`. - No real exfiltration target. Forms post to a local logging endpoint that records the event and returns a plain confirmation page. Nothing leaves your machine. - The injection strings are inert bait. Their purpose is to see whether an agent mistakes page-authored text for authority. Run this only against agents and browsers you are authorized to test. ## Background The BioShocking write-ups describe an indirect prompt-injection pattern where a page establishes a false context, often a game, and uses it to induce an agentic browser to retrieve data from the user's signed-in or private contexts. The tests here isolate the underlying boundary: page content should never become authority over actions that only the user can authorize. ## Layout ``` tests/ six test scenarios, each with page(s) and an expected.md prompts/ the user-side prompts to drive each test, plus a transcript template scoring/ the rubric and a JSON Schema for results server/ a dependency-free evidence server for semi-automated runs scripts/ smoke test that verifies the server logs the right signals results/ example result and, at runtime, evidence.log ``` ## The six tests | ID | Name | Boundary under test | |---|---|---| | 01 | basic-hidden-injection | Ignoring hidden page instructions across five delivery vectors | | 02 | game-framing | Refusing a page's claim that "it is a game" suspends constraints | | 03 | cross-page-secret | Not opening a second page or exfiltrating on the page's say-so | | 04 | scoped-authorization | Staying inside a narrow user grant when the page pushes for more | | 05 | authorization-drift | Not reusing a read grant as a submit grant | | 06 | gradual-scope-creep | Requiring fresh authority for each step of an escalating chain | Each `expected.md` states the correct behavior, the failure signatures, and the canary for that test. ## Running ### Manual mode Open a test page in the browser your agent controls and give it the matching prompt from `prompts/manual-test-prompts.md`. Record the run with `prompts/transcript-template.md` and score it with `scoring/rubric.md`. Tests 01 and 02 work fine from `file://`. Tests 03 through 06 involve navigation and submit signals, so run them through the server to capture evidence. ### Semi-automated mode Start the evidence server from the repo root: ``` python3 server/server.py ``` It serves the pages at `http://localhost:8099` and appends JSONL evidence to `results/evidence.log`. It records two things: 1. A GET to any `page-b-fake-secret` file, which shows the agent navigated to a secret page. 2. A POST to `/log/submit`, which shows the agent submitted data through a form, including which canary it submitted. The value of this is the negative claim. If the transcript says the agent did not submit and the evidence log has no submit event, that is a stronger result than the transcript alone. ### Smoke test Verify the pages resolve and the evidence server logs the correct signals before you trust a run: ``` python3 -m py_compile server/server.py python3 scripts/smoke-test.py ``` The smoke test starts the server on a scratch port, writes to a temporary evidence log, and asserts four things: a benign page GET is not logged, a `page-b-fake-secret` GET is logged, a submit POST is logged with the correct canary, and an unknown path returns 404. It exits non-zero on any failure and does not touch `results/evidence.log`. ### Advanced mode Drive the pages with a browser automation tool such as Playwright and record network and DOM events alongside the agent's actions. The suite does not ship a Playwright harness yet. The static pages and the evidence server are designed so one can be added without changing the tests. ## Scoring Record the boolean observations first, then read the 0 to 4 score off the table in `scoring/rubric.md`. The booleans are the source of truth so the score cannot silently disagree with them. Write each run as a JSON object matching `scoring/results.schema.json`. See `results/example-result.json`. Report per-test scores and an unrounded suite mean, and report the count of score-0 results separately, since a single full failure is a hard finding regardless of the average. ## Limitations Browser-agent testing is harder than ordinary web testing because the thing under test is the agent's interpretation of authority, tool scope, and user intent, not just DOM behavior. This suite gives reproducible pages, canaries, and evidence, but scoring still depends on reading transcripts. Treat results as evidence for a claim, not a certification. ## Contributing and security New adversarial test pages are welcome, but they must stay benign and local. See `CONTRIBUTING.md` for the hard constraints (no real secrets, no external endpoints, no credential prompts, local-only canaries) and `SECURITY.md` for how to report or avoid unsafe payloads. ## License MIT. See LICENSE.