(feat) build: port the 0600/0700 file-mode discipline to Windows (issue #974) #1527
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1527"
general
weight: 0.35
alexey-pelykh
The
0700/0600discipline was roughly forty raw mode integers spread across thirteen files,every one of them reaching a
std::os::unixsymbol. This states the intent once — this belongs toits owner and to nobody else — and puts the per-target mechanism behind it.
#974 stays OPEN, and the partition is:
builds and runs here, and both are graded by gates that can fail: the abstraction exists and the
~40 sites route through it; no Unix permission test body was edited and the suite is green.
Windows. No CI job compiles this crate for Windows, so nothing here can fail it, and booking it
as delivered would pass it vacuously (
CONTRIBUTING.md§ Writing an acceptance criterion). Theone artifact that could evidence AC2 is the
#[cfg(windows)]test set AC3 asks for — the sameunrun thing, seen twice. #978 builds the job that grades both.
The
Part of #974.body links are deliberate: the issue is incomplete until that job exists.What the recon actually found — this revises the project record
Recon #40 measured a live Windows credential file: SYSTEM, Administrators and the owning user, all
FullControl, and no
Users,EveryoneorAuthenticated Users. In practice that already isthe
0600equivalent, so this is not closing a hole. What it is: every one of those ACEs isINHERITED, so the file carries no DACL of its own and follows the profile directory silently if
that ever changes.
src/file_policy.rs's module docs open on that finding; ADR-0038 § Context isthe record.
The shape, and why (AC1)
src/file_policy.rs—open_owner_only,owner_only_file,owner_only_dir,copy_policy,owner_is_current_user,owner_is_current_user_nofollow,owner_only_deviation. Named after whatcallers mean, not after what either platform does. The alternative — gating each of the ~40 sites —
makes a security property into forty independent chances to get one wrong; the reasoning is
ADR-0038 § Decision 1 and § Alternatives considered.
The Windows mechanism (AC2, and #28's substance)
windows_impl::write_owner_only_daclwrites an explicit PROTECTED DACL:D:P(A;;FA;;;SY)(A;;FA;;;BA)(A;;FA;;;<sid>), directories the same withOICIPis the whole point — without it these ACEs are a floor the parent can widen, which is theinherited-only state above
<sid>is this process's own token user, read throughcrate::control_transport::our_user_sid,never a literal and never configurable
No dependency added:
windows-syshas been in the graph on this target since #1513 and every callis in a feature already enabled, so
Cargo.lockis byte-identical.The read-back matches the alias the renderer may substitute
The two sides of the read-back come from different calls with different alias policies:
ConvertSecurityDescriptorToStringSecurityDescriptorWsubstitutes a two-letter constant for awell-known SID, while
ConvertSidToStringSidW— how this crate learns its own SIDs — is documentedalways to produce
S-1-…. Under the built-in Administrator account the owner ACE therefore readsback as
LAand matches neither our SID string nor theSY/BAfloor, androster_backuprefusesa real roster write over a formatting difference.
sddl_alias_formaps the domain-relative userRIDs that carry one (500 →
LA, 501 →LG) andowner_only_dacl_defectmatches each owner both aswritten and as its alias. It cannot widen the policy — an alias is admitted only where our own SID
is the account it stands for — and being a suffix match on a string it is graded by ordinary tests
here. The rendering itself has been observed nowhere; #1530 observes it and settles the set.
The AC3 tests assert INHERITED-vs-EXPLICIT, not "the owner can read it"
an_inherited_ace_is_rejected_however_correct_its_trustees_areis the one AC3 names: a DACLcarrying the right three trustees but marked inherited is REJECTED.
an_unprotected_dacl_is_rejecteddoes the same for an unprotected descriptor. Both are ordinary unit tests that run on macOS and
Linux today, because the SDDL writer and the read-back predicate are target-neutral text — only the
syscalls are
cfg(windows).The five
#[cfg(windows)]tests inmod windowsare committed and have never run.ci-okisthe only required check and no job compiles this crate for Windows, so landing them red is
unavailable; #978 is where they get graded.
Unix behaviour is unchanged (AC4)
No Unix permission test body was edited. The seven in
src/paths.rsand the rest acrossclaude_state,cli,config/render,config/write_lock,observability,usage_store,swap,canary,daemon/canonical,daemon/commandsanduse_accountare#[cfg(unix)]-gated with theirassertions intact; the imports they need moved into the gated preamble.
One mechanism did change beneath that, and ADR-0038 § Positive now records it rather than claiming
byte-for-byte identity:
write_preserving_modeapplied the source's policy withfile.set_permissions—fchmodon the held fd — andcopy_policyapplies it by path. Same mode,same moment, same-user writer throughout, so no privilege boundary moves.
One source-shape guard also moved, and it is not a permission test:
src/roster_backup.rspinnedthe literal string
permissions().mode(), which the production code no longer spells. It now pinsfile_policy::owner_only_deviation(&target), the same obligation stated against the abstraction,and its canary moved in lockstep.
What the ADR records as bounded rather than settled
crate's own tree, and not for
write_private_file(<path>.tmplands inpath's own directory,which
write_exporttakes from the operator) nor forwrite_preserving_mode's~/.claude.json.tmp. #1528 carries the atomic owner-only create that removes the window;control_transportalready builds aSECURITY_ATTRIBUTESforCreateNamedPipeW, so the crate ispast std on that API.
CLOSED on Windows.
or recording per fixture why none exists. #978 runs committed tests and does not cover that.
Measured
Windows target at
49561e8,cargo check --target x86_64-pc-windows-msvc --all-targets: 156 → 89error lines; the
mode/from_mode/uidcluster is at 0. Threeas_raw_fderrors surfacedthat the
.mode()failure on the same expression had been masking — they belong to theflockport,on the same lines as
libc::flock/LOCK_EX.At
f903c16:fmt,clippy -D warnings,RUSTDOCFLAGS="-D warnings" cargo doc,build,test(
ok. 2403 passed; 0 failed; 14 ignored),check-no-security-framework.sh(70 packages),cargo deny check advisories sources licenses, everydoc-gatesscript, and themsrvjobreproduced on 1.87.0 (2403 passed) are all green locally.
Part of #974. Toward #28, which stays open.
🤖 Generated with Claude Code