Skip to main content

Module credential

Module credential 

Source
Expand description

credential service — the paired CEF host’s browser-pane Basic-Auth credential broker calls this, host→srv, to resolve an identity for a pane and to look up / save / delete / fill a stored site credential.

Fill is the only method here that ever returns a plaintext password, and it’s called exactly once per approved use, at the moment the host is about to hand the credential to CEF’s AuthCallback::cont(). Lookup deliberately returns only a masked username — the credential-approval window (agentmux-cef, open_subwindow-based, see credential_broker there) uses Lookup to decide what to display, and must never receive the real password even transiently.

The sign-ins are Vault login entries kept per browser profile (crate::backend::vault::signins, spec SPEC_VAULT_GENERATE_CAPTURE_AND_BROWSER_SIGNINS_2026_10_28.md §5.4, §9.3). The host still calls the pane’s key identity_id; it is now the tab’s profile, personal or profile:<id>, and the host passes it back unread. This module is the /agentmux/service RPC surface over them, in the same shape as super::host_ipc (the other host→srv service module).

§Auth: host-only, NOT the shared X-AuthKey

Every method on this service requires args[1] to be this srv instance’s AGENTMUX_HOST_REG_SECRET, the same host-only credential host_ipc.Register proves (see that module’s doc comment and Config::host_reg_secret).

An earlier cut of this module gated on the instance-wide X-AuthKey alone, reasoning that — unlike host_ipc.Register’s “session-hijack-shaped” port+token — every method here only touches data scoped to a caller-supplied identity_id. That reasoning was wrong, and it defeated this feature’s entire stated security goal (reagent P0 on PR #2824). X-AuthKey is deliberately re-injected into every spawned agent’s own environment as AGENTMUX_AUTH_KEY (server/agent_handlers/input.rs), and AGENTMUX_BLOCKID is injected alongside it. So any agent could, with a plain curl from its own Shell tool:

  1. credential.ResolveIdentity with its own known block_id → identity_id
  2. credential.Fill with that identity_id plus the origin/realm it already knows (it is, after all, the thing browsing that site) → the plaintext password

…with no human approval window anywhere in the path. Fill uniquely returns a raw password, which is exactly the class of secret that needed host_ipc.Register’s treatment, not a weaker one.

The gate is applied to the whole service rather than to Fill alone: ResolveIdentity leaks identity_ids, Lookup confirms which sites have saved credentials, and Save/Delete let an agent plant or destroy them. None of those are things an agent should reach either, and a uniform gate cannot be defeated by finding the one method someone forgot to cover.

Note this proves caller is the host, not a human approved this exact use. That is the boundary the threat model needs — the host is the process that runs the approval window, so a capability token it mints for itself would add no defence against the attacker in question (an agent), only an internal consistency check within the host.

Structs§

FieldArgs 🔒
FormArgs 🔒
OfferArgs 🔒
ProtectionSpaceArgs 🔒
ResolveIdentityArgs 🔒
SaveArgs 🔒
SettledArgs 🔒
SignupArgs 🔒

Functions§

field_args 🔒
handle_change_sent 🔒
A password-change form a page in pane block_id sent: the password an agent made for it becomes the saved sign-in’s, or the password is offered “Update password?”. Never logged.
handle_credential_service 🔒
handle_delete 🔒
The site turned down a sign-in just filled: the Vault keeps it, marked, and stops offering it (see signins::refused); nothing is deleted.
handle_field_close 🔒
The person pressed elsewhere on the page in pane block_id.
handle_field_key 🔒
A key the list took in pane block_id.
handle_field_open 🔒
The person clicked, or pressed Up or Down, in a login field in pane block_id: the list of saved sign-ins (crate::server::browser_signin_list). The answer tells the host what the page’s listener is to be told.
handle_fill 🔒
The one method that returns a real, unmasked password. Called exactly once per approved credential use — see this module’s own doc comment.
handle_form 🔒
A frame of pane block_id of origin shows a sign-in form.
handle_lookup 🔒
handle_navigated 🔒
Pane block_id’s main frame loaded a new page: a held sign-in learns it went through, and the old page’s sign-in forms are gone.
handle_offer 🔒
A sign-in a page in pane block_id sent: held for “Save to Vault?” (crate::server::browser_signin_offer), never logged.
handle_resolve_identity 🔒
block_id → the profile its sign-ins are kept under: personal for a tab with no browser:identity, profile:<id> for a named profile’s tab.
handle_save 🔒
handle_settled 🔒
Pane block_id’s page moved on after a sign-in.
handle_signup 🔒
The person focused a field for a new password in pane block_id: its key button offers a strong password (crate::server::browser_signup).
handle_signup_sent 🔒
A sign-up form a page in pane block_id sent: it confirms the password made for it, or is offered “Save to Vault?”. Never logged.
host_caller_allowed 🔒
Some(error) when the caller failed to prove it’s the paired host — checked for EVERY method before dispatch, so a new method added later is gated by construction rather than by remembering to gate it.
lookup_shared 🔒
The profile holds no sign-in of its own for space: in an agent’s own profile, the login the person shared with that agent answers (crate::server::vault_prompt_share). The answer then also says shared, the agent, and approval: granted when the person already said yes to this use (the host answers the prompt without asking), ask when the host asks them as it does for the profile’s own.
mask_username 🔒
us***@example.com / ab*** style masking for the approval window’s display — enough for a human to recognize which saved login is being offered, not enough to be useful if somehow logged or screenshotted wrong. Keeps at most the first 2 characters before any masking.
reject_unless_host_caller 🔒