Gateway transport security: authenticate and expose the gRPC contract off-loopback #1407
Notifications
Due Date
No due date set.
Depends on
Reference: sam/archie#1407
Reference in new issue
Block a user
RunGateway refuses any non-loopback listen address (internal/app/archied/gateway.go:84-86) and serveGateway registers a bare grpc.NewServer() with no auth interceptor (gateway.go:123); clients dial insecure with no credential (chat_service.go / gatewayrpc.Dial). The State Store already has the counterpart (staterpc.TaskGrants token interceptors plus the fail-closed non-loopback rule in staterpc.Dial); the Gateway does not.
Consequence today: any consumer of gateway.ChatContract must be colocated with the Gateway process. That is what scopes the new UI Service (cmd/archie-ui, internal/app/archieui, bead archie-core-8cda.5.2) to a single host: it dials [services.gateway].target insecure, so a distributed dashboard is not possible.
docs/prds/ui-service-boundary.md:123-124 requires 'Gateway and State Store credentials are service-to-service credentials', and lines 205-207 require that a wider surface be amended in the owning service's contract before implementation. So this belongs to the Gateway's contract, not to any UI bead.
Acceptance criteria
Close reason
Implemented and committed as 6c2440b. gatewayrpc gains a gateway-token metadata credential with constant-time comparison plus unary and stream interceptors both sides; Dial fails closed on non-loopback without a token; gatewayServerOpts mirrors staterpc server-side. Daemon resolves [services.gateway].target_token then GATEWAY_TOKEN; archie-ui passes its projected token. task check green on the host.
Imported from beads
archie-core-juqx· GitHub #781 · type task · priority P2 · created 2026-09-08 · closed 2026-09-08