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
Daemon: enforce the peer user check that ADR-052 decides (code has permission-only boundary) #4284
Found while writing the decision nodes (#3729). ADR-052 section 2 decides that the daemon checks the connecting peer's user id. packages/daemon/src/main.rs:24-36 says there is no peer-credential check on Unix or Windows: the OS socket or pipe permission is the whole local trust boundary.
Work
Decide the exact check per platform (Unix peer credentials, Windows pipe ACL or client token) and implement it, so the code does what the record decides.
Tests that a connection from another user is refused, on Unix at least; Windows through the existing Windows device access.
Update the ADR text to the built behaviour in the same change set (docs repo).
Done when
A connection from a different user is refused by the daemon itself, with a test, and the record and the code agree.
Unix part merged in #4288 (24012f7): the daemon refuses a connecting peer whose effective uid differs from its own, on both Unix serving paths, with seam tests (a wrong own-uid over a real socket is refused with a transport error and zero RPCs), a same-user test, and source-level pins for the two call sites and for geteuid. Mutation-checked. Not exercised: a genuinely different OS user (needs a second account) and Linux. Still open on this issue: (1) the matching change in nodespace-sync (nodespaced-sync/src/main.rs, UDS serving at ~1217-1223) after a core rev bump with scripts/bump-core-rev.sh; (2) the Windows check: the pipe already has an owner-only DACL, whether to add a token compare on top is an owner decision; (3) ADR-052 text updated to the built behaviour, in the docs repo.
Sync half merged: nodespace-sync#1032 (1f26b711f) bumps the core pin to 24012f7 and serves the Sync daemon's Unix socket through core's peer_auth::owner_only_incoming, with a source-level pin test (a real-daemon test is not possible: the serving code is inline in the daemon's run function); reviewed with the app crate built and tested at the new pin (48 app tests, 1109 daemon tests, clippy clean). Both Unix daemons now refuse a peer whose uid differs from their own. Still open: the Windows check (owner decision: token compare on top of the owner-only pipe DACL, or document the DACL as the Windows check) and the ADR-052 text in the docs repo (being updated to the built behaviour).
ADR-052 text merged in the docs repo (nodespace-docs#158, 9d0a09953): sections 2 to 4 now state the built behaviour (Unix peer check in both daemons, socket 0600 in a 0700 directory, Windows pipe with an owner-only DACL and no peer-token check), with ADR-033 and the security-posture page aligned. Remaining on this issue: only the Windows decision (add a client-token compare on top of the owner-only DACL, or keep the DACL as the Windows boundary as documented). Leaving it open for that decision.
Windows part decided and checked on the real Windows PC (Windows 11, local account tomar, 2026-11-17). Decision: the owner-only pipe DACL stays the Windows boundary; no client-token compare is added on top. Reason: the kernel refuses a non-owner at connect, before the daemon sees the connection, and a token compare in the daemon would check the same identity the DACL already checks.
Checked with a scratch program that builds the daemon's exact pipe descriptor (O:<sid>D:P(A;;GA;;;<sid>), FILE_FLAG_FIRST_PIPE_INSTANCE) and connects three ways:
Same user token: connects.
Same user with a restricted token (restricting SID Everyone, which the DACL does not grant): ERROR_ACCESS_DENIED (5). This is the kernel refusing a principal outside the DACL; a second Windows account was not needed.
A second creation of the same pipe name with the first-instance flag: refused, error 5.
Not exercised: a genuinely separate Windows account, and a local Administrator using backup or take-ownership privileges (an accepted boundary, same as root on Unix). The scratch program is not in the repo; the full daemon cannot be built on that PC (no libclang), so there is no repo test for Windows. ADR-052 and the code comment already state this (docs #158, packages/daemon/src/main.rs).
With the Unix half (#4288, sync #1032) and the ADR text (docs #158) merged, closing.
Activity
Refuse a Unix socket peer whose user id is not the daemon's own
Refuse a Unix socket peer whose user id is not the daemon's own (#4284,…
mstomar125 commentedon Nov 17, 2026
Unix part merged in #4288 (24012f7): the daemon refuses a connecting peer whose effective uid differs from its own, on both Unix serving paths, with seam tests (a wrong own-uid over a real socket is refused with a transport error and zero RPCs), a same-user test, and source-level pins for the two call sites and for geteuid. Mutation-checked. Not exercised: a genuinely different OS user (needs a second account) and Linux. Still open on this issue: (1) the matching change in nodespace-sync (nodespaced-sync/src/main.rs, UDS serving at ~1217-1223) after a core rev bump with scripts/bump-core-rev.sh; (2) the Windows check: the pipe already has an owner-only DACL, whether to add a token compare on top is an owner decision; (3) ADR-052 text updated to the built behaviour, in the docs repo.
mstomar125 commentedon Nov 17, 2026
Sync half merged: nodespace-sync#1032 (1f26b711f) bumps the core pin to 24012f7 and serves the Sync daemon's Unix socket through core's peer_auth::owner_only_incoming, with a source-level pin test (a real-daemon test is not possible: the serving code is inline in the daemon's run function); reviewed with the app crate built and tested at the new pin (48 app tests, 1109 daemon tests, clippy clean). Both Unix daemons now refuse a peer whose uid differs from their own. Still open: the Windows check (owner decision: token compare on top of the owner-only pipe DACL, or document the DACL as the Windows check) and the ADR-052 text in the docs repo (being updated to the built behaviour).
mstomar125 commentedon Nov 17, 2026
ADR-052 text merged in the docs repo (nodespace-docs#158, 9d0a09953): sections 2 to 4 now state the built behaviour (Unix peer check in both daemons, socket 0600 in a 0700 directory, Windows pipe with an owner-only DACL and no peer-token check), with ADR-033 and the security-posture page aligned. Remaining on this issue: only the Windows decision (add a client-token compare on top of the owner-only DACL, or keep the DACL as the Windows boundary as documented). Leaving it open for that decision.
mstomar125 commentedon Nov 17, 2026
Windows part decided and checked on the real Windows PC (Windows 11, local account
tomar, 2026-11-17). Decision: the owner-only pipe DACL stays the Windows boundary; no client-token compare is added on top. Reason: the kernel refuses a non-owner at connect, before the daemon sees the connection, and a token compare in the daemon would check the same identity the DACL already checks.Checked with a scratch program that builds the daemon's exact pipe descriptor (
O:<sid>D:P(A;;GA;;;<sid>),FILE_FLAG_FIRST_PIPE_INSTANCE) and connects three ways:ERROR_ACCESS_DENIED(5). This is the kernel refusing a principal outside the DACL; a second Windows account was not needed.Not exercised: a genuinely separate Windows account, and a local Administrator using backup or take-ownership privileges (an accepted boundary, same as root on Unix). The scratch program is not in the repo; the full daemon cannot be built on that PC (no libclang), so there is no repo test for Windows. ADR-052 and the code comment already state this (docs #158,
packages/daemon/src/main.rs).With the Unix half (#4288, sync #1032) and the ADR text (docs #158) merged, closing.