Restrict Windows named-pipe DACL to creating user#5214
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5214 +/- ##
==========================================
- Coverage 67.79% 67.78% -0.02%
==========================================
Files 608 610 +2
Lines 62234 62266 +32
==========================================
+ Hits 42191 42204 +13
- Misses 16869 16889 +20
+ Partials 3174 3173 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
3 tasks
This was referenced May 7, 2026
By default winio.ListenPipe inherits the kernel default DACL, which on shared, RDP, or Citrix hosts permits any other interactive user to open the pipe and exercise the entire REST API; OIDC is opt-in via WithOIDCConfig and not always present. Set an explicit SDDL granting GenericAll only to the creating user (OW) and SYSTEM (SY), with the Protected flag (P) so no inherited ACEs widen the descriptor. Soften the surrounding doc comment to match what the listener now enforces, and mark the Windows AF_UNIX fallback path as best-effort since the .sock file inherits the parent directory's NTFS ACL. Add http.Server.IdleTimeout as defense in depth across platforms; winio.MaxInstances defaults to 255, so a slow client must not be allowed to keep an instance idle indefinitely and starve new connections. Co-authored-by: Cursor <cursoragent@cursor.com>
aponcedeleonch
approved these changes
May 7, 2026
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
Follow-up to #5201 (review thread). Stacked on
socker-windows; will rebase ontomainonce #5201 merges.By default
winio.ListenPipeinheritsCreateNamedPipeW's default DACL, which on shared / RDP / Citrix hosts permits any other interactive user to open the pipe and exercise the entire REST API (OIDC is opt-in viaWithOIDCConfig, not always present). This PR sets an explicit SDDL on the pipe and adds defense-in-depth around connection lifecycle:pkg/api/socket_windows.go) —D:P(A;;GA;;;OW)(A;;GA;;;SY)grants GenericAll to the creating user (OW) and SYSTEM (SY) only, with the Protected flag (P) blocking any inherited ACEs that could widen the descriptor.os.Chmodis meaningless on Windows; the named-pipe path is the recommended transport.http.Server.IdleTimeout(pkg/api/server.go) — winio's defaultMaxInstancesis 255, a hard concurrency ceiling unlike POSIX, so a slow client cannot be allowed to hold an instance idle forever and starve new connections. Applies cross-platform.Addresses inline review comments 3201085355 (pipe DACL) and 3201085359 (AF_UNIX fallback ACL), plus the IdleTimeout note in 3201085433.
Type of change
Test plan
go test ./pkg/api/...) — green on macOS.GOOS=windows go vet ./pkg/api/...andGOOS=windows go test -c -o /dev/null ./pkg/api/— both clean.CreateFile(\\.\pipe\thv-api)is rejected withERROR_ACCESS_DENIED— pending; deferred to a reviewer with a Windows host.Does this introduce a user-facing change?
Yes (Windows only). Other local users on the same Windows host can no longer dial
\\.\pipe\thv-api; only the user that startedthv serveand SYSTEM can. macOS / Linux behaviour is unchanged.