All posts

    Agent security

    How to Secure AI Coding Agents Across Claude Code, Codex, and Cursor

    Use one enterprise policy for the outcomes you need, then verify it separately in Claude Code, Codex and Cursor.

    Minimal Harden editorial diagram: AGENTS, POLICY, EVIDENCE. Headline: One Policy Across Agents. Supporting text: Claude Code, Codex and Cursor.

    Executive summary

    Use one enterprise policy for the outcomes you need, then verify it separately in Claude Code, Codex and Cursor. Their execution paths and configuration models differ. A setting that constrains one agent should not be assumed to apply to another. Standardize task scope, sensitive access, approved tools and evidence, while testing the native and additional controls on each supported integration.

    Standardize the outcome before the setting

    Begin with plain policy statements. A staging task must not change production. Sensitive data must not go to an unapproved destination. New executable tools and changes to security-relevant configuration require the organization's review process.

    Those outcomes should remain consistent across agents. Their implementation may involve different permissions, sandbox settings, connector controls and pre-execution integrations.

    Record the agent version, execution environment and configuration used in each test. Product defaults and available modes can change; this guide is based on official documentation reviewed on 17 November 2026, not a guarantee about every installed version.

    Verify Claude Code's permission and isolation controls

    Claude Code's security documentation describes a permission-based architecture and protections relevant to working with untrusted material. Its permission documentation explains how rules and modes affect operations.

    Review the permissions used by the actual workflow, including shell execution and connected tools. Examine the relationship between permissions and sandboxing rather than treating them as two names for the same control.

    Confirm which settings are organization-managed and which a developer can change. Avoid copying an example configuration into production without checking the current documentation and its effect on legitimate work.

    Verify Codex in its actual execution environment

    Codex's sandbox and approval guidance distinguishes execution boundaries, approvals and network access. Review the configuration for the environment in use rather than assuming desktop, CLI, IDE and hosted workflows are equivalent.

    Identify the files, credentials and network destinations available to the task. Check what happens when an operation needs authority beyond the configured boundary and whether the enterprise's policy is preserved during that transition.

    An approval for one operation should not be interpreted as authorization for every later effect. Preserve the task boundary and review how the chosen environment records consequential decisions.

    Verify Cursor's tools, execution modes and connectors

    Cursor's agent-security documentation explains its first-party tools, third-party tool connections, network requests and workspace-trust considerations. It also distinguishes best-effort guardrails from a hard security boundary.

    Review terminal execution and MCP behavior in the current configuration. Consider how repository changes can affect execution, including workflows where files are used by an automatically reloading process.

    Do not assume the IDE's familiar interface makes every repository, extension or connector trusted. The enterprise still needs an owned process for reviewing changes that can widen access or run code.

    Use one verification matrix across all three

    The following matrix is a test design, not a report that these products have passed the cases.

    Policy outcome

    Evidence to collect for each agent

    Stay within the approved environment

    Task, active identity, resolved target and observed effect

    Keep sensitive information within approved destinations

    Synthetic data source, recipient, tool arguments and outcome

    Review new tools and executable configuration

    Connector/configuration change, approval authority and effective permissions

    Preserve consequential-action boundaries

    Pending operation, relevant control and actual execution result

    Make decisions investigable

    Record location, access rules and sufficient context to explain the result

    Run legitimate cases beside prohibited variations in disposable environments. An intervention that stops the unsafe case but also prevents ordinary work needs investigation before rollout.

    Add shared checks without assuming identical coverage

    An enterprise may add a common pre-execution control across supported coding-agent paths. With Harden, we provide native integrations and an MCP proxy approach for supported workflows, along with allow, redact and block outcomes.

    Verify the specific agent, integration and tool classes in the pilot. Do not assume a common product policy means every agent exposes the same context or supports the same intervention on every route.

    Keep native agent approvals separate from Harden's action outcomes. Also distinguish recording a decision from preventing an operation; both may matter, but they answer different questions.

    Recheck after the next meaningful change

    Keep a configuration record that survives an agent switch

    For each workflow, save the agent and version, where execution occurs, the managed settings, relevant identities and approved tool connections. Add the policy outcome the team expects and the evidence supporting it. A screenshot of a setting can help explain a review, but it should not replace a record of the effective configuration and observed operation.

    Suppose a developer moves an investigation from one agent to another. Preserve the authorized task and access limits, then identify the second agent's execution path. Check which tools are available and how credentials are supplied. Do not treat a previous approval in the first environment as proof that a new connector or consequential operation is authorized in the second.

    The same discipline applies when an IDE workflow moves to a terminal or hosted task. Review the environment actually executing the command and any path through which information can leave it. A shared repository does not establish that those environments have identical permissions or network boundaries.

    Give the workflow record an owner and update trigger. When a relevant setting changes, preserve the previous result and recheck the affected policy outcome. The useful enterprise standard is consistent intent with verified implementation, rather than identical setting names across three products. Keep any shared Harden policy beside the per-agent supported-path evidence so the difference remains visible.

    Repeat relevant cases when an agent version, connector, permission mode, managed policy or environment changes. Preserve the previous configuration and result so the team can see whether coverage changed.

    If the same action can occur through an uncovered route, decide whether to constrain that route, add a control or accept a documented exception with an owner and expiry. Do not hide the difference behind a single “protected” status.

    Teams evaluating a shared action-control layer can start a Harden evaluation with the three agent paths they actually use. The useful result is a verified policy-to-path map, not a promise that one setting secures every agent.

    FAQs

    Can Claude Code, Codex and Cursor use the same policy?

    They can be governed by common organizational outcomes, such as staying within an approved environment. Verify the implementation separately for each configured workflow. Permissions, tools, integration context and execution environments differ. A shared policy document is useful, but it does not demonstrate that every agent enforces each outcome in the same way.

    Does choosing an approval mode replace sandboxing?

    Treat approvals and execution boundaries as separate questions in the current product documentation. Identify which operation receives authorization and what the executing environment can affect. Verify both for the workflow in use, rather than assuming a familiar mode name establishes the same file, process or network constraints across agents.

    Are all MCP connections covered by the same control?

    Do not assume so. Identify the server, credentials, tools and route used by each connection. Check whether a native integration, proxy or another mechanism observes the relevant call. A shared protocol name does not establish identical context or enforcement on every configured path. Record the route that was actually verified.

    What should be rechecked after an agent update?

    Review changes affecting permissions, tools, connectors, managed settings and integration behavior. Repeat the cases tied to those changes and inspect the actual outcomes. Preserve version and configuration details so an unexpected difference can be investigated. Update the coverage record rather than carrying forward an old protected status without evidence.

    How should an enterprise evaluate Harden across these agents?

    Choose the same policy outcome and a supported workflow for each agent, while documenting implementation differences. Compare the proposed action, available context, decision and observed effect. Keep native approvals distinct from Harden outcomes, then record limitations per path. Expand only when the team's evidence supports the intended operating scope.