Description
The TUI entrypoint (opencode / tui thread) can start an external HTTP server when network options are configured (e.g. --hostname, --port, --mdns, or global config). This uses a worker RPC call to server.listen(...).
If OPENCODE_SERVER_PASSWORD is unset, this server runs unauthenticated. Unlike serve and web, the TUI path currently has no guardrail for the insecure + non-loopback case.
Suggested fix
Apply the same guardrail as serve/web:
- If hostname is non-loopback and
OPENCODE_SERVER_PASSWORD is unset:
- On TTY: prompt for confirmation (default No).
- On non-TTY: refuse to start unless
--yes is provided.
Steps to reproduce
- Ensure
OPENCODE_SERVER_PASSWORD is unset.
- Start TUI with external server enabled, e.g.
opencode --hostname 0.0.0.0 (or configure global server.mdns=true).
- Observe the HTTP server starts unauthenticated.
Environment
- OS: Windows 11
- Terminal: Windows Terminal
Description
The TUI entrypoint (
opencode/tui thread) can start an external HTTP server when network options are configured (e.g.--hostname,--port,--mdns, or global config). This uses a worker RPC call toserver.listen(...).If
OPENCODE_SERVER_PASSWORDis unset, this server runs unauthenticated. Unlikeserveandweb, the TUI path currently has no guardrail for the insecure + non-loopback case.Suggested fix
Apply the same guardrail as
serve/web:OPENCODE_SERVER_PASSWORDis unset:--yesis provided.Steps to reproduce
OPENCODE_SERVER_PASSWORDis unset.opencode --hostname 0.0.0.0(or configure globalserver.mdns=true).Environment