23 23
24## Stop user-installed mods from loading24## Stop user-installed mods from loading
25 25
26To keep every mod your users bring from running its hooks, set the `allowManagedModsOnly` option on the [built-in guard](#know-what-happens-by-default), a policy mod that Claude Code loads ahead of every mod a user installs. The option goes in managed settings under `pluginConfigs`, keyed by `cc-plugin-sec-default@builtin`:26To refuse users' mods, set the `allowManagedModsOnly` option on the [built-in guard](#know-what-happens-by-default), a policy mod that Claude Code loads ahead of every mod a user installs. The option goes in managed settings under `pluginConfigs`, keyed by `cc-plugin-sec-default@builtin`:
27 27
28```json managed-settings.json theme={null}28```json managed-settings.json theme={null}
29{29{
39 39
40With the option set in managed settings:40With the option set in managed settings:
41 41
42* **No mod a user brings runs its hooks**: that covers a mod in a plugin the user installed, a mod loaded with `--plugin-dir`, and a mod [Claude wrote during a session](https://code.claude.com/docs/en/plugins/mods/create.md#ask-claude-for-a-mod)42* **The guard refuses these mods**: a mod in a plugin only the user enabled, a mod loaded with `--plugin-dir`, and a mod [Claude wrote during a session](https://code.claude.com/docs/en/plugins/mods/create.md#ask-claude-for-a-mod)
43* **Your organization's mods still run**: a mod that [counts as your organization's](#install-your-organizations-mods) isn't checked. Every other mod counts as a user's and is refused. That includes a mod your organization turns on for its members on claude.ai. If none counts as yours, no installed mod runs its hooks.43* **Your organization's mods still run**: a mod that [counts as your organization's](#install-your-organizations-mods) isn't checked. Every other mod counts as a user's and is refused. That includes a mod your organization turns on for its members on claude.ai. If none counts as yours, no installed mod runs its hooks.
44* **Claude Code ignores the option in other settings files**: if someone sets it in a user, project, local, or `--settings` file, your value still applies44* **Claude Code ignores the option in other settings files**: if someone sets it in a user, project, local, or `--settings` file, your value still applies
45* **A file or MDM policy covers every provider**: when you deliver the option as a file or through MDM, it works the same way on Amazon Bedrock, Google Cloud's Agent Platform, and Microsoft Foundry. For delivery from the claude.ai admin console, see [Platform availability](https://code.claude.com/docs/en/server-managed-settings.md#platform-availability)45* **A file or MDM policy covers every provider**: when you deliver the option as a file or through MDM, it works the same way on Amazon Bedrock, Google Cloud's Agent Platform, and Microsoft Foundry. For delivery from the claude.ai admin console, see [Platform availability](https://code.claude.com/docs/en/server-managed-settings.md#platform-availability)
200 200
201| What you want | Settings |201| What you want | Settings |
202| :- | :- |202| :- | :- |
203| No installed mod runs, with settings hooks untouched | Set [`allowManagedModsOnly`](#set-options-on-the-built-in-guard) and deploy no mods of your own |203| No installed mod runs, with settings hooks untouched | In managed settings, set [`allowManagedModsOnly`](#set-options-on-the-built-in-guard) and don't enable a plugin that contains a mod |
204| No installed mods and no hooks at all, your managed hooks included | Set `disableAllHooks` to `true` |204| No installed mods and no hooks at all, your managed hooks included | Set `disableAllHooks` to `true` |
205| Only your organization's mods | Set the guard's [`allowManagedModsOnly` option](#stop-user-installed-mods-from-loading), and [install your mods](#install-your-organizations-mods) so that they count as yours |205| Only your organization's mods | Set the guard's [`allowManagedModsOnly` option](#stop-user-installed-mods-from-loading), and [install your mods](#install-your-organizations-mods) so that they count as yours |
206| Any mod from marketplaces you approve outside claude.ai | Set a [marketplace allowlist](https://code.claude.com/docs/en/plugins/org.md#restrict-what-users-can-install) without `skills-dir`, set `disableSideloadFlags` to `true`, and set [`syncClaudeAiPlugins`](https://code.claude.com/docs/en/settings-reference#syncclaudeaiplugins) to `false` |206| Any mod from marketplaces you approve outside claude.ai | Set a [marketplace allowlist](https://code.claude.com/docs/en/plugins/org.md#restrict-what-users-can-install) without `skills-dir`, set `disableSideloadFlags` to `true`, and set [`syncClaudeAiPlugins`](https://code.claude.com/docs/en/settings-reference#syncclaudeaiplugins) to `false` |
262* **Give one group a different policy, such as a pilot**: [Plan for what managed settings can't enforce](https://code.claude.com/docs/en/plugins/org.md#plan-for-what-managed-settings-can’t-enforce)262* **Give one group a different policy, such as a pilot**: [Plan for what managed settings can't enforce](https://code.claude.com/docs/en/plugins/org.md#plan-for-what-managed-settings-can’t-enforce)
263* **Check which apps and session kinds apply the plugin keys**: [When each surface applies the plugin keys](https://code.claude.com/docs/en/plugins/org.md#when-each-surface-applies-the-plugin-keys)263* **Check which apps and session kinds apply the plugin keys**: [When each surface applies the plugin keys](https://code.claude.com/docs/en/plugins/org.md#when-each-surface-applies-the-plugin-keys)
264* **Set up CI and containers**: [Seed containers and CI](https://code.claude.com/docs/en/plugins/org.md#seed-containers-and-ci)264* **Set up CI and containers**: [Seed containers and CI](https://code.claude.com/docs/en/plugins/org.md#seed-containers-and-ci)
265* **Offer mods your users may install**: [Host a marketplace](https://code.claude.com/docs/en/plugins/host-marketplace.md). A mod that Claude Code copies from a GitHub, git, URL, or npm source counts as a user's unless you [install it as your organization's](#install-your-organizations-mods).265* **Offer mods your users may install**: [Host a marketplace](https://code.claude.com/docs/en/plugins/host-marketplace.md)
266 266
267### Set options on the built-in guard267### Set options on the built-in guard
268 268
333}333}
334```334```
335 335
336An installed plugin that meets neither set of conditions counts as a user's, even when managed `enabledPlugins` enables it. Its mod runs among users' mods, `prependPlugins` and `appendPlugins` skip it, `allowManagedModsOnly` refuses it, and `allowManagedHooksOnly` keeps it from loading. When managed settings enable it, the user's debug log has a line that starts with the plugin's id and `is enabled by managed settings, but`.336A plugin you enable in managed `enabledPlugins` can still count as a user's, as a directory plugin that misses a condition does. Its mod then runs among users' mods, `prependPlugins` and `appendPlugins` skip it, `allowManagedModsOnly` refuses it, and `allowManagedHooksOnly` keeps it from loading. To see why, search the user's debug log for a line that starts with the plugin's id and `is enabled by managed settings, but`.
337 337
338Claude Code fires an event each time it's about to act, such as run a tool, and passes it to each mod in turn. A mod that meets the directory conditions [runs before users' mods](https://code.claude.com/docs/en/plugins/mods/events.md#the-order-mods-run-in) even when you list it nowhere. To set its place, list its id in one of two settings. The id is the plugin's name, `@`, and the marketplace's name, such as `acme-guard@acme-tools`.338Claude Code fires an event each time it's about to act, such as run a tool, and passes it to each mod in turn. A mod that meets the directory conditions [runs before users' mods](https://code.claude.com/docs/en/plugins/mods/events.md#the-order-mods-run-in) even when you list it nowhere. To set its place, list its id in one of two settings. The id is the plugin's name, `@`, and the marketplace's name, such as `acme-guard@acme-tools`.
339 339