Repository navigation
fix(core): redeem browser login code with PKCE - #6
Merged
Merged
Conversation
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 72 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The browser login received the minted API key in the loopback callback URL (
?key=…), so the key could land in browser history. It also stored the key as never expiring, although dashboard CLI keys expire after 90 days.The login now uses the one-time code exchange from theopenco/llmgateway#4846 (same change as the upstream OpenCode PR anomalyco/opencode#59241):
/connect/cliURL carries an S256code_challenge; the dashboard redirects back with?code=only.https://internal.llmgateway.io/public/cli-auth/tokenwith its verifier and stores the key with its real expiry. An expired key asks the user to log in again.DEVPASS_INTERNAL_API_URL/LLMGATEWAY_INTERNAL_API_URLoverride the redeem endpoint, mirroringDEVPASS_APP_URL(README updated).Merge after theopenco/llmgateway#4846 is deployed — until then the dashboard ignores the challenge and sends
?key=, which this version rejects.Verification
packages/core/test/plugin/provider-llmgateway.test.ts(14 pass): the URL carriesorg,sourceand an S256 challenge; a forgedstateand a rejected code both fail the attempt; a valid callback redeems the code with a verifier matching the challenge and stores the key with its expiry.bun run check(pre-push) andpackages/coretypecheck pass.