feat(gateway): authenticate the gRPC contract and allow off-loopback listeners

The Gateway had no transport boundary: RunGateway refused any non-loopback
listen address and serveGateway registered no interceptor, so archie-ui was
colocation-only while the State Store already had a token-authenticated
equivalent.

gatewayrpc gains a gateway-token metadata credential with constant-time
comparison and both unary and stream interceptors on each side. Stream
coverage is required here and not in staterpc: the Gateway's Stream RPC is
server-streaming. Dial fails closed on a non-loopback target with no token,
mirroring staterpc.Dial. gatewayServerOpts applies the same rule server-side:
loopback stays insecure, non-loopback requires a token, malformed errors.

The daemon resolves [services.gateway].target_token then GATEWAY_TOKEN;
archie-ui passes the token its config projection already carried, so a
distributed dashboard is now possible.

Closes: archie-core-juqx
This commit is contained in:
sam committed 2026-09-09 00:27:03 +10:00
1 parent 73d371614b
commit 0ec4ececd5
13 files changed
+453 -33

No files matched your search

+5
View File
@@ -265,6 +265,11 @@ gate_max_failures = 5
# docs/prds/state-store-contract.md).
# [services.gateway]
# target = "127.0.0.1:8585" # archie-gateway's gRPC address (always remote once set)
# target_token = "..." # Bearer [REDACTED] for a NON-loopback listener. A loopback listener
# # (127.0.0.1/::1/localhost) needs no token. A non-loopback
# # listener without a token fails closed, as does a
# # non-loopback dial without one. The same token is
# # presented as GATEWAY_TOKEN by remote consumers.
# [services.state]
# target = "127.0.0.1:9090" # REQUIRED. The State Store gRPC address archied and