Guide
How do I enforce one security policy across Claude Code, Cursor, Codex and Copilot?
Updated
Short answer
You can't do it with vendor settings alone. Each agent reads its own policy files, and some of its hooks fail open by default. Keep each vendor's managed settings as a floor. Then put the decision on whether a command, file edit or push may run in one check at the pre-execution hook on the developer machine, outside every vendor, pushed by your MDM and started in watch-only mode.
A policy written for Claude Code doesn't bind Cursor. A rule in Codex's config doesn't bind Copilot.
Anthropic says it plainly: managed settings "bind Claude Code only. A developer who calls the API from another tool isn't under them."
So you end up with four formats, four override orders and four ways to fail. Each one is written by the vendor whose agent it constrains.
What each agent's docs say#
All four have real controls, and you should use them. The table compares mechanisms, not vendors, and quotes only what each vendor's docs say.
| Agent | Native policy surface | What the docs say about failure or override |
|---|---|---|
| Claude Code | Managed settings and hooks | Managed settings "bind Claude Code only." A hook that fails "the action goes ahead," unless it's a hook whose failure blocks the action |
| Codex | Requirements and configuration defaults | Requirements are "admin-enforced constraints that users can't override." Defaults are settings "that users can override" |
| Cursor | Hooks | Any other exit code: "Hook failed, action proceeds (fail-open by default)" |
| GitHub Copilot | Hooks | Hooks run "custom shell commands at strategic points in an agent's workflow." Check the docs for which Copilot surfaces support them |
Sources are below. These docs change often, so check them before you rely on a cell.
Where one policy per vendor breaks#
Fail-open defaults. In Claude Code, a hook that exits with the wrong code or doesn't start is a non-blocking error, and the action goes ahead. Cursor's hooks docs say the same: fail-open by default. You can make a failed hook block. Somebody has to know to do it, in every agent.
Drift. Codex separates requirements from defaults. Put a setting in the wrong file and what you thought was locked is a suggestion the developer can override.
Local admin rights. A developer who is an administrator on their own laptop can usually edit files the MDM placed there. Plan for redeploys and for checking drift.
Releases. Vendor settings can change between agent releases. When one changes, your policy changes without a change ticket.
Decision rule#
- Use vendor managed settings for what only the agent can apply to itself, such as its own permission and sandbox modes.
- Put the decision on whether a command, file edit or push may run in one layer outside the vendors. It reads the same policy for every agent.
- Make every native enforcement hook block on failure where the agent supports it, so a crashed hook can't turn into a permission.
- Keep a sandbox and scoped credentials underneath. They bound reach; they don't judge intent. See sandboxing Claude Code and Codex.
One policy, one place to look#
Write the policy once, in a file you can review, version and diff. Roll it out with the MDM you already run. Then ask these questions each week:
- Which developers have the hook installed and live?
- Which settings differ from the baseline?
- Which actions did the policy stop or flag, across every agent?
If the answers come from four separate dashboards, you don't have one policy. You have four.
Where Harden fits#
Harden Agentic Integrity Foundation (AIF) runs on the developer laptop, outside the agent, at the agent's pre-execution hook. Every command, file edit and push is checked against the session's intent before it runs. Decisions are made locally, in about 28 ms, and nothing leaves the machine.
One policy covers Claude Code, Codex, Cursor and other agents that expose a hook; the current list is on the integrations page. It starts watch-only, it's pushed by your MDM, and if the check can't run, the action doesn't run. Every decision is recorded whatever agent made the call, and Records can be exported to a SIEM.
Honest limits: AIF is a layer, not a perimeter. It doesn't replace least privilege, scoped credentials or egress policy, and it doesn't contain a process that's already malicious. For the broader program, read how to govern coding agents in an enterprise.
The rollout order#
- Week 1: inventory which agents and versions are on laptops. Deploy vendor managed settings and make enforcement hooks block on failure.
- Week 2: push the cross-agent check by MDM in watch-only mode. Read the Records.
- After that: enforce on the actions you'd never approve, then widen.
A vendor's policy for its own agent grades its own homework. The policy that holds across agents sits outside all of them.
FAQ
Related questions
Can I just use Claude Code managed settings for every agent?
No. Anthropic's docs say managed settings bind Claude Code only. Cursor, Codex and Copilot read their own configuration, so each needs its own policy or a layer outside the vendors.
Do hooks fail open or closed by default?
In Claude Code and Cursor, a hook that crashes or exits with the wrong code lets the action proceed by default. Both document a way to make a failed hook block instead. Check the current setting in each vendor's docs and turn it on for every enforcement hook.
How do I deploy a coding agent policy to developer laptops?
Use the MDM you already run to place each vendor's managed configuration on the machine. A cross-agent check at the pre-execution hook is pushed the same way, so one rollout covers every agent.
Should the first rollout block anything?
No. Start watch-only so you can see what agents do across the fleet. Then enforce on the small set of actions you'd never approve, and widen from there.
Does a sandbox replace a cross-agent policy?
No. A sandbox bounds what an agent can reach, but it doesn't judge whether a given command fits the task. You want both: the sandbox for reach, and a pre-execution check for each action.