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: restrictive file modes are unenforced (private key, state home, config, secrets) — route every mutation through fsroot #405
Go's os.Chmod on Windows toggles only the read-only attribute. Every writable file reports mode 0666 regardless of the mode requested, so a 0600 intent is silently not enforced there.
This surfaced during the #373 Windows campaign: seven test assertions fail on the windows leg with permission = 666, want 600 (and -rw-rw-rw-, want 0600). Those assertions are being moved into _unix_test.go files — the mode bits are genuinely a Unix subject and the assertions are meaningless on Windows — but scoping them removes the only coverage that restrictive-mode intent is honored anywhere, so the gap is filed here rather than lost in the move.
Why it matters
The sharpest case is writ secret: encryption.decrypt_sops_file writes plaintext derived from an encrypted source. On Unix that lands at 0600. On Windows it lands writable-by-all-with-access, governed only by whatever ACLs the containing directory happens to inherit.
internal/document — Write (YAML/JSON) at 0600, and the caller-supplied perm override
pkg/op/provider/file — Copy, WriteBytes, and Observe's reported mode
cmd/writ/writ/deploy — the SOPS chain integration (secret and note at 0600)
The question to settle
Does writ need a Windows ACL equivalent — restricting the file to the current user via icacls or golang.org/x/sys/windows — or is inherited directory ACL protection (a layer root under the user profile) sufficient, making this a documented platform-semantics ruling instead of a defect?
The inherited-ACL premise is worth testing rather than assuming: a layer root outside the user profile (a shared drive, C:\ProgramData) would break it silently, and nothing currently asserts otherwise.
Phase 3e is a test-classification phase; designing an ACL path there would block the campaign's actual goal (the platform gate) behind unrelated product work. Ruled 2026-08-13.
Corrected and re-scoped (2026-08-13). Two things in the original filing are wrong, and the disposition has been reversed.
1. The headline case was wrong. I filed this naming writ secret's decrypted output as the sharpest instance. Enumerating the actual call sites found worse: pkg/signing/signing.go:202 writes a private key at 0600 into a directory created at 0700 — both unenforced on Windows. The run index and state home (internal/cli/index.go), the user config (internal/cli/config.go), and the self-install manifest are in the same set.
2. The surface is far larger than the seven failing tests.84 direct os.* mutation calls live outside fsroot; 31 of them pass a restrictive permission. A fix confined to the file provider — or to fsroot alone, as first proposed — would have looked complete and missed the private key.
3. Disposition reversed: this is not deferred, and the tests are not being scoped away. The original ruling was "file the issue, move the assertions to _unix_test.go." That is superseded: Windows permissions must be enforced natively, so a product that accepts 0600 and silently produces an unrestricted file is wrong on Windows, not correctly platform-scoped. The seven failures are reclassified bucket 1 and will be cleared by enforcement rather than by scoping. This work lands before the complexity debt (#312 phase 8).
Rulings
Enforce natively. No documented resignation.
Every mutation through fsroot — all 84 sites, zero exemptions, harnesses and docgen included. A rule with carve-outs erodes; this one is mechanically guardable.
Mechanism: golang.org/x/sys/windows — already a direct dependency, and cmd/writ/writ/snapshot/protect_darwin.go sets the precedent for platform-specific protection via x/sys. No icacls shell-out.
Mapping: private-vs-not.perm&0o077 == 0 → a protected DACL (inheritance broken) granting owner + SYSTEM + Administrators; otherwise the inherited default. Restricting SYSTEM/Administrators is theater and breaks backup/AV tooling. Accepted: 0640 and 0600 are indistinguishable on Windows.
file.Observe reports the real mode plus a DACL-derived restricted fact. Nothing fabricated.
Breaking inheritance is the load-bearing detail — without a protected DACL the file keeps its parent's inherited ACEs and stays accessible regardless of what is granted.
Plan
docs/plans/windows-native-permissions.md — four phases: fsroot API + Windows enforcement (proved by DACL read-back tests before any call site moves), migrate the 31 security-relevant sites, migrate the remaining 53, then the lint guard banning direct os.* mutations outside pkg/fsroot plus the Observe access fact.
Coverage increases rather than shrinking: _windows_test.go asserts the ACE set; _unix_test.go keeps the mode-bit assertions.
changed the title [-]Windows: 0600 permission intent is unenforced (writ secret decrypted output unrestricted)[/-][+]Windows: restrictive file modes are unenforced (private key, state home, config, secrets) — route every mutation through fsroot[/+]on Aug 14, 2026
Activity
David-Noble-at-work commentedon Aug 14, 2026
Corrected and re-scoped (2026-08-13). Two things in the original filing are wrong, and the disposition has been reversed.
1. The headline case was wrong. I filed this naming
writ secret's decrypted output as the sharpest instance. Enumerating the actual call sites found worse:pkg/signing/signing.go:202writes a private key at0600into a directory created at0700— both unenforced on Windows. The run index and state home (internal/cli/index.go), the user config (internal/cli/config.go), and the self-install manifest are in the same set.2. The surface is far larger than the seven failing tests. 84 direct
os.*mutation calls live outsidefsroot; 31 of them pass a restrictive permission. A fix confined to the file provider — or tofsrootalone, as first proposed — would have looked complete and missed the private key.3. Disposition reversed: this is not deferred, and the tests are not being scoped away. The original ruling was "file the issue, move the assertions to
_unix_test.go." That is superseded: Windows permissions must be enforced natively, so a product that accepts0600and silently produces an unrestricted file is wrong on Windows, not correctly platform-scoped. The seven failures are reclassified bucket 1 and will be cleared by enforcement rather than by scoping. This work lands before the complexity debt (#312 phase 8).Rulings
fsroot— all 84 sites, zero exemptions, harnesses anddocgenincluded. A rule with carve-outs erodes; this one is mechanically guardable.golang.org/x/sys/windows— already a direct dependency, andcmd/writ/writ/snapshot/protect_darwin.gosets the precedent for platform-specific protection viax/sys. Noicaclsshell-out.perm&0o077 == 0→ a protected DACL (inheritance broken) granting owner + SYSTEM + Administrators; otherwise the inherited default. Restricting SYSTEM/Administrators is theater and breaks backup/AV tooling. Accepted:0640and0600are indistinguishable on Windows.file.Observereports the real mode plus a DACL-derivedrestrictedfact. Nothing fabricated.Breaking inheritance is the load-bearing detail — without a protected DACL the file keeps its parent's inherited ACEs and stays accessible regardless of what is granted.
Plan
docs/plans/windows-native-permissions.md— four phases: fsroot API + Windows enforcement (proved by DACL read-back tests before any call site moves), migrate the 31 security-relevant sites, migrate the remaining 53, then the lint guard banning directos.*mutations outsidepkg/fsrootplus theObserveaccess fact.Coverage increases rather than shrinking:
_windows_test.goasserts the ACE set;_unix_test.gokeeps the mode-bit assertions.Refs #373.
[-]Windows: 0600 permission intent is unenforced (writ secret decrypted output unrestricted)[/-][+]Windows: restrictive file modes are unenforced (private key, state home, config, secrets) — route every mutation through fsroot[/+]feat(fsroot): reach *os.Root parity and add a self-removing scratch r…
feat(fsroot): enforce restrictive modes on Windows with a protected D…
docs: rule that filesystem access is received, never constructed (#409)
test(op): build test sessions through the real constructor, not liter…
docs: rule the session accessors and record phase 2 as proved (#411)
test: finish moving test sessions onto the real constructor (#412)
feat(fsroot): add CreateTemp and MkdirTemp to the Root interface (#413)
feat(op): make the session own filesystem access behind accessors (#414)
refactor(archive,devlore-test): retire the hand-rolled temp lifecycles (
docs: plan phase 3, charter step 54, append phase 7 (#417)
docs: rule step 54 — find home by ladder, XDG names rooted there (#418)
7 remaining items
fix(deploy): the sops test asserts the portable fact -- mode bits on …
David-Noble-at-work commentedon Nov 9, 2026
star github triage sweep added this issue to Triage: devlore, for the rule it breaks:
no-evidence: no Evidence of completion section