All posts

AI Agents

AI Coding Agent Governance: How to Secure Claude Code and Codex on Developer Laptops

AI coding agent governance: 8 controls to secure Claude Code and Codex on developer laptops

Misha10 min read
AI Coding Agent Governance: How to Secure Claude Code and Codex on Developer Laptops

Got a use case in mind?

8 weeks from use case to agents running in production.

Platform, people and FDEs, all in. Bring your environment. We'll co-build and stay until it's live.

Talk to Us

Free resource

101 AI Agents Use Cases

100+ production-ready AI agent use cases across Marketing, Sales, HR, Banking, Insurance, Operations and a lot more

Download now

TL;DR

  • AI coding agent governance decides what Claude Code and Codex may read, run and reach on a developer’s laptop, and proves what they did.
  • Both agents act with the developer’s own access to files, shell, keys and network, and untrusted repo content can steer them.
  • Lock settings centrally first with Claude Code managed settings and Codex requirements.toml.
  • Then add a strict sandbox, denied secret paths, approved MCP servers, a gateway, pull request gates and central logs.
  • Claude Security and Codex Security scan code; they don’t govern the agents.
  • Per-tool settings stop at the tool. One inventory, policy and audit trail across every coding agent needs a control plane above them.

Claude Code and Codex run with their developer’s own access. That puts SSH keys, cloud credentials, .env files and a shell within reach of an agent that also takes instructions from the repos and web pages it reads. Add personal accounts, unvetted MCP servers and approvals switched off, and nobody knows what an agent touched last week.

That’s the gap AI coding agent governance closes, and where AI agent security meets the laptop. Below are the controls Anthropic and OpenAI ship, how to set them and where they stop, through one security lead’s rollout to 400 engineers (a composite).What is AI coding agent governance?

Coding agents on developer laptops: what Claude Code and Codex can reach with a developer's access
AI Coding Agent Governance: How to Secure Claude Code and Codex on Developer Laptops 3

AI coding agent governance is the set of controls deciding what coding agents such as Claude Code and Codex can read, run and reach on a developer’s machine. It combines admin-enforced settings, sandboxing, scoped credentials, approved tools, review gates and central logs, so every action is allowed, attributable and auditable.

Why coding agents on developer laptops need governance

A coding agent can touch everything the developer can, and takes instructions from whatever it reads. The diagram below maps what it can reach.

  • It inherits the developer’s access. SSH keys, cloud CLI profiles, Git tokens and .env files are one command away.
  • It reads untrusted input that can carry prompt injection. In February 2026, Check Point Research showed a cloned repo’s config files could make Claude Code run commands and leak its API key before the user confirmed the trust prompt (since patched).
  • It extends itself through MCP servers, plugins and hooks, often from public registries.
  • Bypass modes switch the human off: --dangerously-skip-permissions in Claude Code, --yolo in Codex. In the s1ngularity attack (August 2025), a poisoned npm package ran developers’ AI CLIs with permission checks off to hunt for secrets.
  • The evidence lives on the laptop. Transcripts can be deleted, and logs show the developer, not the agent. Endpoint tools see a signed tool doing normal work.

Claude Security and Codex Security vs governing the agents

They’re different jobs. Claude Security and Codex Security scan code for vulnerabilities; governance controls what the agent may do on a laptop.

Claude Security and Codex Security compared with AI coding agent governance controls
AI Coding Agent Governance: How to Secure Claude Code and Codex on Developer Laptops 4

Claude Security, called Claude Code Security until its public beta on April 30, 2026, and OpenAI’s Codex Security, launched in research preview on March 6, 2026, validate findings and propose patches for human approval. OpenAI’s Codex security docs draw the same line, sending readers who want “the product for scanning connected GitHub repositories” elsewhere.

Neither decides whether an agent may read ~/.ssh or push to main. Use them in code review (step 7).

How to govern AI coding agents on developer laptops

Here are the eight controls, in rollout order:

1. Find every coding agent, including shadow installs

Pull inventory from MDM or EDR, IDE extensions, SSO logs and expense reports. Cursor, Copilot, Gemini CLI and MCP servers belong on the list, each with an owner; anything unlisted is shadow AI. In Claude Code, the managed forceLoginOrgUUID setting restricts claude.ai logins to your organization (Anthropic admin guide).

How many coding agents are running without an owner? Developers add Claude Code, Codex and MCP servers faster than any spreadsheet can track. Take the 29-question AI Agent Sprawl Audit to find your shadow agents and map your governance exposure. Take the audit:

2. Enforce admin policy developers can’t override

  • Claude Code: managed settings come from the claude.ai admin console (Team and Enterprise plans), a macOS plist, a Windows HKLM registry policy, or a system managed-settings.json file. Developers can add rules but can’t remove yours. Anthropic warns the Windows HKCU key is writable without admin rights, so don’t enforce through it. Confirm with /status.
  • Codex: requirements.toml holds constraints users can’t override. Deliver it as a system file (/etc/codex/requirements.toml, or %ProgramData%\OpenAI\Codex\requirements.toml on Windows), cloud-managed policy for ChatGPT Business and Enterprise, or macOS MDM. Cloud policy only reaches developers signed in to your workspace, so ship the file too.

3. Sandbox by default, with no silent fallback

Codex’s default local mode keeps writes in the workspace and network off. Claude Code’s sandbox adds OS-level isolation on macOS, Linux and WSL2 once enabled. Close the escape routes:

  • Claude Code: set sandbox.failIfUnavailable to true (otherwise a sandbox that can’t start lets commands run unsandboxed), allowUnsandboxedCommands to false to close the retry escape hatch, and disableBypassPermissionsMode to block bypass mode.
  • Codex: allow only read-only and workspace-write sandbox modes, and leave never out of allowed approval policies. That blocks danger-full-access and --yolo. OpenAI now recommends permission profiles through allowed_permission_profiles.

Use both layers: Anthropic notes that denying its fetch tool doesn’t stop curl in Bash; the sandbox’s network allowlist does.

Example Claude Code managed settings:

json

{
  "permissions": {
    "deny": ["Read(./.env)", "Read(./.env.*)", "Read(./secrets/**)", "Read(~/.ssh/**)", "Read(~/.aws/**)"],
    "disableBypassPermissionsMode": "disable"
  },
  "sandbox": {
    "enabled": true,
    "failIfUnavailable": true,
    "allowUnsandboxedCommands": false,
    "network": { "allowedDomains": ["github.com", "registry.npmjs.org"] }
  }
}

Example Codex requirements.toml:

toml

allowed_approval_policies = ["on-request"]
allowed_sandbox_modes = ["read-only", "workspace-write"]

Get the coding agent governance policy kit, with baseline Claude Code and Codex policy files, a 30-day rollout checklist and an exception register. Download the kit:

4. Keep secrets and production access off the laptop

Deny reads on secret paths, as above. Then remove what’s worth stealing: no standing production grants, short-lived tokens, and test data instead of production rows. Give agents their own credentials so logs can tell person from agent.

5. Approve MCP servers, plugins and hooks from a short list

Treat each as third-party code: pin versions, review updates. Claude Code offers allowedMcpServers, deniedMcpServers or a deployed managed-mcp.json, plus allowManagedHooksOnly and plugin marketplace restrictions. Codex enables an MCP server only when its name and identity match an approved entry, and can enforce managed hooks.

6. Route model traffic through a gateway

Point both agents at an internal AI gateway for approved models, per-team budgets, data loss checks and one identity-tied request log. Anthropic recommends a gateway for request-level audit logging. Then watch for calls that bypass it.

7. Gate every change with branches, PRs and CI

Agents open pull requests; protected branches block direct pushes. Review CI workflows, build scripts and infrastructure code more strictly, where an injected change does most damage. Claude Security or Codex Security fits here. Keep approval prompts on for destructive commands.

8. Log centrally and time-box exceptions

Local transcripts aren’t evidence. Send Claude Code’s OpenTelemetry export and gateway logs to your SIEM. Every exception needs a reason, an owner and an expiry date.

Claude Code vs Codex: governance controls side by side

Both ship enforced policy, sandboxing, bypass blocking and MCP controls. They differ in format, delivery and defaults.

ControlClaude CodeCodex
Policy users can’t overrideManaged settingsrequirements.toml
Cloud deliveryclaude.ai admin console (Team, Enterprise)Cloud-managed requirements (ChatGPT Business, Enterprise)
Device deliverymacOS plist, Windows HKLM registry, managed-settings.jsonSystem requirements.toml, macOS MDM
Local sandboxOS-level on macOS, Linux and WSL2; turn on with sandbox.enabledOn by default in workspace-write, network off
Block bypass modedisableBypassPermissionsModeLeave danger-full-access and never out of allowed lists
Stop unsandboxed fallbackfailIfUnavailable, allowUnsandboxedCommands: falseRestrict allowed sandbox modes and approval policies
Command rulesAllow, ask and deny rulesApproval policies and permission profiles
MCP controlAllow and deny lists, managed-mcp.jsonApproved MCP servers matched by name and identity

The gap sits between the tools.

Where per-tool settings stop

Every control above governs one tool, but real fleets run several. Our security lead now has two policy files, two consoles and two log formats. And:

  • There’s no single inventory across MDM, SSO and two vendor consoles.
  • Policy is written per vendor, and Cursor, Copilot or Gemini CLI bring their own settings, or none.
  • Agents still act as the developer in every log.
  • Evidence and spend are split across each tool’s telemetry and dashboard.
  • Laptop rules differ from production, where cloud agents need the same rules.

What’s missing is one layer above the tools that knows every coding agent and applies one policy to all.

How Lyzr Opencontroller governs coding agents across tools

Lyzr Opencontroller is an AI agent control plane that sits above each tool’s settings rather than replacing them. Asked whether it covers coding agents, Lyzr’s answer is “Yes, with Basecode.” Per the architecture page, Basecode extends visibility and policy to Claude Code, Codex, GitHub Copilot, Gemini CLI and MCP tools on Windows, macOS and Linux, then carries that control model into CI and production.

How it closes each gap, per the Lyzr control plane page:

The gapHow Opencontroller closes it
No single inventoryRead-only scans across clouds, clusters and developer laptops surface shadow agents and build one live inventory
Policy written per vendorBasecode applies usage, policy, tool access, spend and approved-stack controls to coding agents and MCP tools
Agents act as the developerEach agent gets an owner and its own identity, so it can do only what its identity and policy allow
Evidence and spend are splitPolicy applies before a call lands. OpenTelemetry traces carry cost, quality and owner on every span, and spend is tracked by agent, version and team
Laptop rules differ from productionOne control model from the laptop to CI and production

It runs inside your boundary: your cloud account, private infrastructure, on-prem or air-gapped. Customer-managed deployments don’t require credentials or telemetry to reach Lyzr, and standard interfaces (OpenAI-compatible APIs, MCP, OpenTelemetry, SAML, OIDC, SCIM) keep your identity provider and SIEM in place.

For our security lead, the personal installs and unapproved MCP servers land in one owned inventory under one policy. When an agent routed through Opencontroller calls an unapproved model or tool, the call is refused before it lands, and the trace sits in her SIEM.

Book a demo to see which coding agents Opencontroller finds on your developer fleet.

For starters, run /status in Claude Code on one laptop and check Codex for a requirements.toml or cloud policy. If neither exists, every rule you think you have is a suggestion. Pilot steps 1 to 3.

Frequently asked questions

AI coding agent governance starts with an inventory and admin policy developers can’t override: Claude Code managed settings and Codex requirements.toml. Add a strict sandbox, denied secret paths, approved MCP servers, a gateway, pull request gates and central logs.

Yes, with controls. A local agent acts with the developer’s access, so keep production credentials off the machine, sandbox the agent, block bypass modes and allow only approved MCP servers.

Deliver policy centrally: Claude Code managed settings and Codex requirements.toml, through cloud policy, MDM or a system file. Restrict logins to your organization, turn on the sandbox and verify on one machine first.

No. Claude Security and Codex Security are AI vulnerability scanners that review repositories and propose fixes. Governance controls what Claude Code or Codex may read, run and reach on a laptop. You need both.

In Claude Code, add managed permissions.deny rules for .env, ~/.ssh and cloud CLI folders, and turn on the sandbox so shell commands can’t bypass them. In Codex, allow only workspace-write or read-only. Better still, keep secrets off laptops.

Not when delivered correctly. Claude Code managed settings outrank user and project settings, and developers can add rules but not remove managed ones. Codex requirements are admin-enforced and outrank user settings. Avoid user-writable paths such as the Windows HKCU key.

Any agent that can edit code or run commands: Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline and Aider, plus their MCP servers. Check MDM, IDE extensions, SSO logs and expense reports.

Book A Demo: Click Here
Join our Slack: Click Here
Link to our GitHub: Click Here

Got a use case in mind?

8 weeks from use case to agents running in production.

Platform, people and FDEs, all in. Bring your environment. We'll co-build and stay until it's live.

Talk to Us

Free resource

101 AI Agents Use Cases

100+ production-ready AI agent use cases across Marketing, Sales, HR, Banking, Insurance, Operations and a lot more

Download now

Continue reading

You might also like

Build with Lyzr

Try it in Agent Studio

From framework-agnostic design to production-grade agents, deployed in under 24 hours.