Skip to main content

Module app

Module app 

Source
Expand description

HTTP routes for the local dashboard.

Structs§

AppState
LoginThrottle
How long a wrong token buys the next attempt. Nothing on this path had a delay, a counter or a 429: guessing was free, and MIN_TOKEN_LEN allows a 32-character token, which is not a number an attacker cannot reach given unlimited attempts.

Constants§

CHAT_BODY_LIMIT
The most one chat message may weigh. A paste over this is refused by name rather than by axum’s own 413, which says nothing a person can act on.
MAX_CONCURRENT_CHATS
Agent runs allowed in flight at once; further chat requests get HTTP 429. One semaphore for every route that can start a run: the dashboard and the gateway must not each believe they are the only caller.

Functions§

guard_local_origin
Defends the local dashboard against DNS-rebinding and cross-site requests: the Host header must name a loopback host, and a request that changes something must either come from this origin or carry the session’s CSRF token (arrival_refusal explains the three ways through). All responses also get headers that stop framing, sniffing and external loads.
router
The dashboard on its own: every route above with its state.
routes
The dashboard’s routes, without the state applied: the gateway merges its own routes on before calling .with_state, so the origin guard is the only layer either side adds.

Type Aliases§

Shared