Write deny rules not enforced via managed settings (.mobileconfig)
Resolved 💬 5 comments Opened Apr 11, 2026 by wunder-one Closed May 24, 2026
Description
Write deny rules delivered via macOS managed settings (.mobileconfig configuration profile targeting com.anthropic.claudecode) are not enforced. Bash deny rules in the same profile work correctly.
This may be an incomplete fix from #6699, where all deny rules were broken. Bash deny appears fixed, but Write deny does not.
Steps to Reproduce
- Deploy a
.mobileconfigprofile withcom.anthropic.claudecodepreference domain containing:
<key>permissions</key>
<dict>
<key>deny</key>
<array>
<string>Write(**/.env)</string>
<string>Write(**/.env.*)</string>
<string>Bash(gh repo create --public*)</string>
<string>Bash(gh repo create *--public*)</string>
<string>Bash(gh repo create *--visibility public*)</string>
</array>
</dict>
- Verify the profile is installed (visible in System Settings → Device Management)
- Restart Claude Code
- Ask Claude to write a
.envfile — it succeeds (not blocked) - Ask Claude to run
gh repo create --public test— it is blocked (correctly denied)
Expected Behavior
Write(**/.env) and Write(**/.env.*) should block Claude from creating or overwriting .env files, the same way Bash(gh repo create --public*) blocks the bash command.
Actual Behavior
Bashdeny rules: enforced ✅Writedeny rules: not enforced ❌
Environment
- macOS 15 (Sequoia)
- Claude Code latest (CLI)
- Deny rules delivered via
.mobileconfigmanaged settings (MDM), notsettings.json - Profile is signed and installed, visible in System Settings → Device Management
Related Issues
- #6699 — original report of all deny rules being broken (closed)
- #24846 —
Readdeny for.envnot enforced (closed as duplicate of #6699)
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗