fix fish ProxyCommand shell - #450
Conversation
…ailures (CX-464) OpenSSH runs ProxyCommand/Match exec via $SHELL -c; unlike sh -c, fish -c sources the user's config.fish, which can override the AWS_* credentials p0 injects for `aws ssm start-session`, causing fish-only auth failures we couldn't reproduce locally. Pin SHELL=/bin/sh in the spawned child's env. Separately, a hard StartSession rejection (bad signature, credentials mangled before the call, expired/unrecognized tokens) was indistinguishable from access still propagating: the broad "Connection closed" pattern matched the ssh kex fallout of any ProxyCommand death, so it retried blindly for 30s and reported the generic "did not propagate" message, hiding the real error. Add an optional terminalAccessPatterns hook that aborts the retry loop immediately and surfaces a classified message via AWS's new connectionErrorMessage.
8d07ddd to
9f3d114
Compare
9f3d114 to
289e6b3
Compare
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 3 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
Comment |
Problem
p0 sshto AWS fails for users whose login shell is fish, while the same requestworks under bash. OpenSSH runs a
ProxyCommandas$SHELL -c "exec <command>",and fish sources
config.fishon everyfish -c. If those startup files setAWS_*— directly or via direnv/aws-vault helpers — they replace the sessioncredentials the CLI injected, so
aws ssm start-sessionsigns with the wrongidentity and AWS rejects the connection. bash doesn't read
.bashrcnon-interactively, so bash users never see it; zsh's
.zshenvis the same hazard.Verified locally: a probe
$SHELLlogs-c exec <command>when ssh runs aProxyCommand, and
env AWS_ACCESS_KEY_ID=INJECTED fish -c 'echo $AWS_ACCESS_KEY_ID'prints the
config.fishvalue, while/bin/sh -cprintsINJECTED.Status: N/A
Change
Sets
SHELL=/bin/shin the environment of thessh/scpchild the CLI spawns, soOpenSSH runs the generated ProxyCommand under a shell that reads no startup files.
Only the ssh client children, and only on POSIX — Windows OpenSSH doesn't use
$SHELLfor ProxyCommand. Thessh-proxyflow, where the CLI is itself theProxyCommand and spawns the provider binary with
shell: false, was never affected.This sets
$SHELLon a child process only: the user's own shell and their remotelogin shell are untouched. No credentials are written to disk or put on a command
line.
Check off any of the following areas of code that are modified:
Type of Change
Validation
child env under fish and bash, and
$SHELLleft alone both on Windows and forthe
ssh-proxychild. The two positive tests were confirmed to fail with the fixdisabled.
tsc --noEmitandeslintpass. Full suite: 302 pass; the 17 failuresin
src/commands/__tests__/ssh.test.tsandsrc/commands/shared/__tests__/ssh-resolve.test.tsreproduce unchanged at thebase commit and are unrelated. Not yet run end to end against a real AWS target
from a fish shell — that check should happen before merge.
ssh/scpchildren on macOS and Linux. Windows andssh-proxyunchanged. The only other ssh feature reading$SHELLisLocalCommand, which the CLI doesn't use.user-authored for a shell to interpret.
/bin/shexists on every supported POSIXplatform and is OpenSSH's own fallback when
$SHELLis unset.Rollout / rollback
N/A — client-side, ships with the next release. Rollback is a revert.
Tracking (optional)
CUS-359, CX-464