From Shadow AI Audit to Enforced Policy in Engineering Workflows Without Blocking Developer Velocity
A three-layer audit and a governed gateway let teams control AI use.

Shadow AI detection and governance in engineering require endpoint discovery, network inspection, and codebase scanning because unauthorized AI use spans all three. Teams first inventory agent connections, classify them by identity and access scope, then migrate compliant workflows to a governed control plane before tightening enforcement around the rest.
Why engineering teams are the shadow AI problem, not the shadow AI solution
Deployment moved faster than governance, and engineering embedded the gap in production. Developers can call OpenAI, Anthropic, Cohere, or self-hosted endpoints directly from application code without security or architecture review. Separately, MCP servers expose internal databases, filesystems, ticketing systems, observability tools, and APIs to agents. These connections are infrastructure. An audit that looks only at employee web use misses the AI access paths that engineering teams ship.
The trust boundary compounds that visibility problem. A compromised or attacker-controlled MCP server can affect every agent connected to it, and there may be no central oversight. The official MCP 2026 roadmap names enterprise-managed authentication, audit trails, and gateway and proxy patterns as priorities. Governance is becoming part of the plans for the protocol’s infrastructure. It is not an optional dashboard attached after deployment.
A ban does not put those missing controls in place. Engineers can move to personal accounts and devices, where their activity is harder to see but just as risky. The durable alternative is sanctioned access through enterprise model licenses, internal LLM APIs with logging, and vetted MCP servers, followed by network and DNS deny rules for unsanctioned tools. The governed route must be at least as fast. Otherwise, security has built a detour and expressed surprise that people avoid it.
How do you find AI tools engineering teams are using without IT approval?
Discovery needs three layers because each exposes a different part of the system. Endpoint tools find local agents, models, and MCP servers. Network inspection detects remote connections, while codebase scanning surfaces undocumented LLM API call paths inside applications. No single tool sees all of them. An audit needs to bring these views together, since a vendor that covers one layer sees only part of the enterprise.
Netskope’s client finds local models, agents, and MCP servers on managed Windows and macOS endpoints. Microsoft made Defender’s local AI-agent discovery generally available on Oct. 29, 2026, with support for more than fifty local agents and MCP servers on those platforms. Sophos AI Defense became generally available on Oct. 13, 2026. CrowdStrike’s Falcon Guardian, generally available as of September 2026, names Claude Code, OpenAI Codex, GitHub Copilot, Microsoft 365 Copilot, OpenCode, and Cursor among its supported tools. Its AI Kill Switch operates at the Gateway, with endpoint termination forthcoming.
Cloudflare Gateway complements endpoint discovery by addressing the remote MCP detection layer through network selectors that include DLP-based body inspection. Codebase scanning then exposes application-level connections that neither an employee tool list nor a browser inventory adequately describes. The audit output should connect agents to MCP servers, credentials, and credential owners. A shared service account is a finding because “service account called database write tool” cannot identify which engineer authorized the action.
Turning inventory into a risk classification before writing a single policy rule
An inventory can guide enforcement once each connection has been checked for identity clarity, credential type, and tool scope. These axes distinguish legitimate workflows needing migration from connections needing remediation or a block pending review. Identity comes first because permission without an identifiable principal is difficult to govern. A connection might authenticate through the existing IdP as a named person, use a shared service account, or have no authentication at all.
Microsoft Entra Agent ID gives each registered agent its own identity, improving visibility and auditability through familiar Entra management experiences. Auth0’s “Auth for MCP” reached general availability on May 6, 2026. Okta’s open-source MCP server exposes scoped management APIs with least-privilege access enforced through scope-based tool loading. These address related but distinct governance needs. Agent registration establishes an identity, while scoped tool access limits what that identity can reach.
Credentials and permissions then set how much is exposed. Short-lived workload identity federation tokens differ materially from embedded long-lived API keys, and raw secrets can leak through prompts or logs. OAuth 2.0 Token Exchange, defined in RFC 8693, provides delegation and impersonation semantics that distinguish an agent’s identity from authority lent to it. Tool permissions need comparable precision. A GitHub integration can expose create_pull_request, merge_pull_request, and delete_repository, with a junior developer role permitted to invoke the first two but not the third.
Endpoint-level RBAC cannot express that distinction adequately. MCP authorization must operate within the toolkit, at the action level, rather than treating access to an integration as permission to do everything it offers. Classification should also anticipate contextual, intent-verified, boundary-constrained authorization instead of simply placing agents into legacy role buckets. The resulting tiers are operational. They identify connections ready to migrate, those needing credential remediation, and those to block pending review.
What the governed path looks like architecturally and why it must be a control plane, not a proxy
A protocol proxy forwards calls, but enterprise governance also requires identity federation, action-level authorization, runtime policy, and audit trails. Without a gateway, each pairing of an agent and a tool has its own credential path. With one, N agents connect to a gateway that manages access to M tools. This creates a common enforcement point.
The reference architecture has four connected layers. At the edge, the existing IdP, such as Okta or Entra ID, issues short-lived tokens. The MCP gateway validates them, applies policy, and maintains the tool registry, while a translation layer wraps legacy APIs, databases, gRPC services, and SaaS applications as MCP servers with declared schemas. An observability layer emits every tool call through OpenTelemetry.
Policy evaluation should remain separate from the gateway’s data path so policy changes do not require redeploying the proxy or leave hot paths waiting on slow policy engines. Identity must survive that separation. On-Behalf-Of token propagation preserves the named person’s authority through the call rather than substituting the gateway’s service account. Filtered tool discovery then returns only tools the agent is permitted to see, scoping the developer’s working surface without another configuration step for each workflow.
Where the gateway runs affects whether it feels like infrastructure or gets in the way. An in-process data-plane gateway has the lowest latency, and a sidecar comes close while giving it better isolation. Centralized gateways simplify governance but can become throughput bottlenecks. Federated instances by business unit or region, managed through centralized policy, address data residency without requiring one monolithic gateway.
Cloudflare combines AI Gateway, MCP Server Portals, and Cloudflare Gateway into a unified security plane for enterprises already using its edge. Snowflake launched Cortex AI Gateway with an explicit agentic-AI governance framing. Maxim AI’s open-source Bifrost combines LLM, MCP, and agent gateway capabilities, using virtual keys for hierarchical budgets, rate limits, and per-key tool allow-lists. It also supports air-gapped deployments and VPC isolation.
Runtime enforcement: catching what policy rules alone cannot
Permission to invoke a tool does not establish that its content is safe. A permitted call can contain prompt injection, leak data, or pass a manipulation to another agent. Runtime inspection checks calls and responses for injection, leakage, and abuse, including patterns that are visible only across several conversation turns.
Disclosed vulnerabilities make the risk concrete. Claude Code was found to exfiltrate data through DNS requests in CVE-2025-55284. Cursor IDE allowed arbitrary data exfiltration through Mermaid in CVE-2025-54132, while GitHub Copilot was vulnerable to remote code execution through prompt injection in CVE-2025-53773.
Semantic prompt injections can alter how later agents interpret earlier inputs, including control-flow hijacking across chained MCP systems. The NSA’s MCP guidance identifies robust observability as essential for investigating anomalies and enforcing policy, while naming evolving concerns around serialization, trust boundaries, and agent misuse. Credential isolation complements inspection. Secrets should be managed by reference, never exposed to end users or configuration files, so a compromised prompt cannot steal a credential it was never shown.
Making every tool call attributable: the audit trail as an operational requirement, not a compliance checkbox
Runtime findings need an attributable chain of events. A record of what happened is insufficient if it omits who authorized the action and which policy permitted it. Governance-capable infrastructure therefore needs immutable audit trails across the user, agent, MCP, and tool chain, with the IdP identity preserved throughout. Service-account substitution breaks that chain. It leaves investigators with an event but no named person behind the authority exercised.
Every allow or deny decision should name the rule that was applied. That lets an investigation reconstruct both the agent’s action and the system’s reason for permitting or rejecting it. Gateway events should feed the existing SIEM and observability workflow. OpenTelemetry export supports integration with tools including Datadog, Grafana, and existing collectors.
Attribution also has a lifecycle beyond individual calls. Agents need access reviews on the same cadence as human identities and automated deprovisioning when retired. Microsoft’s human-sponsor pattern ties responsibility for an agent’s identity and lifecycle to a person, helping prevent orphaned agents from accumulating permissions after a project ends. Sponsorship is not automatic cleanup, however. Manual decommissioning steps are still required to fully revoke permissions when a Blueprint is deleted.
The staged progression in practice: from first audit to enforced golden path without blocking developer flow
The work starts with discovery that endpoint security and engineering teams own together. Endpoint coverage can come from Netskope, Defender, Sophos AI Defense, or Falcon Guardian, combined with remote MCP network detection and codebase scanning. The deliverable is a connection inventory. Each entry needs the agent, connected MCP servers, credential type, and available identity attribution.
Identity and security teams assess identity clarity, credential type, and tool scope, assigning connections to ready-to-migrate, needs-remediation, or block-pending-review tiers. Teams need to make that distinction between GitHub actions at this stage, before they write gateway rules. This stage gives enforcement a specific target. It also separates a credential problem from a workflow that should not be permitted.
Provisioning then gives the platform team a clear task to carry out. Agents are registered in the IdP and get short-lived scoped credentials and action-level access through the gateway. OpenTelemetry connects tool calls to the existing observability stack. Compliant workflows move first. If their performance suffers, the in-process or sidecar data-plane architecture needs revisiting before enforcement expands.
Network and DNS deny rules should close unsanctioned routes only after sanctioned alternatives are up and running. Connections awaiting credential remediation trigger alerts rather than hard blocks until credentials are rotated. This sequencing narrows enforcement around unresolved connections instead of landing a broad restriction on working developers. The golden path proves its usefulness before becoming mandatory. Its purpose is sanctioned, fast, observable access.
Access reviews follow the human-identity cadence, retirement triggers automated deprovisioning, and endpoint discovery continues looking for new unmanaged connections. Those findings return to classification. Discovery remains part of the operating system for governance. As engineering deploys new agents, the governed path must keep learning what it needs to govern.


