Default to device_code for WSL/SSH sessions#1372
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1372 +/- ##
==========================================
+ Coverage 88.52% 88.54% +0.02%
==========================================
Files 54 54
Lines 3649 3655 +6
==========================================
+ Hits 3230 3236 +6
Misses 289 289
Partials 130 130
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR addresses loopback callback failures in WSL/SSH environments by defaulting the OIDC authentication workflow to device_code when running under WSL or an SSH session (unless the user explicitly sets AuthWorkflow), aligning the default behavior with environments where pkce is unreliable.
Changes:
- Update auth workflow selection to default to
device_codewhen WSL/SSH is detected andAuthWorkflowis unset. - Add
prompt.IsWSL()helper and apply it in both auth selection and the setup wizard. - Update tests, documentation, and changelog to reflect the new defaulting behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/sso/auth/awssso_auth.go | Defaults to device_code in WSL/SSH when AuthWorkflow is unset. |
| internal/sso/auth/awssso_auth_test.go | Expands coverage for WSL/SSH-driven auth workflow selection. |
| internal/prompt/remote_host.go | Adds WSL environment detection helper. |
| internal/prompt/remote_host_test.go | Adds tests for WSL detection; modernizes env handling in tests. |
| docs/config.md | Documents updated defaulting behavior for AuthWorkflow. |
| cmd/aws-sso/setup_wizard_cmd.go | Uses prompt.IsWSL() instead of inline env var check. |
| CHANGELOG.md | Notes the new defaulting behavior for WSL/SSH sessions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| _, inWSLSession := os.LookupEnv("WSL_DISTRO_NAME") | ||
| return inWSLSession |
| supported on remote/headless hosts; use `device_code` in those environments. | ||
|
|
||
| If `AuthWorkflow` is omitted, `pkce` is used. | ||
| If `AuthWorkflow` is omitted, `pkce` is used _unless_ a current SSH/WSL session are detected. |
Fixes: #1371