Skip to content

Owner question: model guard: turn on "only managed hooks" so other hooks cannot change a checked call? #298

Open

Description

@scuttletoby

Recommendation: yes, turn on "only managed hooks" on each machine that runs the model guard, after moving the hooks you still want into the managed settings. Until then, the guard can be got around.

The question

PR #275 installs the model guard (a Claude Code hook that refuses model picks outside your policy) into Claude Code's managed settings. Only root can change that folder, and every Claude Code session reads it. That closes the hole the security review found: an agent could edit its own settings file and take the hook out.

One gap is left. Claude Code runs every matching hook at the same time, and a hook in a user or project settings file can change a call's input after the guard has checked it. An agent that can write its own settings file could add such a hook and change the model of a call that the guard already passed.

Claude Code's managed setting "allowManagedHooksOnly": true closes that gap: then only hooks in the managed settings run. But it also stops every hook in your own and your projects' Claude Code settings (for example the guard hooks and status hooks you use today), unless they are moved into the managed settings first.

Options

  1. (Recommended) Turn it on, after moving the hooks you want to keep into the managed settings. The guard then cannot be got around this way. Cost: the hooks you still want live in a root-owned file, so changing them needs root.
  2. Leave it off and accept the gap. Set "allowOtherHooks": true in the model-guard section of the machine file. The guard's self-check then stops reporting it. An agent that edits its own settings can still get around the guard.

What happens until you decide

The kit does not change this setting itself. Its self-check (model-guard --self-check) reports allowManagedHooksOnly is not true until you pick one of the two options. Everything else in the PR works either way.

🤖 Generated with Claude Code

Activity

  1. scuttletoby commented on Nov 22, 2026

    @scuttletoby
    OwnerAuthor

    Owner decision (in chat, 2026-11-22): option 1. Allow only root-owned hooks, after moving the hooks we use there.

    Posted by the orchestrator from the owner's chat answer.

    🤖 Generated with Claude Code

  2. changed the title [-]Model guard: turn on "only managed hooks" so other hooks cannot change a checked call?[/-] [+]Owner question: model guard: turn on "only managed hooks" so other hooks cannot change a checked call?[/+] on Nov 29, 2026
  3. added
    area:guards
    size:medium
    type:feature
    status:needs-owner-decision
    on Nov 29, 2026
  4. scuttletoby commented on Nov 30, 2026

    @scuttletoby
    OwnerAuthor

    Status on main dac2690: the repository side of option 1 is done. model-guard --self-check reports allowManagedHooksOnly is not true until it is set, unless allowOtherHooks allows other hooks (settings_problems in fork-kit/model-guard/lib/model_guard.py, with tests in guard.test.py and install.test.py). README step 4 describes the change. The agent-guards hooks already install into managed settings (managed-settings.d/agent-guards.json), so they keep running after the switch.

    What is left is a root step on each machine, and no code can do it: move any user or project hooks you still need into managed settings, set "allowManagedHooksOnly": true, then run the self-check. A minors sweep has nothing to fix here.

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:guardssize:mediumstatus:needs-owner-decisiontype:feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions