diff --git a/internal/app/archieui/run.go b/internal/app/archieui/run.go index 85ebf1f56..fe3286f8b 100644 --- a/internal/app/archieui/run.go +++ b/internal/app/archieui/run.go @@ -116,13 +116,18 @@ func Run(ctx context.Context, options Options) error { return fmt.Errorf("listen for ui: %w", err) } cleanups = append(cleanups, func() { _ = listener.Close() }) - log.Info( - "archie-ui running", + attrs := []any{ "addr", listener.Addr().String(), - "open", webui.DashboardURL(listener.Addr().String(), opts.Token), + "open", webui.DashboardURL(listener.Addr().String()), "gateway", opts.Gateway.Target, "state", opts.State.Target, - ) + } + // Name the file holding the token, never the token itself: this line + // reaches the journal and any log an operator pastes. + if opts.TokenFile != "" { + attrs = append(attrs, "token_file", opts.TokenFile) + } + log.Info("archie-ui running", attrs...) return serve(ctx, listener, srv.Handler(), opts) } diff --git a/internal/webui/auth.go b/internal/webui/auth.go index 8a0db7dc6..43006030d 100644 --- a/internal/webui/auth.go +++ b/internal/webui/auth.go @@ -57,8 +57,10 @@ func IsLoopback(listen string) bool { } // DashboardURL renders a listen address as an openable URL, with localhost -// for wildcard hosts. -func DashboardURL(listen, token string) string { +// for wildcard hosts. It deliberately carries no credential: a URL is safe to +// log and paste, so the dashboard token can only be read from the file the +// operator named, never from a printed link. +func DashboardURL(listen string) string { host, port, err := net.SplitHostPort(strings.TrimSpace(listen)) if err != nil { host, port = "", strings.TrimPrefix(strings.TrimSpace(listen), ":") @@ -67,11 +69,7 @@ func DashboardURL(listen, token string) string { case "", "0.0.0.0", "::", "[::]": host = "localhost" } - url := "http://" + net.JoinHostPort(host, port) + "/" - if token != "" { - url += "?t=" + token - } - return url + return "http://" + net.JoinHostPort(host, port) + "/" } // LoadOrCreateToken returns the dashboard token, generating and persisting one