How would you secure a browser agent that acts inside the user's logged-in browser?
Type it the way you would explain it to an interviewer. A few sentences is enough; you can't break anything.
Model answer: the part to lead with
Assume injection will land and design so it cannot do much. A browser agent is the lethal trifecta in one tool: every logged-in tab is private data, every page is untrusted content, and every navigation, form submit and URL is an exfiltration channel. It also acts with the user's cookies: a confused deputy holding all of the user's ambient authority.
Full worked answer with diagram
Assume injection will land and design so it cannot do much. A browser agent is the lethal trifecta in one tool: every logged-in tab is private data, every page is untrusted content, and every navigation, form submit and URL is an exfiltration channel. It also acts with the user's cookies: a confused deputy holding all of the user's ambient authority.
The interview point: the same-origin policy does not protect you. SOP stops one site's script reading another site's data. An agent reads page A and acts on page B, so it becomes exactly the cross-origin bridge SOP exists to prevent. A forum comment can tell the agent to open the user's webmail and forward something.
Controls, all outside the model:
- Isolated profile holding only the sessions the task needs, not the everyday profile with every login.
- Origin scoping per task. The task declares which sites it needs. Reading a site does not grant acting on it, and a new origin needs approval.
- Action gating by category. Purchases, messages, submitting personal data, account settings, permission prompts and downloads stop for confirmation showing the concrete effect, not the agent's description of it.
- The agent never types credentials or payment details. Hand those steps to the user or a password manager.
- Navigation is egress. Watch for URLs carrying data in query strings, and allowlist where you can.
- Page content is untrusted. Only the user's instruction is trusted. Scan the text the model actually consumes, including hidden DOM and accessibility labels.
- Record for replay. Screenshots and actions per step, with a per-session stop.
Vendors shipping browser agents in 2025 publicly called prompt injection unsolved and reported non-zero attack success even with mitigations, so keep high-stakes sites such as banking, health and email in a watch-only mode until the controls have earned trust.
Worth sketching. One policy gate, three outcomes: the model proposes, and something outside it decides by category.
flowchart LR
A["User task, trusted"] --> B["Agent in an isolated profile"]
C["Page content, untrusted"] --> B
B --> D["Policy gate outside the model"]
D -->|"read on an allowlisted origin"| E["Proceed and log"]
D -->|"submit, buy, send or new origin"| F["User confirms the concrete effect"]
D -->|"credential or payment entry"| G["Hand off to the user"]
What a good answer covers
- Assume injection will land and design so it cannot do much
- A browser agent is the lethal trifecta in one tool
- It also acts with the user's cookies: a confused deputy holding all of the user's ambient authority
- SOP stops one site's script reading another site's data
- An agent reads page A and acts on page B, so it becomes exactly the cross-origin bridge SOP exists to prevent
Key terms: Isolated profile · Origin scoping per task · Action gating by category · Navigation is egress · Page content is untrusted · Record for replay
In the glossary: Lethal trifecta · Exfiltration channel · Confused deputy · Prompt injection
Interviewer follow-ups to expect
The task genuinely needs the agent to read an email and then act on a different site. How do you keep that useful without rebuilding the cross-origin bridge?
What would you show the user at a confirmation step so that they can actually evaluate it rather than click through?
Worked answer from AI-Engineer-Interview-Questions by Om (MIT), reformatted for LLM Prep · answer text last updated 6 November 2026 · scoring and review schedule by LLM Prep