Single instance (Windows): check the pipe server owner SID before sending #896

Open
opened 2026-11-18 12:01:24 +00:00 by charles · 0 comments
Owner

Follow-up of #890 (Shell 17: platform-single-instance, #809), review round 1.

On Windows, a secondary connects to \\.\pipe\flaxative-<user SID>-<scope hash> without checking who owns the server end (single_instance/windows.rs, connect, PeerCheck = ()). The pipe name is predictable, so another local user who creates it first (before the primary starts) would receive the secondaries messages (a URL or an activation token), while the real primary refuses the existing pipe and runs with no channel.

Proposed: after ClientOptions::open, call GetNamedPipeServerProcessId, open that process with PROCESS_QUERY_LIMITED_INFORMATION, read its token user SID and require it to equal the current user SID (refuse the connection otherwise, SendOutcome::NoAnswer). Needs the Win32_System_Pipes feature of windows 0.62 and a test on the Windows runner (a pipe served by the same user is accepted; the refusal path through a predicate on the two SIDs).

Severity: minor (needs another local user acting first on the same machine).

Follow-up of #890 (Shell 17: platform-single-instance, #809), review round 1. On Windows, a secondary connects to `\\.\pipe\flaxative-<user SID>-<scope hash>` without checking who owns the server end (`single_instance/windows.rs`, `connect`, `PeerCheck = ()`). The pipe name is predictable, so another local user who creates it first (before the primary starts) would receive the secondaries messages (a URL or an activation token), while the real primary refuses the existing pipe and runs with no channel. Proposed: after `ClientOptions::open`, call `GetNamedPipeServerProcessId`, open that process with `PROCESS_QUERY_LIMITED_INFORMATION`, read its token user SID and require it to equal the current user SID (refuse the connection otherwise, `SendOutcome::NoAnswer`). Needs the `Win32_System_Pipes` feature of `windows` 0.62 and a test on the Windows runner (a pipe served by the same user is accepted; the refusal path through a predicate on the two SIDs). Severity: minor (needs another local user acting first on the same machine).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/fluxer-native#896
No description provided.