# Security model for agent access

Source: https://botpassword.com/docs/security-model

In BotPassword no intent returns a secret value: one per-user daemon holds the keys, agents can reach only a limited endpoint, and what an agent sees is an outcome plus checked output, except through a grant that allows disclosure (credential helpers, `run_with`). By default a value is delivered sealed, where code the agent controls cannot read it; a grant can opt in to disclosing delivery, and BotPassword labels that grant "this agent can read this secret" (see [sealed and disclosing grants](#what-are-sealed-and-disclosing-grants)). The limits below are part of the design, not footnotes, and no independent review has been completed yet.

## Why is there a daemon?

`botpasswordd` is one process per user: a launchd agent on macOS, a per-user service on Windows, a systemd user unit on Linux later. It holds keys, the store, sync, policy and the broker. The desktop app, `bpw`, `bpw mcp`, the credential helpers and the browser bridge are all authenticated clients, so keys do not spread across several processes. One unlock state is shared by every desktop surface. The daemon is the key custodian because keys held only in a UI process would stop agents working whenever the window was closed.

## How are agents kept away from secrets?

The daemon exposes two separate local endpoints, each a Unix domain socket or Windows named pipe with a per-user ACL.

| Endpoint | Clients | Capabilities |
|---|---|---|
| `human` | Desktop app; mobile apps over the paired channel | Unlock, reveal, export, edit, device enrollment, grant creation and editing, recovery, approvals |
| `agent` | `bpw`, `bpw mcp`, credential helpers, native-messaging host (fill only) | The [agent intents](/docs/intents). No reveal, export, grant editing, enrollment or recovery. |

The agent endpoint has no code path to human-only operations. A message naming one is rejected by type before any policy runs. Each client authenticates per connection with a key enrolled at install time, plus peer-process checks. Messages are length-prefixed deterministic CBOR with bounded sizes.

## What are sealed and disclosing grants?

Every value-delivering intent names its delivery, and the daemon sets it, never the agent. **Sealed** delivery puts the value only where code the agent controls cannot read it: an HTTP request the daemon makes for the agent, a sealed `run_with` (Linux and macOS), or, planned and not built yet, a browser fill in an extension-only profile. **Disclosing** delivery puts the value where code BotPassword cannot vouch for can read it: a command or browser the agent controls, or a page in your own browser, where the page and other extensions can read what your paired extension filled. It needs the grant's `allow_disclosure` flag, the approval sheet lists each credential it covers, and company policy can forbid it. Command and credential-helper delivery (`run_with` with environment or file injection, and `cli_login` through the git, Docker, AWS and kubectl helpers) is always disclosing: the tool receives the value, and the agent, or code it runs, can read it there. The helpers answer only inside an agent session. Prefer `http_request` or a sealed `run_with` for API keys.

## How does a sealed `run_with` work?

On Linux and macOS, a `run_with` grant can name the hosts a credential may be sent to instead of allowing disclosure. The command then gets a random placeholder in place of the value, and its own HTTPS proxy for that one run. The proxy trusts a certificate authority made for the run, whose key exists only in the daemon's memory. When the command sends the placeholder in a header the grant names, in the grant's form, to one of the grant's hosts, the daemon checks that request against the grant and puts the real value in. The proxy serves only the command and the processes descended from it: another process of the same user that finds the proxy's address and token is refused. A response body the daemon cannot read (compressed, for example) is withheld. A request to any other host is refused before it leaves, and redirects are not followed. A command that ignores the proxy can send only the placeholder, which is useless anywhere else.

The command can still *use* the credential at the grant's hosts while it runs, and it could relay requests for another process: the check is about which process holds the connection, not why. Tools must honor `HTTPS_PROXY` and the run's trust file, and a tool that ignores either fails rather than falling back to the value. BotPassword's tests run `curl`, Node, Python and `git ls-remote` through the proxy, with Go on Linux. A process that outlives its parent, or a daemon a tool talks to, is refused. On Windows a sealed `run_with` answers `not_implemented`.

### What if the value comes back?

If a response from the grant's hosts, or the command's own output, holds the value in a form BotPassword recognizes, the agent gets the outcome `value_reflected` and none of that output. The command ends if one was running, the grant is revoked, and `bpw status` and the desktop app tell you. A command testing guesses at the value does this, and so does a real API that echoes the credential. Giving the agent access again is your decision. The same goes for `http_request`.

A response is also checked for the values of the agent's other grants that name the same host, so a host that stored one cannot hand it back. The check has limits:

- A value whose grants name only other hosts is not looked for. If some host hands it back, the agent gets it and you are not told.
- An encoding BotPassword does not recognize passes: an upper-cased, reversed or partial value, for example.
- A value over 2 KiB is recognized in fewer forms, with no JSON or HTML escapes.
- A process running as you can stop the record being stored, by holding the vault's file or by killing the daemon. If the file is only held, the grant stays gone while the daemon runs and the record follows when it can. If the daemon is killed first, the grant returns at restart and you are not told.

A sealed grant does not fully protect a value that can be guessed. A command can test guesses, one per request, and the guess that gets refused is the right one, so the agent can learn the value at the moment it loses the grant. If the value could be guessed, change it after a notice like this. Sealed delivery refuses a value under 16 bytes, and you should use a long, random one, never a person's password.

## What is redacted?

In a disclosing `run_with`, where the command already holds the value, the broker scrubs the values it injected, plus their base64, base64url, URL-encoded, hex, JSON-escaped and HTML-escaped forms, from the output relayed to an agent. Each is replaced with `[bpw:redacted]`, which does not say which item matched. Output is buffered just enough to catch values split across chunks. Sealed paths never use that marker for a known value, because it would tell a command which guess was right.

## What does the server see?

Only ciphertext and authorization metadata. The control plane validates outer headers, sizes and authentication and never decrypts. A random Account Root Key is wrapped by a key derived from your master password and an Account Secret, and a stolen server database would need both. Extensions and AutoFill providers unlock only with a biometric-gated Device Unlock Key and never run the password KDF.

## What are the honest limits?

- **Browsers can read what was filled.** BotPassword never sends the value to the agent. A browser the agent drives can read the filled page; in your own browser, the page and other extensions can. Both are labeled disclosing. An extension-only sealed mode is planned, not built yet.
- **Child processes hold the secret in disclosing `run_with`.** With environment or file injection the child process holds the value, and that process and other same-user processes can read it. This is the "direct process access" compatibility mode, presented as such. A sealed `run_with` gives the child only a placeholder, but a same-user process that reads the child's environment can use its proxy, and so the credential at the grant's hosts, while the run lasts.
- **Redaction is best effort.** It catches known values and simple encodings, not every transformation.
- **A sealed grant does not stop guessing.** It keeps the value from the command, and the first right guess ends the grant, but the agent can learn a guessable value that way. Use long, random values.
- **Same-user impersonation.** Attribution is meaningful, not strong isolation. Another process running as the same user can still try to impersonate a client. Self-reported `clientInfo` and model names are unverified labels.
- **Some steps need a human.** CAPTCHAs, device checks and email confirmations return `needs_human`.
- **Agents may still ask.** A harness may request confirmation for its own reasons.
- **Lost keys.** With every device lost, no kit and no opt-in Recovery Key, the vault is unrecoverable, and the app says so beforehand.
- **Independent review.** No independent assessment has been published yet. Reports appear on [/security/audits](/security/audits) as they are completed.

## How does this compare to pasting a key?

Pasting a key into chat leaves it in the transcript and in model context. With an intent, the agent holds a request reference and an outcome. That removes the transcript exposure; it does not remove the child-process and browser limits above.

## Can an agent update or reconfigure BotPassword?

No. Agents have no update capability; the desktop updater uses signed manifests hosted outside the agent-reachable path. Grants can only be edited through a human interface.

## Where is the deeper material?

- [/security/whitepaper](/security/whitepaper) for the protocol and key hierarchy.
- [/security/agents](/security/agents) for agent-specific security notes.
- [Grants and approvals](/docs/grants-and-approvals) and [Typed outcomes](/docs/typed-outcomes) for the policy side.
- [/security](/security) for the overview.
