diff --git a/README.md b/README.md index 6f99f55..c4e4b28 100644 --- a/README.md +++ b/README.md @@ -48,8 +48,8 @@ flowchart LR auth-proxy runs in two deployment models. The gate's mechanisms — caller check, canonicalization, per-identity policy, credential swap, and audit — work the same in -both, and the planned `require_approval` mechanism ([#5](https://github.com/openabdev/auth-proxy/issues/5); -not implemented in Phase 1) is meant to behave the same in both. What changes is the trust +both. The sidecar `require_approval` mechanism ([#5](https://github.com/openabdev/auth-proxy/issues/5)) is still +planned and not implemented; standalone mode already has a `hold` verdict (see the Muse sections below). What changes is the trust scaffolding around the gate: who vouches for the caller, where the proxy sits, and where the real credential lives. @@ -65,13 +65,13 @@ flowchart LR UP1 ~~~ TP - subgraph STAND["Standalone service mode — third-party callers (under development)"] + subgraph STAND["Standalone service mode — third-party callers (Muse pilot implemented)"] TP["Third-party caller
Muse / Grok · pre-provisioned caller key"] GATE["auth-proxy
standalone service
on a user-controlled host"] UP2["Upstream APIs
Discord is the first consumer"] TP -->|"no registrar — caller key
provisioned out of band"| GATE - GATE -->|"platform vault path (proposed, under review): approval proof only
the platform's egress would swap the credential"| UP2 - GATE -->|"gate-held path (planned): gate holds the credential
swaps and forwards in-path"| UP2 + GATE -->|"platform vault path (proposed, not built): approval proof only
the platform's egress would swap the credential"| UP2 + GATE -->|"gate-held path (not built): gate holds the credential
swaps and forwards in-path"| UP2 end ``` @@ -94,15 +94,17 @@ control to credential control, in two sub-shapes. - **Gate-held path.** The gate holds the credential in its own store and forwards in-path. Once `require_approval` lands, this path would forward after approval. This is the shape described in [#5](https://github.com/openabdev/auth-proxy/issues/5). -- **Platform vault path (proposed, under review).** If the caller's platform has its +- **Platform vault path (proposed, not built).** If the caller's platform has its own vault and egress enforcement (Muse), the gate would hold no credential and stay out of the data path: it would issue a one-time approval proof bound to the request hash, and the platform's egress would swap in the credential. This is a new architecture that #5 does not contain and no design review has covered yet. It is not settled and is not part of Phase 1. -This mode is **under development** and is not part of Phase 1; its first consumer is -tracked in [#5](https://github.com/openabdev/auth-proxy/issues/5). +Neither sub-shape is built. What runs in standalone mode is the Muse gated passthrough below: the +caller's own `Authorization` passes through and the gate only decides. Stage 1, stage 2 (`hold`) and +asynchronous polling are implemented on main and in pilot use for one consumer and one upstream; that pilot is not +a general standalone product, and Phase 1 is unchanged. ## Muse gated passthrough (stage 1, pilot) @@ -120,10 +122,12 @@ and `deploy/muse/pilot-policy.example.toml`. Stage 2 adds a third verdict, `hold`, for writes the owner wants to approve one by one. A held request keeps its connection open. The gate tells the owner a request is waiting (a fixed text and a link, never -the content), the owner opens a separate approval page, and only an explicit approve forwards the request. +the content; with `[notify] buttons = true` the Telegram message also has Approve and Deny buttons and a no-login view link), the owner decides on the approval page or, with buttons, in Telegram, and only an explicit approve forwards the request. Deny, expiry (`hold_secs`), a caller who gives up, a policy reload that drops the identity, and shutdown -all end the request with a refusal and nothing sent upstream. The connection is the state: there is no -queue, and a restart forgets every held request. +all end the request with a refusal and nothing sent upstream. By default the connection is the state: there is no +queue, and a restart forgets every held request. A route can opt into asynchronous polling instead +(`hold_mode = "async"`): the POST returns 202 with a poll token, see `docs/design/muse-async-poll.md` and +the runbook `docs/runbooks/muse-stage2.md`. The gate constrains the agent, not the Muse platform. Muse's egress holds the real Discord token and can call Discord directly. A stolen caller key lets someone send requests as that identity (the per-identity diff --git a/docs/design/muse-async-poll.md b/docs/design/muse-async-poll.md index 96463c2..aef5304 100644 --- a/docs/design/muse-async-poll.md +++ b/docs/design/muse-async-poll.md @@ -1,8 +1,9 @@ # Muse async poll for held writes -Draft. Terms follow `muse-gated-passthrough.md` 3.4 and 4.5. +Status: implemented on main (#45); operator steps are in `docs/runbooks/muse-stage2.md`. Terms follow `muse-gated-passthrough.md` 3.4 and 4.5. ## Scope -Only the Muse route `POST /channels/*/messages` (held), per route. Config key `muse.hold_mode = -blocking|async` (default `blocking`); `async_hold_secs` applies only in `async`. Else unchanged. +Only the Muse route `POST /channels/*/messages` (held), per route. Config keys on the `[[route]]` table: `hold_mode = "blocking"|"async"` (default `blocking`) and +`async_hold_secs` (5..=600, default 120, used only in `async`). Async needs a passthrough route with a hold +grant; otherwise the policy is refused at load. Else unchanged. ## POST 1. Write the `held` audit record first. On failure refuse 503 `audit_unavailable`, before any entry exists and before any notification. @@ -25,7 +26,7 @@ anything else is 400, without revealing whether the token exists. Response is `p | `denied`, `expired`, `dropped`, `send_failed` | 200 | `status`, `request_id` | | `send_unknown` | 200 | `status`, `request_id`, `error_class` (`reset`, `timeout`, `write_failed`) | -`body` is at most 64 KiB, `truncated=true` if cut. The token is read-only and never approves, denies +`body` is a string (the Discord response as lossy UTF-8 text, which the caller parses itself), at most 64 KiB, `truncated=true` if cut. The token is read-only and never approves, denies or changes state. A final status stays readable for a fixed 60 s window starting at the final transition (for `approved_and_sent`, when the Discord response is fully read or cut at 64 KiB). After that, and for any unknown token, the response is a uniform 404. No retained-entry cap. @@ -54,7 +55,7 @@ current shape and never carry a token, `Authorization`, hash or body. Unapproved ## Departures Connection-as-state is replaced for this route. No cancel on Muse disconnect. Discord response headers are not returned verbatim. `X-AP-Decision` is not returned after admission. Fingerprint dedupe and supersede do not apply. -Owner confirmation of these four departures is needed before implementation. +These departures are as implemented. ## Tests Poll after each final status; uniform 404 after the window and for unknown tokens; `send_unknown` path; restart loses pending entries; audit shape with no token in audit. diff --git a/docs/design/muse-gated-passthrough.md b/docs/design/muse-gated-passthrough.md index 582c882..2d29c7d 100644 --- a/docs/design/muse-gated-passthrough.md +++ b/docs/design/muse-gated-passthrough.md @@ -1,8 +1,9 @@ # Muse gated passthrough: a hold-the-connection approval gate Status: stage 1 is implemented and measured. Stage 2 (held-connection approval) is implemented on -branch `feat/muse-stage2` and tested in CI against a mock upstream; it is not deployed, and the -through-the-front measurements (hold window, disconnect signal) are still open. Scope: a minimal proof +main (merged), in pilot use, and tested in CI against a mock upstream; the through-the-front hold window was measured in stage 1 +(a 300 s probe completed end to end, see docs/evidence/muse-stage1.md), and the disconnect signal is still open. The asynchronous route needs no long client connection. Asynchronous polling is also implemented on main, see +[muse-async-poll.md](muse-async-poll.md). Scope: a minimal proof of concept (PoC) for one consumer, Muse calling the Discord HTTP API through auth-proxy in standalone service mode. See "Stage 2 implementation notes" at the end of section 7 for where the code differs from this text. @@ -43,7 +44,8 @@ Stated by the owner and treated as fixed [A owner]: (section 3.5). Discord's own responses, including any `x-ap-*` headers they carry, pass through unchanged. 6. The connection is the state. There is no durable approved state, no polling endpoint and no one-time - proof. A crash after approval and before forwarding loses the held connection, nothing executes, and + proof. (For a route with `hold_mode = "async"` this is replaced: the POST returns 202 and the caller + polls, see [muse-async-poll.md](muse-async-poll.md). Nothing is durable there either.) A crash after approval and before forwarding loses the held connection, nothing executes, and Muse's retry starts a new approval round. ## 2. Overview @@ -451,7 +453,9 @@ owner's phone through a second `tailscale serve` mapping on its own port, never port; the ACL shape is in section 4.2 [A]. A local CLI over a Unix socket remains a fallback. The HTTP API is client-agnostic (`GET /pending`, `GET /pending/`, `POST /pending//approve|deny`), in line with the #6 decision that app shells are thin clients over the same endpoints [I issue #6 comment 1]. -WebAuthn approval over the digest is a later replacement for the credential step [I issue #6 comment 1]. +WebAuthn approval over the digest is a later replacement for the credential step [I issue #6 comment 1]. WebAuthn is a design only (`docs/design/webauthn-approval.md`), not implemented. + +Current state: with `[notify] buttons = true` the owner decides in Telegram with Approve and Deny buttons, and the message carries a no-login one-time view link (PR #41). The Basic-auth page and CSRF code remain and are used when `buttons = false`; they are not the primary path. Page controls: @@ -460,10 +464,10 @@ Page controls: - `approve` and `deny` are form `POST`s. A browser sends Basic credentials automatically, so each page carries a per-page CSRF token (random, bound to the entry id, single use) that the POST must echo. - Every approval response, including errors, carries `Content-Security-Policy: default-src 'none'; - frame-ancestors 'none'; form-action 'self'`, `X-Frame-Options: DENY`, `Referrer-Policy: no-referrer`, + style-src 'sha256-'; frame-ancestors 'none'; form-action 'self'`, `X-Frame-Options: DENY`, `Referrer-Policy: no-referrer`, `Cache-Control: no-store`, `Pragma: no-cache` and `X-Content-Type-Options: nosniff`. `default-src` does not cover `frame-ancestors`, so it is named, which stops a page framing the approve button over the - owner's cached Basic credentials. The page has no script and no inline style, and renders the body and + owner's cached Basic credentials. The page has no script and no `style` attributes; its one inline `