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

  1. Deploy a .mobileconfig profile with com.anthropic.claudecode preference 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>
  1. Verify the profile is installed (visible in System Settings → Device Management)
  2. Restart Claude Code
  3. Ask Claude to write a .env file — it succeeds (not blocked)
  4. Ask Claude to run gh repo create --public testit 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

  • Bash deny rules: enforced
  • Write deny rules: not enforced

Environment

  • macOS 15 (Sequoia)
  • Claude Code latest (CLI)
  • Deny rules delivered via .mobileconfig managed settings (MDM), not settings.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 — Read deny for .env not enforced (closed as duplicate of #6699)

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗