-
Notifications
You must be signed in to change notification settings - Fork 603
feat: add PKCE (S256) to installed-app auth flow #693
Copy link
Copy link
Open
Labels
P2Normal priority bug or improvement with limited blast radius.Normal priority bug or improvement with limited blast radius.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:securityThis issue is about security boundaries, credentials, authz, sandboxing, or sensitive data.This issue is about security boundaries, credentials, authz, sandboxing, or sensitive data.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P2Normal priority bug or improvement with limited blast radius.Normal priority bug or improvement with limited blast radius.clawsweeper:needs-security-reviewClawSweeper marked this issue as needing security-sensitive review.ClawSweeper marked this issue as needing security-sensitive review.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:securityThis issue is about security boundaries, credentials, authz, sandboxing, or sensitive data.This issue is about security boundaries, credentials, authz, sandboxing, or sensitive data.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Why
RFC 7636 / RFC 8252 recommend PKCE for native/installed apps. Without it, a local malicious process that wins the race to bind the loopback port before
gogcan receive the authorization code and exchange it for a token — PKCE binds the exchange to the original authorization request, making the stolen code useless.Google's OAuth 2.0 endpoint supports
S256for Desktop app clients.Current state
The current OAuth flow in
internal/googleauth/oauth_flow.gousescfg.AuthCodeURL(state, ...)andcfg.Exchange(ctx, code)without PKCE. The project already depends ongolang.org/x/oauth2which ships PKCE support since v0.17.0 (pkce.go:GenerateVerifier,S256ChallengeOption,VerifierOption).What's missing
Same change applies to the manual redirect flow in
oauth_flow_manual_redirect.go— the verifier needs to survive between step 1 (generate auth URL) and step 2 (exchange code).Scope
~10–15 lines in
oauth_flow.go, similar inoauth_flow_manual_redirect.go. No new dependencies.