Skip to main content

Module operator_proof

Module operator_proof 

Source
Expand description

Proof that a websocket connection is the AgentMux window’s.

Every agent holds the instance auth key, so a connection that never sent bus:register proves nothing by itself. Operator-only actions need the host’s proof (RpcContext::operator_only):

  1. the window asks srv for a challenge over its own websocket (operator.challenge) and gets a single-use nonce bound to that connection;
  2. it hands the nonce to the CEF host (operator_attest), which posts it to POST /api/v1/host/operator_attest with its IPC token, which agents never see;
  3. srv marks the connection the nonce was issued to as the operator’s.

A nonce is used once and expires after TTL. Registering the connection as an agent afterwards drops the proof (WshRpcEngine::set_rpc_context).

A headless srv has no CEF host. A browser the person signed in there (a confirmed local_session, which the person approved by comparing a check phrase in a terminal) is their window too: vouch_for_signed_in_browser gives its connection the same proof. An agent never has such a session: it holds the key, which takes the other path in auth_middleware.

Structs§

AttestRequest 🔒
Challenges 🔒
Challenges waiting for the host, by nonce.
OperatorChallengeResult
operator.challenge’s answer: the nonce to hand to the CEF host.
Pending 🔒

Constants§

COMMAND_OPERATOR_CHALLENGE
MAX_PENDING 🔒
The most challenges waiting at once; past it the oldest is dropped.
TTL 🔒
How long a challenge waits for the host’s attestation.

Statics§

CHALLENGES 🔒

Functions§

attest
Spend nonce and mark the connection it was issued to as the operator’s. False when the nonce is unknown, used, expired, its connection closed, or that connection has registered as an agent.
challenges 🔒
handle_host_attest 🔒
POST /api/v1/host/operator_attest: the CEF host vouches, with its own token, for the connection a challenge was issued to. The instance auth key, which every agent has, isn’t enough.
issue
A fresh single-use nonce bound to engine’s connection.
peek_engine 🔒
The connection nonce was issued to, without spending it (a registered external host asks which connection a challenge belongs to before it signs: server::external_host).
register_challenge 🔒
Register operator.challenge on one connection’s engine. The handler holds only a weak reference to the engine that owns it.
take_engine 🔒
Spend nonce and hand back the connection it was issued to, for a caller that decides whether to mark it (server::external_host). The nonce is spent either way.
vouch_for_signed_in_browser 🔒
Mark a connection the person’s when a browser they signed in opened it (session is set only for a confirmed local session). The proof is dropped again if the connection registers as an agent, like the app window’s.