All posts

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

Why unrestricted AI agents are a risk How can you safely let Cursor’s AI coding agents query your Azure databases without exposing credentials or unchecked queries? In many teams the answer is to hand the agent a static service account that has broad database access. The account lives in a secret store, is copied into CI pipelines, and is sometimes embedded in application code for convenience. When the AI generates a query, it runs directly against the target database. If the model misinterpret

Free White Paper

Cursor / AI IDE Security + Vector Database Access Control: The Complete Guide

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

Free. No spam. Unsubscribe anytime.

Why unrestricted AI agents are a risk

How can you safely let Cursor’s AI coding agents query your Azure databases without exposing credentials or unchecked queries? In many teams the answer is to hand the agent a static service account that has broad database access. The account lives in a secret store, is copied into CI pipelines, and is sometimes embedded in application code for convenience. When the AI generates a query, it runs directly against the target database. If the model misinterprets a request, it can issue destructive statements, exfiltrate data, or bypass row‑level policies. Because the connection bypasses any audit layer, security teams have no visibility into what was asked, what was returned, or whether a human ever approved the operation.

What a minimal identity layer gives you

Introducing a non‑human identity, such as an OIDC‑backed service principal, is the first step toward control. The principal is scoped to the least‑privilege set of actions required for the AI to read schema information. This limits the blast radius compared with a full‑admin account. However, the request still travels straight from the AI client to the database engine. No inline guardrails inspect the payload, no session is recorded, and no data‑masking occurs on sensitive columns. The identity check alone does not provide the runtime enforcement needed for a secure database access workflow.

Putting a gateway in the data path

To close the gap, place a Layer 7 gateway between the AI agent and the database. The gateway terminates the client connection, applies policy checks, and then forwards only approved traffic to the backend. Because all traffic must pass through this single point, you can enforce command‑level approval, mask fields in result sets, and capture a full audit trail for every session. The gateway becomes the only place where enforcement can happen, while the identity system simply decides who may start a session.

How hoop.dev enforces database access controls

hoop.dev implements the gateway described above. When a Cursor agent authenticates via OIDC, hoop.dev validates the token, extracts group membership, and determines whether the request is allowed to proceed. Before any SQL reaches the Azure database, hoop.dev can:

  • Require a human approver for statements that match risky patterns, such as DROP TABLE or mass updates.
  • Mask columns that contain personally identifiable information, ensuring the AI never sees raw values.
  • Record the entire session, including the exact query string and the filtered response, so auditors can replay the interaction later.
  • Block commands that violate policy, preventing accidental data loss.

All of these outcomes exist only because hoop.dev sits in the data path. If you removed hoop.dev and left the identity check in place, the AI would again talk directly to the database, and none of the above protections would apply.

Continue reading? Get the full guide.

Cursor / AI IDE Security + Vector Database Access Control: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

Getting started

Deploy the hoop.dev gateway on a network segment that can reach your Azure database. The quick‑start uses Docker Compose, but Kubernetes and cloud‑native deployments are also documented. Register the Azure database as a connection, supply the service‑principal credentials that the gateway will use, and configure the masking and approval policies you need. The getting‑started guide walks you through each step, and the learn section explains how to fine‑tune masking rules and approval workflows.

Once the gateway is running, point Cursor’s AI client at the hoop.dev endpoint instead of the raw database host. The AI will continue to issue standard SQL, but every request will be inspected, approved, masked, and recorded automatically.

Explore the open‑source repository on GitHub to see the full implementation and contribute improvements: https://github.com/hoophq/hoop.

FAQ

Q: Does hoop.dev store my database credentials?
A: The gateway holds the credentials needed to talk to the backend, but they never leave the gateway process. Users and AI agents never see them.

Q: Can I use hoop.dev with other Azure services besides databases?
A: Yes. hoop.dev also fronts Kubernetes, SSH, and HTTP services, but the same pattern applies: a gateway in the data path enforces policy for each protocol.

Q: How does hoop.dev help with compliance audits?
A: Because hoop.dev records every session and the exact policy decisions made, you get a complete evidence trail that maps each query to an approving user or automated rule.

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