Skip to content

web: require explicit confirmation when binding non-loopback without OPENCODE_SERVER_PASSWORD #10958

Closed

Description

@MaxMiksa

Description

opencode web starts the API server and prints network-access URLs. If OPENCODE_SERVER_PASSWORD is unset, the server runs unauthenticated (currently only a warning).

When users bind to non-loopback hostnames (e.g. --hostname 0.0.0.0 or --mdns which defaults hostname to 0.0.0.0), this can accidentally expose agent/server capabilities to a LAN/public network.

Suggested fix

  • If hostname is non-loopback and OPENCODE_SERVER_PASSWORD is unset:
    • On TTY: prompt for confirmation (default No) before starting.
    • On non-TTY: refuse to start unless --yes is provided.

Keep loopback behavior unchanged.

Steps to reproduce

  1. Ensure OPENCODE_SERVER_PASSWORD is unset.
  2. Run opencode web --hostname 0.0.0.0 (or opencode web --mdns).
  3. Observe it starts unauthenticated and prints network access addresses.

Environment

  • OS: Windows 11
  • Terminal: Windows Terminal

Activity

  1. github-actions commented on Jan 28, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    This appears to be the same issue but for the opencode serve command, while this one addresses the opencode web command. Both should likely be handled together for consistency.

    Feel free to ignore if this is intentionally separate.

  2. MaxMiksa commented on Jan 28, 2026

    @MaxMiksa
    ContributorAuthor

    Good catch — it’s the same pattern as #10948, but scoped to a different user entrypoint.

    I kept this separate from the serve change intentionally to keep each PR minimal and reduce review/merge risk (one command, one behavior change).

    If you’d prefer, I can consolidate the approach later into a shared helper, but this PR just applies the same guardrail to opencode web for consistency (non-loopback + no password => confirm/require --yes).

  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

webRelates to opencode on web / desktop

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions