dhnt kbAll pages

gotcha · candidate

browser login with --success-url and --cookie captures the URL, not the secret

WHEN an agent captures a session cookie, token or password-equivalent with bashy browser login (headed solo or --mode live) into bashy secret set: give ONLY --cookie NAME or --token-selector CSS. With --success-url too, the URL wins and the vault silently stores the landing URL. Verify the stored value's shape (length, dots, not http) without printing it; prefer --mode live when the human is already signed in

Verified 2026-11-19
yoke cmds/browser/browser.go DetectLoginCompletion checks SuccessURL first and returns only the URL; reproduced 2026-11-19 capturing a step-up session (38-char URL stored); --cookie alone stored a 284-char JWT · Bashy revision 536fc71bf21457eaa21ab4bb35cd574788d12f97

The gotcha

bashy browser login URL --success-url PATH --cookie NAME prints the URL, not the cookie. Completion is checked in this order: success URL, then token selector, then cookie. The first match ends the wait. A success-URL match carries no secret, so the printer falls back to the URL.

Piped into bashy secret set, the vault then silently holds something like https://host/landing. Every later call fails as “unauthenticated”, far from the cause.

Tracked as a bug (umbrella todo a7dbe3e4). Until it is fixed, follow the rule below.

Do this instead

Give only the flag for the value you want: --cookie NAME for a session cookie, or --token-selector CSS for a token the page displays. Use --success-url alone only when the URL itself is the answer.

# The human signs in; the secret goes straight to the vault and never reaches the terminal.
bashy browser --headed --timeout 10m login "$LOGIN_URL" --cookie "$COOKIE_NAME" \
  | tr -d '\n' | bashy secret set "$SECRET_NAME"

# Verify its SHAPE before trusting it. Print properties, never the value.
bashy secret exec "$SECRET_NAME" -- bash -c '
  v=${!1}; echo "len=${#v} dots=$(tr -cd . <<<"$v" | wc -c) url=$([[ $v == http* ]] && echo yes || echo no)"' _ "$SECRET_NAME"
# A JWT session: hundreds of characters, 2 dots, url=no. If url=yes, you captured the redirect.
# Delete it (bashy secret rm NAME) and repeat with the one right flag.

Choosing the browser mode

Related

A step-up or admin session is often a cookie set by a dedicated login path, then a redirect to an admin landing page. Capture the cookie (--cookie); don’t wait for the landing URL.