Skip to content

Harden Panda Claude auth: exchange retry, chat-time re-login, token h…#22

Merged
0xarch2311 merged 1 commit into
mainfrom
panda-auth-hardening
Jun 9, 2026
Merged

Harden Panda Claude auth: exchange retry, chat-time re-login, token h…#22
0xarch2311 merged 1 commit into
mainfrom
panda-auth-hardening

Conversation

@0xarch2311

Copy link
Copy Markdown
Collaborator

…ygiene

Builds on the macOS keychain auth detection already committed in 2b08b21 ("support keychain claude login").

  • Security (L1): app_panda_login no longer returns the ccr- proxy key to the renderer (PandaLoginResult { ok }); the key is persisted Rust-side only and the frontend re-reads settings instead of round-tripping the token through JS.

  • Exchange retry (Auto-name projects + declutter the file list #2): exchange_code_for_key retries transient failures (transport error / HTTP 5xx / 429) with exponential backoff (300ms, 600ms); the documented terminal 400 codes are surfaced immediately and never retried (the code is single-use).

  • Chat-time re-login (Fix desktop STL download: native Save As instead of dead HTTP route #1): on the proxy path, a turn that fails with an auth error (revoked/expired key -> BE 401) now emits ChatEvent::AuthExpired instead of a generic error. The chat store raises a needsPandaReauth flag and a new PandaReauthBanner offers a one-click "Sign in again" wired to the sign-in flow. Includes looks_like_auth_failure detection (gated to use_panda_cloud) + tests.

Tests: Rust 164 passed, JS 420 passed.

…ygiene

Builds on the macOS keychain auth detection already committed in
2b08b21 ("support keychain claude login").

- Security (L1): app_panda_login no longer returns the ccr- proxy key to the
  renderer (PandaLoginResult { ok }); the key is persisted Rust-side only and the
  frontend re-reads settings instead of round-tripping the token through JS.

- Exchange retry (#2): exchange_code_for_key retries transient failures
  (transport error / HTTP 5xx / 429) with exponential backoff (300ms, 600ms);
  the documented terminal 400 codes are surfaced immediately and never retried
  (the code is single-use).

- Chat-time re-login (#1): on the proxy path, a turn that fails with an auth
  error (revoked/expired key -> BE 401) now emits ChatEvent::AuthExpired instead
  of a generic error. The chat store raises a needsPandaReauth flag and a new
  PandaReauthBanner offers a one-click "Sign in again" wired to the sign-in flow.
  Includes looks_like_auth_failure detection (gated to use_panda_cloud) + tests.

Tests: Rust 164 passed, JS 420 passed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@0xarch2311 0xarch2311 merged commit a55d36e into main Jun 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant