fix(archieui): warn when the dashboard is reachable off-host over plain HTTP

The dashboard serves plain HTTP, so a non-loopback bind carries the
session cookie and provider token in clear unless TLS terminates in front.
Warn at startup unless the operator declares a proxy with
[web].trust_forwarded_headers, and record the choice in deployments/README
where the dashboard is deployed. Point the non-loopback token error at
that surviving doc, not the deleted UI-boundary PRD.
This commit is contained in:
sam committed 2026-10-10 22:09:05 +11:00
1 parent a6ac25876a
commit e01008ee92
3 files changed
+23 -1

No files matched your search

+8
View File
@@ -76,6 +76,14 @@ A non-loopback `[web].listen` requires a dashboard token (`-token`, or
binding-dispatch loop in `archied` consumes what arrives from the shared
State Store.
The dashboard speaks plain HTTP. A non-loopback bind therefore carries the
session cookie and the provider token in clear over the network, and
archie-ui warns about exactly that at startup. Terminate TLS in front of it
(a reverse proxy or the tunnel itself) and set
`[web].trust_forwarded_headers = true` to declare the proxy and silence the
warning; leaving it off while exposing the port directly is the case the
warning names.
Auth note: unlike `archied`, archie-ui has no secret registry --
`GATEWAY_TOKEN`/`STATE_STORE_TOKEN` resolve from its process environment
only (or from `[services.*].target_token` in `config.toml`), so whatever
+1 -1
View File
@@ -176,7 +176,7 @@ func (o Options) validate() error {
}
if !webui.IsLoopback(o.Listen) && o.Token == "" {
return fmt.Errorf(
"ui listen address %q is non-loopback; a reachable dashboard requires a token (-token) or a token file to mint one (-token-file) (docs/prds/ui-service-boundary.md, listen and authentication)",
"ui listen address %q is non-loopback; a reachable dashboard requires a token (-token) or a token file to mint one (-token-file) (deployments/README.md, running the dashboard)",
o.Listen,
)
}
+14
View File
@@ -54,6 +54,7 @@ func Run(ctx context.Context, options Options) error {
if err != nil {
return err
}
warnPlainHTTP(log, opts)
var cleanups []func()
defer func() {
for _, cleanup := range slices.Backward(cleanups) {
@@ -132,6 +133,19 @@ func Run(ctx context.Context, options Options) error {
return serve(ctx, listener, srv.Handler(), opts)
}
// warnPlainHTTP names the exposure of a dashboard published off-host. The
// process serves plain HTTP, so the session cookie and the provider token
// cross the network in clear unless a TLS-terminating proxy sits in front of
// it -- which [web].trust_forwarded_headers declares. A loopback bind is
// reached over a tunnel or on the host, so it needs no warning.
func warnPlainHTTP(log *slog.Logger, opts Options) {
if webui.IsLoopback(opts.Listen) || opts.trustForwardedHeaders() {
return
}
log.Warn("dashboard is reachable off-host over plain HTTP; session and provider tokens travel in clear unless TLS terminates in front of it (set [web].trust_forwarded_headers behind a TLS proxy)",
"listen", opts.Listen)
}
// wireHarness attaches the setup terminal to the daemon's session contract
// when the operator configured one, and registers its cleanup.
func wireHarness(opts Options, srv *webui.Server, cleanups *[]func()) error {