Skip to content

On Windows the daemon warns at every start that its data directory is open to other users (mode 666) #1665

Open

Description

@V3RON

On Windows the daemon logs this warning at every start, for a folder only its user can read:

{"level":"warn","module":"daemon","message":"data directory D:\\sv\\home is accessible to other users (mode 666); run chmod 700 D:\\sv\\home"}

Seen on Windows 11 23H2, Node 22.23.5, main at c9d82e3, with a fresh SIMLOCK_HOME the daemon created itself.

Why

The check (src/daemon/connection-host.ts:58) reads the folder's POSIX mode bits. Node on Windows makes up those bits from the read-only attribute (0o666, or 0o444), so they say nothing about who can open the folder; access is the folder's ACL. chmod 700, the fix the message names, is not a Windows command and changes nothing there.

Expected

No mode warning on Windows, or one that reads the ACL and names a Windows fix. The same goes for any other owner-only check that reads mode bits (e.g. connection-host's directory mode, which src/daemon/connection-host.test.ts checks as 448 and gets 438 on Windows).

Part of #1068.

Written by an agent.

Activity

  1. added this to the Windows support milestone on Nov 17, 2026
  2. added
    bug:newReported. An agent may triage it (rule 8); the fast track may set it ready (rule 17).
    on Nov 17, 2026
  3. self-assigned this
    on Nov 17, 2026
  4. V3RON commented on Nov 17, 2026

    @V3RON
    ContributorAuthor

    Reproduction

    Confirmed on Windows 11 at 57f6382 with a fresh SIMLOCK_HOME=D:\sv\bug1665-triage. One correction: that folder is not owner-only. It inherits Authenticated Users:(M) from D:\. The default home under C:\Users\<user> is owner-only, and Node still reports 666 for it.

    daemon.log: "data directory D:\\sv\\bug1665-triage is accessible to other users (mode 666); run chmod 700 D:\\sv\\bug1665-triage"
    icacls D:\sv\bug1665-triage: NT AUTHORITY\Authenticated Users:(I)(M), BUILTIN\Users:(I)(RX)
    icacls C:\Users\Szymon: SYSTEM, Administrators, Szymon only; node statSync mode: 666
    

    Test on bug/1665-repro: src/daemon/connection-host.test.ts, "warns on macOS and Linux when group or others can reach the folder, and never on Windows, whose mode bits Node makes up".

    pnpm exec vitest run --project unit src/daemon/connection-host.test.ts
    -     undefined,
    +     "data directory /home/0 is accessible to other users (mode 666); run chmod 700 /home/0",
    

    Root cause

    Defect. src/daemon/connection-host.ts:55-56 (prepareDataDirectory, called from src/daemon/main.ts:232) warns on any group/other bit. On Windows Node makes up those bits (0o666 or 0o444), so every start warns, whatever the ACL says. src/core/device-root.ts:174-176 already skips the same check on Windows for this reason.

    Simplest fix

    Add a platform parameter. Return undefined on win32. Pass process.platform from main.ts. Scope running-the-daemon.mdx:149 to macOS and Linux; the Windows aside below it already covers Windows. Mark the endpoint-directory test (connection-host.test.ts:38, 448 vs 438) it.skipIf(process.platform === "win32"), like ipc.test.ts:111.

    pnpm exec vitest run --project unit src/daemon/connection-host.test.ts src/daemon/main.test.ts
    Tests  29 passed (29)
    

    Alternatives rejected

    • Read the ACL with icacls and name an icacls fix: it adds a child process at every start. ADR 0003 (2026-10-30 amendment) supports Windows on single-user machines only.
    • Drop the check everywhere: it would lose a real warning on macOS and Linux.

    Risk

    • On Windows, D:\ folders stay open to other accounts with no warning. The ADR accepts this for single-user machines.
    • The skipIf was not run on Windows.

    Fast track

    • Defect: yes
    • Fix tried: yes
    • Nothing public added or broken: yes
    • No ADR or rule changed: yes
    • One fix: no — an ACL check would warn on D:\ folders like the reporter's

    Written by an agent.

  5. removed their assignment
    on Nov 17, 2026
  6. V3RON commented on Nov 17, 2026

    @V3RON
    ContributorAuthor

    Maintainer decision

    Read the folder's real Windows permissions instead of skipping the check: on Windows the daemon warns only when an account other than the user (and SYSTEM / Administrators) can read or change the data directory, and the warning names a Windows fix (an icacls command), not chmod 700. A folder on another drive such as D:\, which grants Authenticated Users modify by default, should warn; the default home under C:\Users\<user> should not. A failed or unreadable ACL check gives no warning and never fails the start. macOS and Linux keep today's mode check. The website sentence in running-the-daemon.mdx follows the new behaviour.

    This supersedes the "skip on Windows" proposal in the triage report; please triage again with this shape.

    Written by an agent.

  7. self-assigned this
    on Nov 17, 2026
  8. added a commit that references this issue on Nov 17, 2026
  9. V3RON commented on Nov 17, 2026

    @V3RON
    ContributorAuthor

    Supersedes the report above.

    Reproduction

    src/daemon/connection-host.test.ts, "on Windows warns from the folder's ACL only when another account can read or change it, names an icacls fix, and warns nothing when the ACL cannot be read; macOS and Linux keep the mode check" (branch bug/1665-repro, 67f155b). It replaces the skip-on-Windows test; its ACLs are what Get-Acl returned on Windows 11:

    pnpm exec vitest run --project unit src/daemon/connection-host.test.ts
    -     undefined,
    +     "data directory /home/default-home is accessible to other users (mode 666); run chmod 700 /home/default-home",
    
    D:\dev\<new>:     Administrators F, SYSTEM F, Authenticated Users M, Users RX   (all inherited from D:\)
    C:\Users\Szymon:  SYSTEM F, Administrators F, Szymon F, one app capability SID (S,X): traverse only
    node statSync mode: 666 for both
    

    Root cause

    Defect. src/daemon/connection-host.ts:55-58 (prepareDataDirectory, called from src/daemon/main.ts:232) checks mode bits everywhere; on Windows Node makes them up (0o666), so every start warns and names chmod 700.

    Simplest fix

    • New port src/ports/directory-access.ts: DirectoryAccessReader.read(path) runs PowerShell (10 s timeout), returning { user, entries: [{ sid, name, allow, rights }] }. SIDs, since names are localized.
    • prepareDataDirectory(filesystem, path, { platform, directoryAccess }): on win32, warn when an allow entry for a SID other than the user, SYSTEM, Administrators or CREATOR OWNER has a read or change right. A read that throws gives undefined.
    • Pinned message: ... accessible to other users (<names>); run icacls "<path>" /inheritance:r /grant:r "*<user>:(OI)(CI)F" "*S-1-5-18:(OI)(CI)F" "*S-1-5-32-544:(OI)(CI)F". Run in cmd.exe and PowerShell, it left the folder and its files owner-only; unquoted, PowerShell fails on (OI).
    • running-the-daemon.mdx:149: "... with the command that fixes it: chmod 700 on macOS and Linux, icacls on Windows."
    • src/core/device-root.ts:174 stays: device roots sit in the data directory by default, which this check covers, and that check refuses a platform, so an ACL check there would turn off the drivers for a D:\ home.
    macOS: vitest connection-host.test.ts main.test.ts   Tests 29 passed (29)
    Windows, real reader: D:\ folder -> warning above (868 ms); %TEMP% folder -> none (774 ms); failing reader -> none
    6 files, +208 -26 (tests included)
    

    Alternatives rejected

    None: the maintainer decided the shape.

    Risk

    • Each Windows start runs PowerShell once, about 0.8 s.
    • The endpoint-directory test (connection-host.test.ts:176, 448 vs 438) still fails on Windows; that path never runs there (the endpoint is a pipe).
    • Deny entries are ignored: a folder closed by a deny still warns.

    Fast track

    • Defect: yes
    • Fix tried: yes
    • Nothing public added or broken: yes
    • No ADR or rule changed: yes
    • One fix: yes

    Written by an agent.

  10. removed their assignment
    on Nov 17, 2026
  11. added
    bug:readyAn agent may fix it.
    fast-trackBug set ready by the fast-track check, not the maintainer (rule 17).
    and removed
    bug:newReported. An agent may triage it (rule 8); the fast track may set it ready (rule 17).
    on Nov 17, 2026
  12. self-assigned this
    on Nov 17, 2026
  13. V3RON commented on Nov 17, 2026

    @V3RON
    ContributorAuthor

    Handoff

    Done: PR #1674 built to the maintainer's decision (the daemon reads the folder's Windows ACL, warns only when another account can read or change it, names an icacls fix, and warns nothing when the read fails; macOS and Linux unchanged; website sentence updated). The review passed in round 1, round 2 and the fix-check, and R1–R3 are fixed. Checked on Windows 11: a C:\Users home gives no warning, a D:\ home warns, and after the printed icacls command a restart gives no warning. The PR is ready.

    Not done: merge.

    Findings: none open. src/core/device-root.ts stays as it is (see triage report).

    Blocked on: fast-track: #1665 held: PR #1674 changes 347 lines, over 250. The maintainer merges the PR, or removes fast-track.

    Written by an agent.

  14. added
    bug:blockedAgent stopped on a blocker in its handoff. Maintainer re-adds the label it came from.
    on Nov 17, 2026
  15. removed their assignment
    on Nov 17, 2026
  16. V3RON commented on Nov 17, 2026

    @V3RON
    ContributorAuthor

    Delivery run

    Merged: none
    Parked: #1665 — fast track holds PR #1674 (347 lines changed, limit 250); PR is ready, the maintainer merges it or removes fast-track

    Written by an agent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug:blockedAgent stopped on a blocker in its handoff. Maintainer re-adds the label it came from.fast-trackBug set ready by the fast-track check, not the maintainer (rule 17).

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions