auth login <url> should confirm before running well-known auth.command #7801

Open
opened 2026-02-16 18:08:16 -05:00 by yindo · 2 comments
Owner

Originally created by @MaxMiksa on GitHub (Jan 28, 2026).

Originally assigned to: @thdxr on GitHub.

Description

opencode auth login <url> fetches <url>/.well-known/opencode and runs the returned auth.command immediately to obtain a token.

This executes a remote-provided command without an explicit confirmation step and without validating the payload shape.

Suggested fix

  • Validate the well-known payload (require non-empty auth.command: string[] and auth.env: string).
  • Show the full command and require confirmation before running it.
  • Provide an explicit bypass flag for automation (e.g. --yes).

Steps to reproduce

  1. Host a .well-known/opencode response with auth.command.
  2. Run: opencode auth login <url>.
  3. Observe the command executes immediately.

Environment

  • OS: Windows 11
  • Terminal: Windows Terminal
Originally created by @MaxMiksa on GitHub (Jan 28, 2026). Originally assigned to: @thdxr on GitHub. ### Description `opencode auth login <url>` fetches `<url>/.well-known/opencode` and runs the returned `auth.command` immediately to obtain a token. This executes a remote-provided command without an explicit confirmation step and without validating the payload shape. ### Suggested fix - Validate the well-known payload (require non-empty `auth.command: string[]` and `auth.env: string`). - Show the full command and require confirmation before running it. - Provide an explicit bypass flag for automation (e.g. `--yes`). ### Steps to reproduce 1. Host a `.well-known/opencode` response with `auth.command`. 2. Run: `opencode auth login <url>`. 3. Observe the command executes immediately. ### Environment - OS: Windows 11 - Terminal: Windows Terminal
yindo added the windows label 2026-02-16 18:08:16 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 28, 2026):

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

  • #6361: No trusted workspace functionality leads to arbitrary commands execution on startup
  • #9510: All MCP oauth flow return potential CSRF attack

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 28, 2026): This issue might be a duplicate of existing issues. Please check: - #6361: No trusted workspace functionality leads to arbitrary commands execution on startup - #9510: All MCP oauth flow return potential CSRF attack Feel free to ignore if none of these address your specific case.
Author
Owner

@MaxMiksa commented on GitHub (Jan 28, 2026):

Thanks — this is related in theme but a different (narrower) surface.

This report is specifically about opencode auth login <url> (well-known providers) fetching <url>/.well-known/opencode and immediately executing the returned auth.command to obtain a token.

It’s not about startup-time command execution; it’s a user-invoked login flow. The proposed change is minimal: validate the payload shape and require an explicit confirmation before running the remote-provided command (with --yes as an explicit automation bypass).

@MaxMiksa commented on GitHub (Jan 28, 2026): Thanks — this is related in theme but a different (narrower) surface. This report is specifically about `opencode auth login <url>` (well-known providers) fetching `<url>/.well-known/opencode` and immediately executing the returned `auth.command` to obtain a token. It’s not about startup-time command execution; it’s a user-invoked login flow. The proposed change is minimal: validate the payload shape and require an explicit confirmation before running the remote-provided command (with `--yes` as an explicit automation bypass).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7801