Repository navigation
Description
Part of #14598
Target branch: v6
Scope
Add S256 PKCE to the Hub's GitHub browser login. In startProviderLogin (src/pkg/hub/oauth.go:561), for the non-OIDC branch (oauth.go:601-608) generate a 32-byte random code_verifier, set it in a separate short-lived cookie (HttpOnly, Secure, SameSite=Lax, host-scoped, TTL oauthStateTTL at oauth.go:1410, mirroring the state cookie at oauth.go:577-591), and add code_challenge=<S256>&code_challenge_method=S256 to the authorize URL. In the callback (state check at oauth.go:726-737, exchange call at :791) read the verifier cookie, clear it immediately (single use), and pass code_verifier to exchangeGitHubLogin (oauth.go:932) in the form body. Missing, empty, malformed or expired verifier cookie must fail closed with 400 before the code exchange or any session is minted. Do not change the state nonce format or its cookie.
Decision taken by hive: bind the verifier via a separate HttpOnly cookie, not a server-side transaction store; the Hub has no existing transaction table for logins and a cookie matches the existing state design and is additive. Logins in flight during deploy lack the cookie and fail closed with the existing "please start the login again" message; that is acceptable per the RFC's fail-closed requirement.
Acceptance criteria
- Authorize redirect includes
code_challenge(S256 of the verifier) andcode_challenge_method=S256; scope stays empty. - Token exchange sends the matching
code_verifier. - Missing/mismatched/expired/replayed verifier or state returns 400 and performs no token exchange (test asserts the fake token endpoint receives zero requests) and mints no session.
- Verifier cookie is cleared on callback success and failure.
- OIDC providers and device flow (src/pkg/dashboard/api_auth.go) unchanged.
Likely files
- src/pkg/hub/oauth.go
- src/pkg/hub/oauth_provider_login_test.go, oauth_login_shortcircuit_test.go, oauth_state_encoding_test.go (new PKCE tests may go in a new oauth_pkce_test.go)
Depends on the form-POST token exchange child (needs the body-based code_verifier field).
— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88
Activity
hivecommons-hive commentedon Oct 27, 2026
🔒 Claimed by @Karibhou (contributor on hive hosted-available-oke-11-placeholder-r05x). The claim lasts 30m0s without activity and renews while the work continues. Reply
/unclaimto release, or/claimto take it over if you outrank the holder.hivecommons-hive commentedon Oct 27, 2026
🔓 Claim by @Karibhou released (lease revoked).
🐛 contribute: link a reported PR to the issue it was dispatched for (#…
hivecommons-hive commentedon Oct 28, 2026
Not dispatching a duplicate this cycle: #14701 (✨ feat(hub): add S256 PKCE verifier cookie to the Hub GitHub login, base v5) already implements this scope and is parked on stage/085-needs-decision awaiting a maintainer ruling. Once that PR lands or is declined, this issue either closes (forward-merge to v6) or becomes actionable again.
— hive: agent=scanner
🐝 Hive Agent:
scanner| Instance:hosted-available-oke-11-placeholder-r05x| SHA:unknown✨ feat(hub): add S256 PKCE verifier cookie to the Hub GitHub login
🌱 test(hub): pin browser OAuth exchange and state contracts (#14893)
✨ feat(hub): add S256 PKCE verifier cookie to the Hub GitHub login (#…
hivecommons-hive commentedon Oct 28, 2026
Verified once on
v6@7ea5d9a3d: #14701 (merged as 2b120c6) fully resolves this issue.startProviderLoginmints a 32-byte base64url verifier (oauthPKCEVerifier,src/pkg/hub/oauth.go:1475). It stores the verifier in thehive_oauth_pkcecookie (oauth.go:617-625: HttpOnly, Secure, SameSite=Lax, host-scoped, MaxAge =oauthStateTTL).code_challenge=pkceS256Challenge(verifier)&code_challenge_method=S256(oauth.go:627-628).pkceS256ChallengeisBASE64URL(SHA256(verifier))(oauth.go:1484).oauth.go:746-747). A missing or malformed verifier is rejected before the exchange (oauth.go:825-829).code_verifieris sent in the form body (oauth.go:986).src/pkg/hub/oauth_pkce_test.gocovers the challenge, the form-body verifier, the missing/empty/malformed/short matrix, a bad state clearing the verifier, and replay.Closing as completed. This unblocks #14636. The remaining verifier contract cases for #14636/#14598 are in the follow-up PR for #14598.
— hive: agent=scanner
🐝 Hive Agent:
scanner| Instance:hosted-available-oke-11-placeholder-r05x| SHA:unknown