Securing Claude Code in Production: SSO, Audit Logs, and PII Guardrails for Engineering Teams
Securing Claude Code in production with SSO, immutable audit logs, and PII guardrails. The enterprise gateway pattern for SOC 2, GDPR, and HIPAA compliance.
Securing Claude Code in production has become one of the harder infrastructure problems facing platform and security teams in 2026. Claude Code reads files, executes shell commands, edits source code, and calls external tools, often against codebases that contain customer data, secrets, and regulated information. The default deployment, every developer with their own raw API key and no central control plane, fails every meaningful audit. Bifrost, the open-source AI gateway by Maxim AI, closes this gap by enforcing single sign-on, immutable audit logs, and PII guardrails at the gateway layer, so security controls apply uniformly to every Claude Code request without modifying the client.
This guide covers the three security pillars that matter for production Claude Code deployments, how Bifrost implements each, and the configuration patterns that map directly to SOC 2 Type II, GDPR, HIPAA, and the EU AI Act's high-risk system obligations.
Why Default Claude Code Deployments Fail Security Audits
Claude Code ships with no native concept of identity, audit trail, or content policy. Every developer authenticates with a raw ANTHROPIC_API_KEY issued by whoever provisioned it, and every request goes directly to the provider with no gateway in between. The pattern looks fine at five users and breaks at fifty. According to a Cloud Security Alliance survey, 82% of organizations discovered an AI agent or workflow in the past year that security or IT did not previously know about, and 65% had an AI agent security incident in the same period.
Three failure modes show up consistently in security reviews:
- No identity binding: Raw API keys are shared, copied to laptops, and persisted in shell history. There is no way to map a Claude Code request back to a specific employee.
- No audit trail: Provider-side logs cover billing, not who-did-what. SOC 2 Type II and HIPAA reviewers reject billing dashboards as evidence.
- No content controls: Claude Code happily reads files containing customer PII, payment data, or protected health information and forwards them to a third-party model. The leak surface is the entire codebase.
The fix is a gateway layer that enforces identity, captures evidence, and inspects content on every request. The Claude Code integration guide documents the deployment pattern, and the rest of this post breaks down the three pillars.
Pillar 1: SSO and RBAC for Claude Code Access
The first step in securing Claude Code is replacing shared API keys with identity-bound access. Bifrost integrates with OpenID Connect identity providers, including Okta and Microsoft Entra (Azure AD), so Claude Code users authenticate against the same SSO fabric as the rest of the enterprise stack. Group memberships and roles synchronize automatically on first login.
The configuration flow follows a clear pattern:
- OIDC SSO: Configure Okta, Keycloak, Zitadel, or Entra as the identity provider through the Bifrost dashboard. New users are provisioned automatically on first login.
- Three-tier role hierarchy: Bifrost ships with Admin, Developer, and Viewer roles mapped from identity provider claims. Custom roles can be defined for granular permissions.
- Team synchronization: Identity provider groups automatically create and sync teams, so engineering, security, and finance see the right scope of resources.
- Virtual keys per user: Each developer's Claude Code session uses a virtual key bound to their SSO identity, with independent budgets and rate limits.
For Claude Code specifically, this means the ANTHROPIC_API_KEY environment variable points at a virtual key, not a raw provider key. When an employee leaves, their virtual key is revoked in the dashboard and access stops immediately, no need to rotate provider credentials or chase down shared secrets. Role-based access control governs who can create virtual keys, modify budgets, view audit logs, and configure providers, which separates platform administrators from developers consuming Claude Code.
This pattern also addresses one of the more uncomfortable findings in the OWASP Top 10 for LLM Applications: unmanaged credentials propagate faster than they can be rotated. Identity-bound virtual keys close that loop.
Pillar 2: Immutable Audit Logs for SOC 2 Type II, GDPR, and HIPAA
Audit logs are where most Claude Code deployments collapse under compliance scrutiny. Provider-side logs report total tokens consumed and costs incurred, but they do not answer the questions auditors actually ask: which user invoked which model with which prompt, when, from which IP, and what was the response. Bifrost captures all of this at the gateway, with full request metadata, and exports it to long-term storage for evidence retention.
Every Claude Code request through Bifrost is logged with:
- Identity: Virtual key, SSO user, team, customer attribution.
- Request details: Provider, model, parameters, message contents, tool calls, timestamps.
- Response details: Token counts, latency, finish reason, cost, full response payload.
- Policy outcomes: Guardrail decisions (block, redact, allow), routing decisions, fallback events.
Logs are immutable, designed for SOC 2 Type II, GDPR, ISO 27001, and HIPAA evidence requirements. They export to external SIEM systems, data lakes, and compliance archives through automated log exports, so security teams can retain multi-year trails without keeping the data inside the gateway. Native OpenTelemetry integration sends traces and metrics to BigQuery, Datadog, Grafana, New Relic, or Honeycomb without custom instrumentation, so the same gateway that enforces governance produces the telemetry compliance teams need.
The compliance timing matters. The EU AI Act's high-risk system obligations become legally enforceable in August 2026, requiring conformity assessments, technical documentation, risk management, and human oversight. Claude Code deployments that fall under high-risk categories (employment decisions, credit scoring, critical infrastructure) need audit evidence that can survive a regulator review, not internal dashboards.
Pillar 3: PII Guardrails at the Gateway Layer
The hardest security problem with Claude Code is not authentication or auditing. It is content. Developers routinely paste log snippets, customer records, internal documents, and configuration files into Claude Code sessions to debug issues or generate code. Without input validation, that content reaches the provider unfiltered. Without output validation, generated responses can include hallucinated PII, leak training data fragments, or surface protected information from the prompt context.
Bifrost embeds enterprise guardrails directly into the request and response pipeline, with zero additional network hops. Policies are defined once at the gateway and applied to every Claude Code request across every provider. Multi-provider integration covers four guardrail backends:
- AWS Bedrock Guardrails: PII detection and redaction for 50+ entity types (SSNs, credit cards, medical records, addresses), content filtering, prompt attack prevention.
- Azure AI Content Safety: Severity-based moderation, Prompt Shield for jailbreak detection, indirect prompt injection defense.
- Patronus AI: Hallucination detection, toxicity screening, customizable policies for high-stakes applications.
- GraySwan Cygnal: AI safety monitoring with natural-language rule definitions and mutation detection.
Bifrost separates guardrails into profiles (provider configurations) and rules (CEL-based policies that decide when and how to apply them). This separation means a single AWS Bedrock PII profile can be reused across many rules with different conditions, scoped per virtual key. A typical Claude Code policy looks like this: apply Bedrock PII detection on input for all developer virtual keys, apply Azure jailbreak shield on input for production support keys, apply Patronus hallucination detection on output for any session touching customer-facing code.
When a violation triggers, Bifrost returns a structured response with the violation type, severity, and action taken (block, redact, or warn). A blocked Claude Code request never reaches the provider, which means the data never crosses the trust boundary. This is the architectural difference between application-layer guardrails (which run after the data has already been forwarded) and gateway-layer guardrails (which sit on the wire).
Putting the Three Pillars Together
A production Claude Code deployment that passes a security review combines all three pillars in a single configuration pass. The full pattern, documented in the LLM Gateway Buyer's Guide, follows four steps:
- Deploy Bifrost in-VPC: Run the gateway on Kubernetes, ECS, or bare metal inside the production network. In-VPC deployment ensures Claude Code traffic, prompts, and responses never leave the controlled environment.
- Configure SSO and RBAC: Connect Okta or Entra, sync groups, assign roles, and issue per-developer virtual keys.
- Define guardrail rules: Configure AWS Bedrock or Azure profiles, write CEL rules covering PII detection on input and output validation on response, scope per virtual key.
- Enable audit log exports: Stream logs to SIEM and data lake destinations on a continuous schedule for evidence retention.
For regulated workloads, vault integration with HashiCorp Vault, AWS Secrets Manager, Google Secret Manager, or Azure Key Vault keeps provider credentials out of the gateway's storage entirely. Clustering provides high availability for production Claude Code traffic with zero-downtime deployments.
The combined effect is a Claude Code deployment where every request is authenticated, every action is logged, every input is inspected, and every output is validated. Bifrost adds only 11 microseconds of overhead per request at sustained 5,000 RPS, so security does not become a latency tax on developer workflows.
Start Securing Claude Code with Bifrost
Securing Claude Code in production is an infrastructure problem, not an application problem. Identity, audit, and content controls have to live at the gateway layer to apply consistently across every developer, every provider, and every session. Bifrost provides all three in a single open-source, Apache 2.0 platform with enterprise extensions for VPC deployment, vault integration, and compliance-grade logging.
To see how Bifrost can secure Claude Code across your engineering organization with full SSO, audit logs, and PII guardrails, book a Bifrost demo and walk through the deployment with the Bifrost team.