Skip to main content

Module dispatch_guard

Module dispatch_guard 

Source
Expand description

Which websocket connection may call which command, decided at dispatch.

The instance key opens /ws, and a native agent has it in its environment, so holding it proves nothing about who is calling. A command is the AgentMux window’s alone unless backend::rpc::action_access lists it:

  • a connection the host proved is the window (RpcContext::operator_proven_now) calls anything;
  • any connection calls an open command (OPEN: reads the window shows anyone who can open it, and the calls the handler itself decides per caller);
  • a connection registered as an agent reaches only the open commands and the ones whose handler checks the pane (OWN_PANE); everything else is refused, whatever the agent’s own rules say;
  • any other connection is refused with the words the app matches to prove the connection again.

A headless srv with no registered external host and no sign-in of its own has nothing that could vouch for a connection, so it admits an unproven one and logs once per connection (the same fallback as the composer’s agentinput, agent_handlers::composer_origin); with either present the guard is strict.

A dev build runs the guard like any other. AGENTMUX_DEV_OPEN_RPC=1, given when a dev instance is started, turns it off for the harnesses in tools/tests that drive an unproven connection; any other mode ignores it.

Structs§

Mode 🔒
What the decision reads besides the call: how this srv was started.

Enums§

Verdict 🔒

Constants§

DEV_SWITCH 🔒
The environment variable that turns the guard off, in a dev build only.

Functions§

decide 🔒
dev_open_from 🔒
The switch counts only in a dev build.
guard_with 🔒
install 🔒
Guard engine’s connection. The unproven-admission is logged once for this connection.
live_mode 🔒
mode 🔒
How this srv was started, read once.