fix(security): add opportunistic PKCE to DigitalOcean OAuth flow (#3076)#3086
Open
fix(security): add opportunistic PKCE to DigitalOcean OAuth flow (#3076)#3086
Conversation
Add PKCE (S256) code_challenge/code_verifier parameters alongside the existing client_secret in the DigitalOcean OAuth flow. This is a defense-in-depth measure: if DO begins honoring PKCE, the flow gains protection against authorization code interception without any code changes. The client_secret remains required until DO supports PKCE-only public client flows. Also improves the security design documentation with explicit issue references (#2596, #3076) and simplifies the PKCE migration TODO since steps 1-3 of the original checklist are now implemented. Fixes #3076 Agent: security-auditor Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
code_challenge/code_verifierparameters alongsideclient_secretin the DigitalOcean OAuth flow as defense-in-depthWhy
The hardcoded
DO_CLIENT_SECRETis a known limitation of DigitalOcean's OAuth (no PKCE-only support). Rather than removing the secret (which would break auth) or just adding comments, this PR implements "opportunistic PKCE" — sending PKCE parameters alongside the requiredclient_secret. This is a real security improvement that prepares for automatic PKCE-only migration when DO adds support.The
generateCodeVerifier()andgenerateCodeChallenge()utilities already existed inshared/oauth.ts(used by the OpenRouter OAuth flow) and are now reused for the DO flow.Test plan
bunx @biomejs/biome check src/— zero errorsbun test— all 1951 tests passclient_secretis still sent (required by DO), PKCE params are additiveFixes #3076
-- refactor/security-auditor