Skip to content

Security Standards and Compliance

Your SOC 2 Type II audit is in three weeks. The auditor wants evidence that AI-generated code is reviewed before it ships, that no customer PHI leaks to a model provider, and that the MCP servers your team installed last sprint aren’t quietly exfiltrating files. Meanwhile your developers are merging Cursor- and Claude-Code-authored PRs at three times last year’s pace. The controls have to keep up without becoming the bottleneck everyone routes around.

This article shows the concrete pieces that make AI-assisted development auditable: turning on the audit/telemetry surfaces these tools actually ship, scanning MCP servers for the supply-chain risks that plague them, and enforcing review and policy gates in CI so compliance is a passing check, not a quarterly fire drill.

  • The real audit and telemetry configuration for Cursor, Claude Code, and Codex — no invented settings keys
  • A working MCP supply-chain scan using Snyk Agent Scan (formerly Invariant MCP-Scan) wired into all three tools
  • A copy-paste prompt that produces a runnable Semgrep ruleset for OWASP findings on a concrete stack
  • An Open Policy Agent (Rego) gate that blocks unreviewed AI-generated database migrations in CI
  • A failure-modes section covering the gotchas auditors and red teams actually find

Where AI Tooling Touches Your Compliance Boundary

Section titled “Where AI Tooling Touches Your Compliance Boundary”

Three surfaces matter for an audit:

  • Data egress. Your prompts contain source code and sometimes secrets. For SOC 2 confidentiality and HIPAA, you need a documented zero-retention posture with each vendor. Cursor’s Privacy Mode and Enterprise plan guarantee zero data retention (see trust.cursor.com); Anthropic and OpenAI offer the same for API and enterprise tiers. Document which mode each tool runs in — that document is the control evidence.
  • Audit trail. You need to show who ran what. Each tool exposes a different mechanism (below). None of them has a magic audit_logging: true flag — the real surfaces are OpenTelemetry, shell-command wrapping, and platform admin logs.
  • Supply chain. MCP servers run with your tools’ privileges. In Equixly’s 2025 assessment of popular open-source MCP server implementations, 43% contained command-injection flaws, 30% allowed unrestricted URL fetches, and 22% leaked files outside their intended directories. Treat every MCP server like an unvetted dependency.

This is the part most teams get wrong by pasting in config keys that don’t exist. Here is what each tool actually supports.

Claude Code has no audit_logging setting. Observability is OpenTelemetry, and command-level auditing is a shell prefix. Enable both in ~/.claude/settings.json (managed settings on a controlled host for enterprise):

{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_LOGS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://otel-collector.internal:4317",
"CLAUDE_CODE_SHELL_PREFIX": "/usr/local/bin/audit-logger.sh"
}
}

CLAUDE_CODE_ENABLE_TELEMETRY=1 streams metrics and logs to your collector (then to your SIEM); CLAUDE_CODE_SHELL_PREFIX wraps every Bash command so audit-logger.sh <command> records it. That command log is your SOC 2 access/activity evidence.

Scanning MCP Servers Before You Trust Them

Section titled “Scanning MCP Servers Before You Trust Them”

Before any MCP server reaches a developer’s machine, scan it. The tool to use is Snyk Agent Scan (the former Invariant Labs MCP-Scan, now maintained by Snyk). It runs through uvx — it’s a Python tool, so do not npm install it.

  1. Scan a candidate server’s config (or your whole mcp.json) for tool-poisoning, prompt-injection, and toxic-flow patterns:

    Terminal window
    uvx snyk-agent-scan@latest ~/.cursor/mcp.json

    The legacy entrypoint uvx mcp-scan@latest still works — it’s now a redirect that installs snyk-agent-scan and forwards the CLI.

  2. Read the findings. A flagged server might show an unrestricted fetch tool that accepts arbitrary URLs, or a tool description containing hidden instructions (a tool-poisoning attack). Don’t install it until that’s resolved.

  3. Register the scanner itself as an MCP server so the agent can re-scan on demand:

Terminal window
claude mcp add security-analyzer -- uvx snyk-agent-scan
claude mcp list

Generating Real Scanning Rules, Not Documents

Section titled “Generating Real Scanning Rules, Not Documents”

The point of AI here is shippable artifacts — a ruleset, a fix, a policy file — not a Word doc describing one. Anchor prompts to a concrete stack so the output is runnable.

Run the same prompt across tools — the workflow is identical; only the entry point differs. In Cursor, open the diff and invoke Agent mode on it. In Claude Code, run claude -p "<prompt>" on the branch so it reads the working tree, or wire it into a hook. With Codex, hand it the PR via the GitHub integration or codex exec in CI. Pin the model: for the highest-stakes security reviews, Claude Fable 5 (/model fable) delivers the strongest analysis — it outperforms Opus 4.8 on complex multi-file review and long-running tasks; Opus 4.8 is the right default when budget matters; GPT-5.5 powers Codex across surfaces. See model comparison for the full tier breakdown.

Audit evidence is strongest when it’s automatic. The highest-leverage gate for AI-assisted teams is blocking unreviewed schema changes — the migrations an agent generates are exactly where a confused-deputy mistake becomes a data-exposure incident.

Wire the result into .github/workflows/ so the migration gate and the Semgrep scan run on every PR. The job’s pass/fail history becomes your continuous-compliance evidence — point the auditor at the Actions log instead of assembling a spreadsheet by hand. For dependency CVEs and license checks, add a Snyk or npm audit --audit-level=high step in the same workflow rather than relying on a once-a-quarter manual scan.

  • “Telemetry is on but the SIEM is empty.” CLAUDE_CODE_ENABLE_TELEMETRY=1 must be set before the OTEL exporter variables take effect, and the collector endpoint must be reachable from the developer’s host. Test with a local collector first; a blocked egress firewall silently drops the data.
  • uvx snyk-agent-scan reports nothing on a server you suspect. Static scans miss runtime behavior. Pair the scan with the sandbox controls above (no network, no filesystem scope) and watch the server’s actual tool calls — a clean scan is necessary, not sufficient.
  • The Rego gate blocks legitimate hotfixes. Build the escape hatch into the policy itself (the MIGRATION-RISK: accepted by line), not an admin override. An override that bypasses the control is an audit finding; a documented, labeled exception is the control working.
  • Cursor “audit settings” don’t appear. They don’t exist at the user level. If you need per-developer audit, you need the Enterprise plan’s admin surface plus host-level command logging — there is no client-side JSON for it.
  • An agent leaks a secret into a prompt. This is a data-egress incident, not a code bug. Your .gitignore/secret-scanning deny rules (e.g. Claude Code’s deny permission for Read(./.env*)) prevent it at the source; treat any breach as reportable under your incident-response plan.