Secure agentic autofill keeps AI agents from leaking passwords. Learn how agents get credentials, how those leak, and the guardrails that stop it.
Secure agentic autofill means an AI agent can sign in to the sites its task needs without the credential ever entering the model's context, and without the credential working on any origin other than the one it belongs to. The guardrails that get you there are origin-locked credentials, destination allowlists, a watermark on agent traffic, and human approval for high-risk steps.
Agents need to log in to be useful, and every way of giving them that access is also a way for it to leak. Here is how agents get credentials, how those credentials escape, and the controls that keep them where they belong.
How AI agents get credentials
There are four common routes, and most deployments use more than one.
- Browser autofill. The agent drives a browser profile with saved passwords, and the browser fills the login form.
- Password manager autofill. A password manager fills the form for the agent. 1Password's Secure Agentic Autofill, launched in early access with Browserbase in October 2025, is designed so that "the AI agent and underlying LLM never need to see nor handle the credentials." It injects credentials through the 1Password browser extension, and by default only after a human approves the request.
- Injected secrets. An automation script pulls a password or API key from an environment variable or vault and types it into the page. If the secret is also placed in the agent's prompt, the model now holds it.
- Inherited sessions. The agent runs in a profile that is already signed in. It never sees a password, but it can use every session cookie in that profile. This is how an AI browser working in an employee's own profile operates.
The first two can keep the secret out of the model. The last two are common, and riskier.
How agent credentials leak
The wrong origin
Browser and password manager autofill is tied to the site, which is a real protection. Injected secrets are not: a script or agent types them into whatever form is in front of it. A lookalike domain, a redirect, or a plain bug in the target URL is enough. A person might glance at the address bar. An agent following instructions will not.
Injected instructions
A prompt injection does not need the password to take over an account. In Brave's Comet research, hidden instructions had the agent request a one-time password, read it from the user's open Gmail, and post it publicly along with the user's email address. The agent used existing sessions to collect a second factor for the attacker.
Exfiltration from context
A secret in the model's context can be repeated. An injected instruction can ask the agent to put "your API key" into a form field, a URL, or a reply. Secrets that never enter the prompt cannot be repeated that way, which is why OWASP recommends keeping API tokens and sensitive functions in application code rather than handing them to the model.
The guardrails
Keep secrets out of the model
Use autofill that puts credentials into the page, not into the prompt. If a script must handle a secret, let the code fill the field directly and keep the value out of anything the model reads or writes.
Pin credentials to origins
Bind each credential to the origin it belongs to, and refuse to submit it anywhere else, whatever the page or the prompt says. This is the most useful single guardrail. It turns "the agent was tricked" into "the agent was tricked and nothing left."
Allowlist destinations
Most agent tasks touch a short list of domains. Define that list, and alert on anything outside it. A credential, token, or customer record heading to an unknown domain is the signal you want to see first.
Watermark agent traffic
Tag every request an agent makes with an identifier. Your SIEM, and any SaaS or proxy that can read the marker, can then tell agent activity from human activity and answer "which agent used this account, and where" after an incident.
Human approval for high-risk steps
Signing in to a new site, changing account settings, moving money, sending email, or exporting data should wait for a person. 1Password requires human approval for credential requests by default, and Anthropic's Claude for Chrome asks before high-risk actions such as publishing, purchasing, or sharing personal data. Agents you build should follow the same pattern.
A quick checklist
| Question | Good answer |
|---|---|
| Can the model read the password? | No. It goes into the page, not the prompt. |
| Can the credential be used on another origin? | No. It is pinned to its origin. |
| Do you know every domain the agent should reach? | Yes, and anything else raises an alert. |
| Can you tell agent activity from human activity? | Yes, agent traffic carries a watermark. |
| Who approves risky steps? | A named person, every time. |
| Does the agent profile hold only what it needs? | Yes, it is separate from anyone's daily browsing. |
For the broader set of agent risks these guardrails sit inside, see Agentic Browser Security: Risks and Controls.
How Surface helps
For agents running with Surface on Playwright, Puppeteer, Selenium, Browser Use, Stagehand, or a custom framework:
- Credentials are origin-locked by default (credential pinning).
- Domain allowlists raise exfiltration and domain-violation alerts.
- Agent traffic is tagged with a watermark header.
- Prompt injection is detected and sanitized, including hidden CSS text, Unicode steganography, and HTML comments.
Passwords never leave the endpoint: Surface works with HMAC-SHA256 fingerprints instead. Human approval is a step to build into your agent framework or password manager workflow.
See how the pieces fit in Agentic AI Security: Protecting Your AI-Powered Browser Agents, on the agentic AI technology page, and in the agentic AI browser security use case. If the agents in question are AI browsers employees installed themselves, start with What Is Shadow AI?