Skip to content

tui: require explicit confirmation when starting external server on non-loopback without OPENCODE_SERVER_PASSWORD #10973

Closed

Description

@MaxMiksa

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

  1. Ensure OPENCODE_SERVER_PASSWORD is unset.
  2. Start TUI with external server enabled, e.g. opencode --hostname 0.0.0.0 (or configure global server.mdns=true).
  3. Observe the HTTP server starts unauthenticated.

Environment

  • OS: Windows 11
  • Terminal: Windows Terminal

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Jan 28, 2026
  2. github-actions commented on Jan 28, 2026

    @github-actions
    Contributor

    This issue is part of a series of related security improvements. Related issues applying similar guardrails to other entry points:

    These are related enhancements rather than duplicates, as they address the same security concern across different entry points (TUI, serve, and web).

  3. github-actions commented on Mar 30, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

opentuiThis relates to changes in v1.0, now that opencode uses opentui

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions