Repository navigation
Show AWS profile in EKS auth error hints - #1725
Conversation
PR Summary by QodoInclude AWS profiles in EKS authentication recovery hints
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Code Review by Qodo
1.
|
| const { data: contexts } = useContexts() | ||
| const originalContext = contexts?.find((context) => context.name === connection.context)?.originalName | ||
| const commandInfo = selectConnectionHints(connection.errorType, connection.context || '', originalContext) | ||
| const matchedContext = contexts?.find((context) => context.name === connection.context) | ||
| const originalContext = matchedContext?.originalName | ||
| const commandInfo = selectConnectionHints(connection.errorType, connection.context || '', originalContext, matchedContext?.awsProfile) |
There was a problem hiding this comment.
2. Login hints omit profiles while loading ð Bug ⥠Correctness
ConnectionErrorView destructures only data from useContexts, so matchedContext?.awsProfile becomes undefined and the command is rendered without the profile before the query resolves or after it fails. On an initial connection failure or contexts-endpoint error, users can copy or run the ambient-profile command even though the kubeconfig pins another account.
Agent Prompt
## Issue description
Profile-aware AWS commands silently fall back to the terminal's ambient profile while the contexts query is unresolved or has failed.
## Fix Focus Areas
- web/src/components/ConnectionErrorView.tsx[344-353]
- web/src/components/ConnectionErrorView.tsx[369-381]
- web/src/api/client.ts[6093-6099]
## Recommended Fix
Consume the contexts query's loading and error states and do not expose an unqualified EKS login command until profile metadata has resolved successfully. If the query fails, show that the profile could not be determined rather than silently presenting a command that may target the wrong account.
â Copy this prompt and use it to remediate the issue with your preferred AI generation tools
947328a to
961d11c
Compare
When Radar cannot connect to an EKS cluster due to credential failure, the suggested `aws sso login` command now includes `--profile <name>` when the kubeconfig exec block pins a profile via the AWS_PROFILE env var or a --profile argument. `aws eks update-kubeconfig` always injects the profile as AWS_PROFILE in the exec env block, so this covers the common real-world case.
961d11c to
deb6575
Compare
`aws eks update-kubeconfig` overwrites the user entry and only writes the AWS_PROFILE env when invoked with --profile, so the profile-blind fallback would strip the pin the login hint had just surfaced. The auth-rejected diagnostic likewise inspected the terminal's ambient profile while the login command next to it targeted the pinned one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fh426ozpfnu7Hq2sHeyt9n
nadaverell
left a comment
There was a problem hiding this comment.
Thanks for the PR!
looks good
When Radar cannot connect to an EKS cluster due to credential failure, the suggested
aws sso logincommand now includes--profile <name>when the kubeconfig exec block pins a profile via the AWS_PROFILE env var or a --profile argument.aws eks update-kubeconfigalways injects the profile as AWS_PROFILE in the exec env block, so this covers the common real-world case.Description
Brief description of the changes in this PR.
Type of change
How has this been tested?
Describe the tests you ran to verify your changes.
Checklist
Related issues
Fixes #(issue number)
Note
Low Risk
User-facing hint text and read-only kubeconfig parsing; shell interpolation is gated by an allowlist with tests for hostile profiles.
Overview
EKS connection errors now suggest AWS CLI commands with the same profile the kubeconfig exec block uses, instead of assuming the terminalâs default profile.
The backend adds
awsProfileon each context by parsingaws/aws-iam-authenticatorexec auth (--profileorAWS_PROFILE). For the active context it prefers the snapshotted kubeconfig used at client creation so the hint matches live credentials. The UI waits for contexts to load, then threadsawsProfileinto EKS auth, auth-rejected, and timeout hints (aws sso login,aws eks update-kubeconfig, STS/describe diagnostics).New
isShellSafeAWSProfile/awsProfileFlagallow slash-separated SSO profile names but omit--profilewhen the value looks hostile, matching existing context-name safety for terminal-run commands.Reviewed by Cursor Bugbot for commit 713af24. Bugbot is set up for automated code reviews on this repo. Configure here.