All posts

Putting access controls around Cursor: audit trails for AI coding agents (on Azure)

When an AI coding assistant can write, compile, and deploy code without a reliable record of what it did, a single stray command can introduce a vulnerability, leak credentials, or break compliance. Teams often discover the cost weeks later, when a security audit flags an unexpected configuration or a production outage traces back to a line of code generated by the agent. Why audit trails matter for Cursor on Azure Cursor, like other LLM‑driven coding agents, runs inside a developer’s Azure s

Free White Paper

AI Audit Trails + Cursor / AI IDE Security: The Complete Guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free. No spam. Unsubscribe anytime.

When an AI coding assistant can write, compile, and deploy code without a reliable record of what it did, a single stray command can introduce a vulnerability, leak credentials, or break compliance. Teams often discover the cost weeks later, when a security audit flags an unexpected configuration or a production outage traces back to a line of code generated by the agent.

Why audit trails matter for Cursor on Azure

Cursor, like other LLM‑driven coding agents, runs inside a developer’s Azure subscription and talks directly to resources such as Azure SQL, storage accounts, or Kubernetes clusters. Teams frequently grant the agent a service principal with broad permissions so it can fulfill requests instantly. That convenience creates two hidden problems:

  • Every action runs under a shared identity, making it impossible to attribute a change to a specific user or request.
  • Azure’s native logs capture only the fact that a connection occurred, not the exact commands or API calls the agent issued.

The result is a blind spot: you may know that Cursor accessed a database, but you cannot reconstruct which query created a new table, altered a secret, or triggered a deployment. In regulated environments, the lack of a fine‑grained audit trail can lead to non‑compliance findings, fines, and loss of stakeholder trust.

Current practice: shared credentials and no enforcement

In many organizations the default setup looks like this: a single Azure AD application is created, given Contributor rights on a resource group, and its client secret is stored in a CI/CD vault. Cursor is configured to use that secret, and developers invoke the agent from their IDEs. The connection travels straight from the IDE to Azure, bypassing any intermediate control point. Teams may add Azure Monitor or Activity Log alerts, but those logs only tell you that "a request was made" – they do not capture the exact code snippets or API payloads.

This arrangement fixes the immediate need for access, yet it leaves three critical gaps open:

  1. The request still reaches the target directly, so there is no place to enforce policy before the command runs.
  2. There is no per‑action audit trail that can be tied back to an individual developer or a specific request.
  3. Any accidental or malicious command runs unchecked, because there is no approval workflow or command‑level guardrail.

Those gaps define what a comprehensive audit‑trail strategy must address.

Introducing hoop.dev as the enforcement layer

hoop.dev provides the missing data‑path control point. It sits between the Cursor agent and Azure resources, acting as a Layer 7 gateway that proxies every request. Because hoop.dev is the only place the traffic flows, it can apply the controls needed for a complete audit‑trail solution.

hoop.dev records each session, capturing the full request and response payloads. It tags every recorded line with the identity that initiated the request, the time, and the target resource. This lets you answer questions such as "who created this table?" or "which user triggered the deployment that introduced the secret leak?" after the fact.

Continue reading? Get the full guide.

AI Audit Trails + Cursor / AI IDE Security: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

hoop.dev also enforces just‑in‑time (JIT) access. When a developer asks Cursor to perform a privileged operation, the gateway pauses the request, routes it to an approver, and forwards it only after approval is recorded. The approval itself becomes part of the immutable audit trail.

Because the gateway runs inside the customer’s network, hoop.dev’s agent stores the Azure credentials used to talk to the backend services. The Cursor agent never sees the secret, eliminating the risk of credential leakage through the AI model.

How the flow works for Cursor

1. A developer authenticates to Azure AD using OIDC. hoop.dev validates the token and extracts group membership. 2. The developer invokes Cursor. The AI agent sends its request to hoop.dev instead of directly to Azure. 3. hoop.dev checks the request against policy, optionally asks for human approval, records the full exchange, and then forwards the request to the target service. 4. The response travels back through hoop.dev, where it can be masked if it contains sensitive data, and the entire round‑trip stores for replay.

This pattern satisfies the three gaps identified earlier: the gateway is the enforcement point, every command logs with attribution, and risky actions gate behind an approval workflow.

Benefits of a gateway‑centric audit trail

  • Attribution: Every line of code generated by Cursor links to the user who triggered it, supporting forensic analysis and compliance reporting.
  • Policy enforcement: Commands that match risky patterns block or route for approval before they reach Azure.
  • Credential safety: The AI agent never handles the underlying Azure service principal, reducing the attack surface.
  • Replay capability: You can replay recorded sessions in a sandbox to verify that a change behaved as expected.
  • Consistent governance: Policies define once in hoop.dev and apply uniformly across all Cursor‑driven workloads.

Getting started

To add audit trails for Cursor in your Azure environment, start with the getting started guide. The guide walks you through deploying the gateway, configuring OIDC authentication, and registering an Azure resource as a proxied connection. Detailed policy examples appear in the learn section, where you can see how to define JIT approvals and command‑level blocking rules.

All configuration files, Helm charts, and Docker Compose examples are open source. Review the repository, contribute improvements, or raise issues on GitHub.

FAQ

Do I need to change my existing Azure service principals?
hoop.dev can use the same service principal that your applications already trust. The gateway stores the credential and presents it to Azure on behalf of the AI agent, so no changes to the underlying permissions are required.

Will hoop.dev add noticeable latency to Cursor’s responses?
Because hoop.dev operates at the protocol layer and runs close to the target resource, the added latency typically measures only a few milliseconds, far less than the network round‑trip time to Azure.

Can I retroactively analyze past Cursor activity?
hoop.dev records only the activity that passes through it. To capture historic actions, you would need to migrate those workloads to flow through the gateway.

Explore the source code and contribute on GitHub.

Open source

Save the open-source gateway for agent data access

Hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.

Star and save the repo →More posts