Skip to content

fix(security): add opportunistic PKCE to DigitalOcean OAuth flow (#3076)#3086

Open
la14-1 wants to merge 1 commit intomainfrom
fix/issue-3076
Open

fix(security): add opportunistic PKCE to DigitalOcean OAuth flow (#3076)#3086
la14-1 wants to merge 1 commit intomainfrom
fix/issue-3076

Conversation

@la14-1
Copy link
Copy Markdown
Member

@la14-1 la14-1 commented Mar 28, 2026

Summary

Why

The hardcoded DO_CLIENT_SECRET is 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 required client_secret. This is a real security improvement that prepares for automatic PKCE-only migration when DO adds support.

The generateCodeVerifier() and generateCodeChallenge() utilities already existed in shared/oauth.ts (used by the OpenRouter OAuth flow) and are now reused for the DO flow.

Test plan

  • bunx @biomejs/biome check src/ — zero errors
  • bun test — all 1951 tests pass
  • No breaking changes: client_secret is still sent (required by DO), PKCE params are additive

Fixes #3076

-- refactor/security-auditor

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>
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.

security: OAuth client secret exposed in source code (digitalocean)

2 participants