Conversation
EhabY
force-pushed
the
fix/windows-ssh-config-acls
branch
2 times, most recently
from
September 14, 2026 16:50
b895e47 to
3635e17
Compare
EhabY
marked this pull request as ready for review
September 14, 2026 16:55
EhabY
force-pushed
the
fix/windows-ssh-config-acls
branch
6 times, most recently
from
September 14, 2026 17:54
72e1d72 to
91612cb
Compare
EhabY
marked this pull request as draft
September 14, 2026 18:24
EhabY
force-pushed
the
fix/windows-ssh-config-acls
branch
4 times, most recently
from
September 16, 2026 10:46
6ebe186 to
ad4b2dc
Compare
EhabY
marked this pull request as ready for review
September 16, 2026 11:01
EhabY
force-pushed
the
fix/windows-ssh-config-acls
branch
4 times, most recently
from
September 16, 2026 13:22
4a896a4 to
16adc12
Compare
untra
reviewed
Sep 16, 2026
untra
reviewed
Sep 16, 2026
Repair included fragments with built-in Windows tools and retain best-effort SSH setup. Inject permission repair as a collaborator so the config writer stays platform agnostic, skip files whose permissions already verify, and drive the real Windows tools from the native tests. Fixes #1108 Generated by Coder Agents.
Keep vitest.config.mts declarative, and record why the icacls backup is read as UTF-16LE.
EhabY
force-pushed
the
fix/windows-ssh-config-acls
branch
from
September 16, 2026 16:00
16adc12 to
dddc9e9
Compare
Member
|
is there any reason you didn't use the Scripts ran by the Windows Script Host are super sketchy patterns that AVs love to flag for no reason. Spawning PowerShell is similar but less so. |
EhabY
force-pushed
the
fix/windows-ssh-config-acls
branch
2 times, most recently
from
September 17, 2026 16:16
8cf3d1c to
dd84e8c
Compare
Replace the WSH setter and runtime ACL parsing with checked icacls commands. Repair existing deployment fragments on upgrade, retain path and link guards, and consolidate ACL helpers and tests.
EhabY
force-pushed
the
fix/windows-ssh-config-acls
branch
from
September 17, 2026 16:27
dd84e8c to
98bbb22
Compare
Collaborator
Author
|
Simplified this a lot more by removing the pre/post ACL checks that ran to make sure everything was applied correctly. We now apply this on all runs on Windows (which takes the same amount of time as the check anyway). The only windows specific logic is in |
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
Fixes #1108. On Windows, OpenSSH refuses to read an
Includewhen any file it matches is too permissive, so connections fail withBad owner or permissions. This repairs the permissions of the extension's own SSH config directory using built-in commands, with no Windows Script Host, ADSI, native dependency, or elevation.whoami.exeto find the current user, thenicacls.exe /resetand/inheritance:r /grant:ron%APPDATA%\coder.coder-remote\ssh. Only that user, SYSTEM, and Administrators keep inheritable full control.*.confmatch to inherit the directory, which also repairs other deployments and editors on the first connection after an upgrade, plus the temporary file before its rename.SshConfigtakes an optionalManagedPermissions. Its absence is the marker for "not Coder-managed", which is why it has no no-op default: a default would make the extension enumerate~/.sshon every save on every platform.createManagedPermissions()returnsundefinedoff Windows, so the whole repair path stays Windows-only.What each file changes
src/remote/windowsAcl.tsWINDOWS_ACL,createManagedPermissions, andsystem32; everything else is private, ordered by first use.src/remote/sshConfig.tsManagedPermissionsinterface. Splitssave()intogetFileMode,repairIncludedFiles,writeTemp,repairPermissions, andreplaceWithTemp, and makes the temp write exclusive (wx).src/remote/remote.tscreateManagedPermissions()to the per-deploymentSshConfig.test/unit/remote/windowsAcl.test.tsicacls.exeandwhoami.exe: the command transcript, 9 rejection rows, failure propagation, and 12 path-form rows through the public API.test/unit/remote/windowsAcl.native.test.tsicacls.exe,whoami.exe, and OpenSSH, skipped off Windows.test/unit/remote/sshConfig.test.tstest/env-check.ts,vitest.config.mtsprocess.archdoes not matchEXPECTED_ARCH..github/workflows/ci.yamlwindows-11-armunit-test job and setsEXPECTED_ARCH.CONTRIBUTING.md,CHANGELOG.md.gitattributes,.vscodeignoreTotal: 865 added, 16 removed across 13 files.
Simplification pass
The last commit reworks the first implementation rather than adding to it:
WindowsAclclass with aWINDOWS_ACLconst holding two functions. The old class tracked the last prepared directory so thatsecure()could refuse a file outside it, butSshConfig.save()is the only caller and already calls them in order. Removing that state removed three tests with it.parseWhoamiUserSidintocurrentUserSidand stopped exportingisFullyQualifiedWindowsPath, which existed only so a test could assert on it. The same decision is reachable throughWINDOWS_ACL.secure().FilePermissionstoManagedPermissions. It prepares a directory, so "File" was wrong, and the name now hints that absence means unmanaged.src/remote/windows/acl.tstosrc/remote/windowsAcl.ts, since the directory held one file.it.eachtables, command assertions became flat transcript strings instead of nested arrays, and the 60-second native test lost a duplicate fixture.CONTRIBUTING.mdsection and rewrote the changelog entry around the error users see.Validation
pnpm test: 2,710 passed, 6 skipped, 181 files. The native Windows tests are among the skips on Linux.pnpm typecheckandpnpm lintpass.*.confdirectory case against OpenSSH 9.6p1 on Linux: glibc opens a directory successfully, so OpenSSH reads zero lines and ignores it unless it is group-writable or unreadable. The Windows CRT fails the open instead, which aborts the wholeInclude, so the extension reports that entry rather than trying to fix it with an ACL change.Limits
A directory-preparation failure stops the write. A single file-reset failure logs a warning and still attempts the connection, so OpenSSH may reject a fragment the repair missed. The two directory commands are not atomic: a failure after
/resetcan leave the directory with its parent's grants. The path and link checks stop mistakes, not an attacker racing the check.Generated by Coder Agents on behalf of @EhabY.