Skip to main content

Module host_ipc

Module host_ipc 

Source
Expand description

host_ipc service — the paired CEF host pushes its own CDP-automation credentials (ipc_port + ipc_token, gating /agentmux/browser/* on the host’s own IPC server) here once, at the host’s own startup, right after it learns this srv instance’s address. srv has no other way to learn these values — the host generates ipc_token for itself and is the sole source of truth.

Backs the /api/v1/ui/{screenshot,click,query} proxy routes (agent- facing UI automation). See AppState::host_ipc, crates/cef/src/client/helpers.rs::register_ipc_with_backend, and docs/specs/SPEC_AGENT_UI_AUTOMATION_CLICK_SCREENSHOT_2026_08_18.md.

Register requires a third argument, a shared secret (AppState::host_reg_secret / AGENTMUX_HOST_REG_SECRET) known only to srv and the paired host — never to any agent — proving the caller is really the host and not an agent process riding the same instance-wide X-AuthKey. See handle_register’s doc comments for the full threat model (reagent P0, PR #2662, 2026-08-19).

Functions§

handle_host_ipc_service 🔒
handle_register 🔒
secret_matches 🔒
Constant-time comparison of the caller-supplied secret against state.host_reg_secret, via the same “HMAC then Mac::verify_slice” idiom already used for the WhatsApp webhook signature check (messaging/whatsapp/webhook.rs) rather than a manual ==, so a mismatch can’t leak timing information about how many leading bytes matched. Not signing anything meaningful — both sides already hold the same static secret out-of-band (spawn-time env), so this is just a constant-time equality check dressed as a one-shot MAC. pub(super) so the credential service can reuse this exact check rather than growing a second constant-time comparison — it gates on the same AGENTMUX_HOST_REG_SECRET for the same reason (proving the caller is the paired host, not an agent riding the shared X-AuthKey). The NONCE below names host_ipc only because that was the first caller; it’s a locally-computed comparison salt on both sides of a single ==, never a wire format, so sharing it across callers is safe.