feat: add OAuth Authorization Code + PKCE flow for SSO login#923
Open
dgilmanuni wants to merge 1 commit intofwdcloudsec:mainfrom
Open
feat: add OAuth Authorization Code + PKCE flow for SSO login#923dgilmanuni wants to merge 1 commit intofwdcloudsec:mainfrom
dgilmanuni wants to merge 1 commit intofwdcloudsec:mainfrom
Conversation
Replace the device code flow as the default SSO login method with the Authorization Code Grant + PKCE flow, matching the AWS CLI's Nov 2024 update. This provides a smoother UX by skipping manual code entry — the browser redirects back automatically via a temporary localhost callback server. The device code flow is preserved as a fallback via --use-device-code flag or automatic headless environment detection (SSH, Docker, CI). Key changes: - New LoginWithAuthorizationCode function implementing RFC 7636 PKCE - Extracted browser-opening logic into reusable browser.go module - Headless environment detection for automatic flow selection - Upgraded ssooidc SDK to v1.35.15 for authorization_code grant support - Security headers (CSP, X-Content-Type-Options, X-Frame-Options) on callback pages - Comprehensive tests including RFC 7636 test vectors and XSS prevention Closes fwdcloudsec#779 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
|
My main concern here is changing the default behavior - I can see an argument for making this an optional flag to start. |
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
Implements the OAuth Authorization Code Grant with PKCE flow for SSO login, matching the AWS CLI's Nov 2024 update. This replaces device code as the default login flow, providing a smoother UX by eliminating manual code entry — the browser redirects back automatically via a temporary localhost callback server.
granted sso loginandassume(whensso_sessionis configured)--use-device-codeflag or automatic headless detection (SSH, Docker, CI)ssooidcSDK to v1.35.15 forauthorization_codegrant type supporthtml/template, CSRF state validation,sync.Oncefor idempotent callback, localhost-only bindingHow it works
127.0.0.1with an ephemeral portauthorization_codegrantcrypto/rand) and S256 challenge per RFC 7636CreateTokenTest plan
go build ./...andgo test ./...passCloses #779
🤖 Generated with Claude Code