You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows Named Pipe has no ACL and is squattable #1498
On Windows the daemon creates its Named Pipe with the default DACL and first_pipe_instance(false). The "owning user only" guarantee that the Unix socket provides (mode 0o600) is therefore absent on Windows: the pipe is reachable by other local principals, and a malicious process can pre-create and squat it.
Problem Statement
Every gRPC method is reachable by any local user through the default-DACL pipe, and first_pipe_instance(false) permits pipe-squatting (credential/prompt capture, response tampering). The trust model (OS socket/pipe permission is the entire authorization boundary) does not hold on Windows.
Proposed Solution
Build a SECURITY_ATTRIBUTES/DACL restricting the pipe to the current user, and set first_pipe_instance(true) (fail loudly if already owned). Until then, Windows explicitly does not meet the trust model. Governed by ADR-052 (local trust boundary).
Acceptance Criteria
Named Pipe is created with a DACL restricting access to the current user
first_pipe_instance(true) set; startup fails if the pipe is already owned
Behavior matches the Unix 0o600 guarantee
Code passes bun run quality:fix; tests pass
Technical Specifications
Reference Files
packages/daemon/src/main.rs (~315, ServerOptions::new().first_pipe_instance(false).create(...); contrast Unix 0o600 at ~157/207)
Not picked up today — Windows-only, unverifiable on our toolchain.
This is security-critical Windows-only unsafe Win32 FFI (token→SID, SDDL, SECURITY_ATTRIBUTES lifetimes, first-instance special-case, a Send-across-await subtlety). The entire #[cfg(windows)] block compiles out on our macOS dev box, and PR CI can't catch it either — release.yml is the only workflow touching windows-latest and it triggers solely on release/workflow_dispatch, never on PRs. Merging it here would ship a security change to Windows entirely unverified. Needs a Windows box (or a manual release run) to build/run/test before it can be merged safely.
Doc reference (July 2026): the target posture and acceptance criteria for this are now in nodespace-docs/architecture/security-posture.md threat T7 and the v1 hardening bar — the OS socket/pipe permission must hold identically on every platform: a Windows named-pipe DACL granting the owner SID only, with the first instance claiming the name (first_pipe_instance(true)). Governed by ADR-052 (local trust boundary), already cited above.
Board → Blocked (needs a Windows build environment). This is #[cfg(windows)] code; the current remote is darwin, and the pre-push gate builds the macOSnodespaced and never compiles the Windows cfg block — so it can't be implemented or verified here. Pick up on a Windows toolchain. (Note: #1498 unblocks nodespace-sync#246.)
Starting implementation. Building a SECURITY_ATTRIBUTES/DACL restricting the named pipe to the current user's SID, and flipping first_pipe_instance(true) so pipe creation fails loudly if the name is already squatted. Will verify on a real Windows 11 box via a standalone minimal cargo binary (same approach as #1452/PR#2610) since the full daemon crate can't build there (no libclang). Working in worktree issue-1498-windows-pipe-acl.
owner_only_security_attributes() builds a SECURITY_ATTRIBUTES via an SDDL descriptor O:{sid}D:P(A;;GA;;;{sid}) -- owner set to the current user's real SID, DACL grants that same SID (and only that SID) access. No ACE for Everyone/Authenticated Users/any other principal, so they're implicitly denied -- the Windows equivalent of bind_uds_owner_only's 0o600 on Unix.
create_owner_only_pipe(name, first_instance) wraps ServerOptions::create_with_security_attributes_raw with that DACL. The pipe name is now claimed once via first_pipe_instance(true)before the accept loop starts, so serve_grpc/serve_headless fail loudly at startup if the name is already owned/squatted, rather than silently serving on a name someone else pre-created.
Both Windows server loops (serve_headless, serve_grpc) share this helper; every acceptance-criterion box in the issue is checked.
Real Windows verification (hardware, not simulated)
The full nodespaced binary can't build on the available Windows box (no libclang for nlp-engine's bindgen), so -- same approach as #1452/PR #2610 -- I extracted the exact code into a standalone cargo scratch project (tokio + windows-sys only) and validated it live over SSH, including a run of the verbatim production code (not retyped) to rule out transcription drift.
DACL genuinely attached to the live pipe (read back via GetSecurityInfo, the same Win32 API icacls/Get-Acl use):
live handle security descriptor (SDDL): O:S-1-5-21-...-1001D:P(A;;FA;;;S-1-5-21-...-1001)
owner is current user: true; has ALLOW ACE for current user SID only: true; total ACE count in DACL: 1 (expected 1); no Everyone/Authenticated-Users/other-principal ACE: true
(FA = FILE_ALL_ACCESS, the resolved form of the GENERIC_ALL we requested for a pipe/file object -- expected.)
first_pipe_instance(true) genuinely rejects a pre-squatted name (the exact attack from this issue):
squatter pre-created \\.\pipe\nodespace-pipe-acl-test-squat-3176: OK (simulating a malicious pre-existing pipe)
legitimate first_pipe_instance(true) create FAILED as expected: Access is denied. (os error 5)
Normal serial-reconnect still works once legitimately claimed (first_pipe_instance(false)): confirmed OK.
Verbatim production code (copied straight from the final packages/daemon/src/main.rs, not hand-retyped) compiles clean and all 6 unit tests pass on the real machine, including the live-handle DACL readback test.
Honest gap: this Windows box has only one real usable local account, so true cross-user connect denial (actually opening the pipe as a different Windows identity and observing ERROR_ACCESS_DENIED) was not verified end to end -- creating a second account there was out of scope (same "needs human sign-off to modify the physical machine" reasoning that blocked installing LLVM in the earlier session). What was verified directly and programmatically is that the security descriptor attached to the live kernel object is exactly the restrictive one intended, which is what the OS access-check evaluates against any other principal's connection attempt.
Full evidence and commands are in the PR description. bun run test:all and bun run quality:fix both clean; pre-push gate (including cargo build --bin nodespaced and test:e2e) passed in full.
Activity
mstomar125 commentedon Jul 7, 2026
Not picked up today — Windows-only, unverifiable on our toolchain.
This is security-critical Windows-only
unsafeWin32 FFI (token→SID, SDDL,SECURITY_ATTRIBUTESlifetimes, first-instance special-case, a Send-across-await subtlety). The entire#[cfg(windows)]block compiles out on our macOS dev box, and PR CI can't catch it either —release.ymlis the only workflow touchingwindows-latestand it triggers solely onrelease/workflow_dispatch, never on PRs. Merging it here would ship a security change to Windows entirely unverified. Needs a Windows box (or a manual release run) to build/run/test before it can be merged safely.malibio commentedon Jul 23, 2026
Doc reference (July 2026): the target posture and acceptance criteria for this are now in
nodespace-docs/architecture/security-posture.mdthreat T7 and the v1 hardening bar — the OS socket/pipe permission must hold identically on every platform: a Windows named-pipe DACL granting the owner SID only, with the first instance claiming the name (first_pipe_instance(true)). Governed by ADR-052 (local trust boundary), already cited above.mstomar125 commentedon Aug 7, 2026
Board → Blocked (needs a Windows build environment). This is
#[cfg(windows)]code; the current remote is darwin, and the pre-push gate builds the macOSnodespacedand never compiles the Windows cfg block — so it can't be implemented or verified here. Pick up on a Windows toolchain. (Note: #1498 unblocks nodespace-sync#246.)mstomar125 commentedon Sep 14, 2026
Starting implementation. Building a SECURITY_ATTRIBUTES/DACL restricting the named pipe to the current user's SID, and flipping first_pipe_instance(true) so pipe creation fails loudly if the name is already squatted. Will verify on a real Windows 11 box via a standalone minimal cargo binary (same approach as #1452/PR#2610) since the full daemon crate can't build there (no libclang). Working in worktree issue-1498-windows-pipe-acl.
Restrict Windows Named Pipe to an owner-only DACL and fail loudly on …
mstomar125 commentedon Sep 14, 2026
Fixed in PR #2612: #2612
Implementation
owner_only_security_attributes()builds aSECURITY_ATTRIBUTESvia an SDDL descriptorO:{sid}D:P(A;;GA;;;{sid})-- owner set to the current user's real SID, DACL grants that same SID (and only that SID) access. No ACE forEveryone/Authenticated Users/any other principal, so they're implicitly denied -- the Windows equivalent ofbind_uds_owner_only's0o600on Unix.create_owner_only_pipe(name, first_instance)wrapsServerOptions::create_with_security_attributes_rawwith that DACL. The pipe name is now claimed once viafirst_pipe_instance(true)before the accept loop starts, soserve_grpc/serve_headlessfail loudly at startup if the name is already owned/squatted, rather than silently serving on a name someone else pre-created.serve_headless,serve_grpc) share this helper; every acceptance-criterion box in the issue is checked.Real Windows verification (hardware, not simulated)
The full
nodespacedbinary can't build on the available Windows box (nolibclangfornlp-engine's bindgen), so -- same approach as #1452/PR #2610 -- I extracted the exact code into a standalonecargoscratch project (tokio+windows-sysonly) and validated it live over SSH, including a run of the verbatim production code (not retyped) to rule out transcription drift.DACL genuinely attached to the live pipe (read back via
GetSecurityInfo, the same Win32 APIicacls/Get-Acluse):(
FA=FILE_ALL_ACCESS, the resolved form of theGENERIC_ALLwe requested for a pipe/file object -- expected.)first_pipe_instance(true)genuinely rejects a pre-squatted name (the exact attack from this issue):Normal serial-reconnect still works once legitimately claimed (
first_pipe_instance(false)): confirmed OK.Verbatim production code (copied straight from the final
packages/daemon/src/main.rs, not hand-retyped) compiles clean and all 6 unit tests pass on the real machine, including the live-handle DACL readback test.Honest gap: this Windows box has only one real usable local account, so true cross-user connect denial (actually opening the pipe as a different Windows identity and observing
ERROR_ACCESS_DENIED) was not verified end to end -- creating a second account there was out of scope (same "needs human sign-off to modify the physical machine" reasoning that blocked installing LLVM in the earlier session). What was verified directly and programmatically is that the security descriptor attached to the live kernel object is exactly the restrictive one intended, which is what the OS access-check evaluates against any other principal's connection attempt.Full evidence and commands are in the PR description.
bun run test:allandbun run quality:fixboth clean; pre-push gate (includingcargo build --bin nodespacedandtest:e2e) passed in full.