Repository navigation
fix(ssh): include the Coder SSH config where Git for Windows ssh reads it - #1221
Conversation
7a11ef5 to
a7d0113
Compare
af131df to
d08099a
Compare
|
/coder-agents-review |
|
Chat: Review posted | View chat Review history
deep-review v0.13.1 | Round 1 | Last posted: Round 1, 27 findings (1 P2, 7 P3, 15 P4, 4 Nit), COMMENT. Review Finding inventoryFinding inventory: PR #1221Findings
Contested and acknowledgedRound logRound 1Full panel (round 1). Netero first pass: 1 P3, 2 P4, no P0. Law not run (589 effective additions). Panel: ging-ts, kurapika, melody, pariston, mafuuu, bisky, hisoka, gon, leorio, mafu-san, zoro, plus wildcard meruem (random from distilled set). Posted 1 P2, 7 P3, 15 P4, 4 Nit; 6 OOS in body; 1 Note in body; 13 dropped or merged. Pariston rejected the ssh -v alternative (CRF-41); orchestrator confirmed with About deep-reviewCRF = Coder Review Finding (P0-P4, Nit, Note)
|
There was a problem hiding this comment.
This PR writes the Windows Include as /C:/... plus /c/..., adds the Include to Git for Windows' own config found from HOME or HOMEDRIVE+HOMEPATH, and replaces the SshConfig class with functions. Findings: 1 P2, 7 P3, 15 P4, 4 Nit.
The PR title says "every Windows ssh home", but the description's Not covered list excludes some Git homes, and the squash merge makes the title the commit subject. A narrower subject: fix(ssh): include the Coder SSH config where Git for Windows ssh reads it.
Out of scope (needs a ticket or explicit acceptance by a human):
src/remote/sshConfig.ts:116: since #1211, a data directory outside the profile already got the/c/...spelling, so the shadow-folder problem in the P2 finding predates this PR for that setup.src/remote/sshConfig.ts:486: off Windows, the~/include is relative toos.homedir(), which Node takes fromHOME, while OpenSSH expands~from the passwd entry (confirmed with OpenSSH 10.2 andHOMEpointing elsewhere); when they differ, ssh does not find the Coder files.src/remote/remote.ts:985: two windows connecting at once both read-modify-write the profile and Git configs with no lock, so one window's include or legacy-block removal can be lost.src/remote/sshConfig.ts:41: theManagedPermissionsdoc says a config without one is not Coder-managed, which is wrong off Windows in the same way as thepermissionsfield doc.src/remote/sshConfig.ts:63: the nameDRIVE_PREFIX_REGEXdoes not say it matches only forward-slashed drives, so a caller that skips the backslash conversion gets no match.src/remote/sshConfig.ts:61:DRIVE_OR_UNC_PATH_REGEXandisFullyQualifiedWindowsPathinwindowsAcl.tsboth test for a drive or UNC path with different rules, so a change to one does not reach the other.
test/unit/remote/remote.test.ts:624
P3 [CRF-1] The describe block "HOME ssh config on Windows" and the helper writeWithHomeConfig still say Git's config comes from HOME, but getGitForWindowsSshConfigPath now also uses HOMEDRIVE+HOMEPATH, which is the case this PR fixes. (Netero)
Rename them for the Git for Windows config, for example "Git for Windows ssh config", writeWithGitConfig, and gitConfig.
🤖
🤖 This review was automatically generated with Coder Agents.
|
CRF-1 fixed in 5d1efe2 (renamed to "Git for Windows ssh config", |
5d1efe2 to
96a19c0
Compare
|
Split into a stack: this PR is now only the Git for Windows fix, followed by #1226 (Linux/macOS ssh home, the out-of-scope |
96a19c0 to
233b6dc
Compare
jeremyruppel
left a comment
There was a problem hiding this comment.
approving in advance of the test fixup 👍
With HOME unset, Git for Windows ssh takes its home from HOMEDRIVE and HOMEPATH, which a domain home folder sets to e.g. H:\. v1.18.3 only looked at HOME, so it kept the ~/AppData/... include and wrote nothing to H:\.ssh\config: Git ssh read neither and got no ProxyCommand. - On Windows, write the include as "/C:/..." "/c/...". Every Windows OpenSSH build from 7.6 reads /C:/ whatever HOME is, every Git for Windows build reads /c/, and each skips the other. This drops the ~/ guess and getSshHomeDir. - Without -F, also include the block in the config Git ssh reads: HOME (an MSYS /h read as H:\), else HOMEDRIVE+HOMEPATH. The block is byte-identical everywhere, so when that is the profile's config the second write is a no-op. Refs VSC-58
- Keep the ~/ include when HOME is unset and every build's home is the profile: Windows OpenSSH reads /c/... as \c\... on the current drive, which any local user can create. - Bound the Git config write with a 5 second timeout, since a domain home may be on an unreachable share. - Warn when Remote-SSH's ssh resolves no ProxyCommand, naming the include directory and the config files ssh read. - Trim leading whitespace in mergeInclude so a second include is a no-op. - Rename getGitSshConfigPath to getGitForWindowsSshConfigPath and DRIVE_PREFIX_REGEX to FORWARD_SLASH_DRIVE_REGEX. - Run the Windows path tests on every platform, share the home env test helpers, and fix docs, comments and the changelog.
233b6dc to
78ed373
Compare
Part of VSC-58
Follow-up to #1211, which didn't fix VSC-58. With
HOMEunset, Git for Windows ssh takes its home fromHOMEDRIVE+HOMEPATH, which a domain home folder sets to e.g.H:\. #1211 only checkedHOME, so it kept the~/AppData/...include and never wroteH:\.ssh\config. Git ssh read neither and got noProxyCommand.Stack: this PR → #1226 (Linux/macOS ssh home) → #1227 (
SshConfigclass to module functions).Commits (review one at a time)
697c4a1fix: the VSC-58 fix. prod +45/−62, tests +148/−133."/C:/..." "/c/...". Every Windows OpenSSH build from 7.6 reads/C:/whateverHOMEis, every Git for Windows build reads/c/, and each skips the other. This also fixes Windows OpenSSH 7.x (Server 2019) withHOMEoff the profile, and every Windows OpenSSH build with a non-ASCIIHOME.-F, the same include block also goes intogetGitForWindowsSshConfigPath(): Git's home isHOME(an MSYS/hread asH:\), elseHOMEDRIVE+HOMEPATH, joined with.ssh\config. When that is the profile's config, the block is byte-identical, so the second write is a no-op.96a19c0review fixes: prod +127/−39, tests +200/−109.~/by default: Windows OpenSSH reads/c/...as\c\...on the current drive, a folder any local user can create. So the include stays~/...whenHOMEis unset,HOMEDRIVE+HOMEPATHname the profile (the logon default), and the data directory is under the profile. Other setups get both spellings, as in commit 1.ProxyCommand, a warning names the include directory and the config files ssh read, instead of failing silently. When ssh can't run, the silent fallback stays.getGitSshConfigPathbecomesgetGitForWindowsSshConfigPath, andDRIVE_PREFIX_REGEXbecomesFORWARD_SLASH_DRIVE_REGEX.The
/c/...spelling that setups outside the default still get is tracked in VSC-64.Not covered: Cygwin with
-F(no reports), MSYS2/Cygwin without-F(they read a config in their install folder, unchanged since v1.16.1), Git without-Fwhen its home drive is unmapped orHOMEis like/home/jane, Git 2.14–2.20 with-Fin a non-ASCII profile, and a UNC data directory (untested with real ssh).Windows test matrix
Windows Server 2025, two local users:
jane(home folder on an SMB share mapped toH:) andJörg Doe(space and non-ASCII profile). Each run used the extension's config-writing code in a fresh logon, thenssh -v -Gwith and without-F.HOME=H:\,H:/,h:\,/h,/h/, the profile (Windows and MSYS form), the UNC share (both slash styles),/home/<user>; home drive unmapped.HOMEunset (customer)HOME=H:\HOME= non-ASCII profileHOME=/h-FHOME= profileThe matrix ran on commit 1 (and on a refactored version of it, now in #1227). Commit 2 brings back v1.18.3's
~/...include for the "Nothing set" row, which passed there. It was not re-run on the matrix; locally, the real-binary tests pass against Windows OpenSSH 9.5 and Git ssh, including a new case withHOMEDRIVE+HOMEPATHat the profile and a non-ASCIIHOME. Full suite, typecheck, lint and format pass on Windows.🤖 Generated with Claude Code