Skip to main content
← Back to list
01Issue
BugClosedSwamp Club
AssigneesNone

Security: CLI login lacks user-visible device verification code

Opened by swampadmin · 1/4/2025

Summary

The CLI browser-based login flow (swamp auth login) does not display a user-visible verification code that the user can cross-check between the CLI and the web UI. This means a user has no way to confirm that the browser session they are authenticating actually corresponds to the CLI session that initiated the request.

Current Behavior

  1. CLI generates a random state UUID and opens the browser to /login?cli_callback=...&state=...
  2. User authenticates in the browser
  3. Browser redirects back to the CLI's localhost callback server with a session token
  4. CLI validates the state parameter matches (CSRF protection only)

The state parameter is a machine-level CSRF nonce — it is never shown to the user and cannot be visually verified.

Problem

Without a user-visible verification code, the flow is vulnerable to session fixation / phishing-adjacent attacks:

  • An attacker could trick a user into authenticating a CLI session the attacker controls (e.g. by sending them a crafted login URL)
  • The user has no way to verify that the browser login page corresponds to their CLI instance
  • This is a known gap addressed by standards like OAuth 2.0 Device Authorization Grant (RFC 8628), which requires a user_code to be displayed on both the device and the browser for cross-verification

Proposed Solution

Implement a user-visible verification code similar to the OAuth device flow:

  1. CLI displays a short code (e.g. ABCD-1234) in the terminal when initiating login
  2. Web UI displays the same code on the authorization page
  3. User confirms the codes match before approving the login (or types the code into the web UI)

This ensures the user can verify that the browser session they are about to authorize actually belongs to the CLI session in front of them.

References

02Bog Flow
OPENTRIAGEDIN PROGRESSCLOSED

Closed

No activity in this phase yet.

03Sludge Pulse

Sign in to post a ripple.