Skip to content

Secure CLI browser login with state and PKCE - #22

Merged
jsibbison-square merged 1 commit into
mainfrom
jsib-261015-login-state-pkce
Oct 18, 2026
Merged

jsibbison-square merged 1 commit into
mainfrom
jsib-261015-login-state-pkce

Conversation

@jsibbison-square

Copy link
Copy Markdown
Collaborator

CLI browser login now generates fresh random state and an S256 PKCE challenge for each attempt. It rejects callbacks with missing, mismatched, or duplicate state, and sends the in-memory verifier when exchanging the code before verifying and storing the session. This binds the callback and code exchange to the initiating CLI login.

Keeps Blox proxy authentication unchanged, updates the auth-flow documentation, and consolidates overlapping tests and mock-server helpers.

Validation:

  • just check passed: formatting, Clippy, and all 350 tests, including Blox auth bypass coverage.
  • A fresh local browser login against https://test.blockstaging.build completed successfully and the issued session passed /v1/auth/me verification.
  • Tests cover the RFC S256 vector, exchange payload, invalid state, malformed callbacks, and secret redaction.

@jsibbison-square
jsibbison-square marked this pull request as ready for review October 15, 2026 02:53
@jsibbison-square
jsibbison-square requested a review from a team as a code owner October 15, 2026 02:53

@baxen baxen left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread src/bl/auth_login.rs
@@ -146,8 +148,13 @@ fn run_browser_login_inner(
let code = rx
.recv()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion (non-blocking): this recv() waits forever. That was already the case, but it matters more now. A mismatched-state callback used to end the run with an error; now it's deliberately ignored. So a user who hits a stale tab sees "Sign-in didn't finish" in the browser while the CLI hangs until Ctrl-C. Consider recv_timeout (~10 min) with a "login timed out, rerun bl auth login" error.

@jsibbison-square
jsibbison-square merged commit 5febd9a into main Oct 18, 2026
4 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.

2 participants