Description
Summary
disk-hygiene's kill switch treats /etc/claude-code/managed-settings.json as a root-owned path that cannot be forged, and lets a value configured there override the user's setting. On WSL the live docs say /etc/claude-code is user-writable, so any process running as the user can stand in for organization policy: it can replace an organization's audit-only setting, or force-enable the clean skill's execution tiers over the user's own audit-only choice.
Affected area / component
plugins/disk-hygiene/lib/killswitch_config.py
Steps to reproduce
- On WSL, as the ordinary user, write
/etc/claude-code/managed-settings.json(or a file in/etc/claude-code/managed-settings.d/) that setspluginConfigs["disk-hygiene@<marketplace>"].options.disk_hygiene_enabledtotrue. - Set the same option to
false(audit-only) in user settings. - Call
resolve_effective()with the platform's managed path. The managed value wins and the execution tiers are enabled.
(Repro is from reading the code path; not run.)
Expected behavior
On platforms where the managed directory is user-writable, the guard does not treat that path as an organization-controlled source for the kill switch.
Actual behavior
killswitch_config.py:45-78(managed_settings_path): the docstring says the file "lives at a fixed, root-owned system path per platform, so a repo cannot forge it", and the function returns/etc/claude-code/managed-settings.jsonfor everylinux*platform, WSL included.killswitch_config.py:291-317(resolve_effective): a configured managed value is returned before user settings are read.- Live docs, https://code.claude.com/docs/en/managed-settings#present-admin-documents (read 2026-10-12): "On WSL,
/etc/claude-codeis user-writable as well", with thewslInheritsWindowsSettingsentry saying when the Windows documents stand above it.
Suggested fix
Detect WSL and treat a user-writable managed path as untrusted for this switch (for example, honor it only when it is root-owned and not writable by the current user), and correct the docstring.
The related fail-open gap (the guard's hook rows do not set onFailure: "block") is tracked in #6755 and is not repeated here.
Environment
WSL; disk-hygiene on main as of 2026-10-12.
Activity
github-actions commentedon Oct 12, 2026
Thanks for the report. Automated triage handed this issue to a maintainer.
Automated triage. A maintainer reviews it.
kyle-sexton commentedon Oct 13, 2026
Decision recorded. The owner approved applying independently verified recommendations (high-risk set, reviewed) on 2026-10-13.
Basis: https://code.claude.com/docs/en/managed-settings#present-admin-documents (fetched 2026-10-12, line 167: 'On WSL, /etc/claude-code is user-writable as well'); plugins/disk-hygiene/lib/killswitch_config.py:51-94 (Linux/WSL path), :291-317 resolve_effective per issue
disk-hygiene's kill switch returns a managed-settings value before user settings, and reads /etc/claude-code on WSL, which the docs say is user-writable, so a user process can force-enable the execution tiers. The docstring on main already notes the path is not admin-only everywhere, but the code still trusts it.
Verification notes:
Verified by an independent fresh-context check (confirmed, risk high): gh issue view 7287 (open, no owner decision); origin/main plugins/disk-hygiene/lib/killswitch_config.py:51-96 (docstring already says not admin-only everywhere; linux* returns /etc/claude-code path); origin/main killswitch_config.py:265-337 (_managed_settings_files, _managed_effective, resolve_effective returns managed verdict before user settings; default closed to enabled); WebFetch https://code.claude.com/docs/en/managed-settings line 167: 'On WSL, /etc/claude-code is user-writable as well'; git log killswitch_config.py: latest #7252 docs only
Admission to an agent lane stays with the work-class rules and owner ratification.
kyle-sexton commentedon Oct 18, 2026
Decision recorded.
Question: How should the disk-hygiene kill switch treat a managed settings file the current user can write, such as /etc/claude-code on WSL?
Owner's answer: Asymmetric trust: a managed value that restricts is honored from any file, but a managed value that enables execution is honored only from a file that is root-owned and not writable by the current user, checked per file including each drop-in.
The owner confirmed this decision, first recorded at #7287 (comment), in an attended backlog-shaping session on 2026-10-18. The question was "Confirm the 10 decisions, #7287's kill-switch hardening included, and admit them to the paced queue?" and the owner answered "Yes, all 10 (Recommended)".
Posted by AI from the owner's answer in that session.
kyle-sexton commentedon Oct 18, 2026
Agent Brief
Type: Bug
Summary: The disk-hygiene kill switch honors an enabling managed-settings value only from a file that is root-owned and not writable by the current user.
Current behavior:
The kill switch treats
/etc/claude-code/managed-settings.json(and itsmanaged-settings.ddrop-ins) as an organization-controlled source on every linux platform, WSL included, and returns a configured managed value before reading user settings. On WSL that directory is user-writable, so any user process can force-enable the clean skill's execution tiers.Desired behavior:
disk_hygiene_enabledfalse) is honored from any managed file, whoever owns it.managed_settings_pathdocstring no longer claims the path cannot be forged.Key interfaces:
resolve_effective(): same signature; an enabling managed value from an untrusted file no longer wins.Acceptance criteria:
scripts/run-test-file.shon the disk-hygiene pytest file covering the kill switch passes, with new cases: a user-owned managed file setting enabled=true does not enable when user settings say false; a user-owned managed file setting enabled=false still restricts; a root-owned non-writable file setting enabled=true still enables (ownership stubbed).managed-settings.dfile.scripts/check-changelog-fragments.shpasses.Out of scope:
This was generated by AI during backlog shaping. The owner approved its admission in an attended backlog-shaping session on 2026-10-18.