Gateway transport security: authenticate and expose the gRPC contract off-loopback #1407

Closed
opened 2026-10-27 13:40:16 +00:00 by sam · 0 comments
Owner

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

  • The Gateway gRPC server accepts a non-loopback listen address only with a bearer token (or TLS) and fails closed without one, mirroring staterpc's rule.
  • gatewayrpc.Dial applies the same fail-closed check for a non-loopback target and presents the credential.
  • [services.gateway].target_token is consumed on both sides.
  • Tests cover loopback-without-token, non-loopback-without-token (refused) and non-loopback-with-token.

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

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 - The Gateway gRPC server accepts a non-loopback listen address only with a bearer token (or TLS) and fails closed without one, mirroring staterpc's rule. - gatewayrpc.Dial applies the same fail-closed check for a non-loopback target and presents the credential. - [services.gateway].target_token is consumed on both sides. - Tests cover loopback-without-token, non-loopback-without-token (refused) and non-loopback-with-token. ### 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_
sam added the mediumtask labels 2026-10-27 13:40:16 +00:00
sam self-assigned this 2026-10-27 13:40:16 +00:00
sam closed this issue 2026-10-27 13:40:16 +00:00
sam added a new dependency 2026-10-27 13:42:23 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#1407