How can you safely let an AI coding agent like Devin query production databases on Azure without exposing credentials or creating audit blind spots?
Ensuring proper database access for an AI agent requires more than a shared secret.
Today many teams hand an LLM‑powered assistant the same static username and password that engineers use for a PostgreSQL instance. The agent runs inside a CI job, a notebook, or a serverless function and talks directly to the database over the internet. No token exchange, no per‑request approval, and no record of which query was generated. The result is a shared secret that lives in source control, a permanent back‑door that can be reused by anyone who discovers the string, and no visibility into what data the model actually read or wrote.
This arrangement satisfies the immediate need to give Devin the ability to fetch schema information or sample rows, but it leaves three critical gaps. First, the request reaches the database without any gateway that could enforce policy. Second, there is no just‑in‑time approval step that would let a human confirm a risky query before it runs. Third, the system does not retain a replayable session, so auditors cannot later verify that the AI behaved within the organization’s risk tolerance.
What you really need is a way to grant Devin database access that is scoped to the exact operation, recorded for later review, and capable of masking sensitive columns on the fly. The precondition is that the AI agent authenticates with a non‑human identity that carries only the permissions required for the task, yet the request still travels straight to the database engine with no intervening control point. In that state, you have the right intent but the enforcement surface is missing.
Why the data path must host the controls
Any enforcement that lives outside the traffic flow can be bypassed by re‑routing the connection or by compromising the client. The only place you can guarantee that every byte of a query and its response is inspected is the layer that actually carries the protocol between the identity and the backend. That layer becomes the enforcement boundary.
Database access controls enforced by hoop.dev
hoop.dev sits in the data path and acts as an identity‑aware proxy for database connections. It receives a request from Devin, validates the OIDC token that represents the AI service account, and then forwards the query to the target Azure‑hosted database. Because the gateway holds the credential, the agent never sees the password or certificate.
Setup: identity and least‑privilege grants
The first step is to register a service account for Devin in your corporate IdP (Azure AD, Okta, etc.). The account receives a short‑lived OIDC token that encodes the groups or roles that define the maximum allowed database scope. hoop.dev verifies that token, extracts the claims, and maps them to a connection profile that contains only the permissions needed for the current job. This setup decides who the request is and whether it may start, but on its own does not enforce any runtime policy.
The data path: the gateway enforces policy
When the request reaches hoop.dev, the gateway parses the PostgreSQL wire protocol, inspects each statement, and applies the configured guardrails. Because the gateway is the only component that can see the clear‑text query, it is the sole place where blocking, approval, or transformation can occur.
Enforcement outcomes delivered by hoop.dev
- hoop.dev masks sensitive fields such as credit‑card numbers or personally identifiable information before the result is sent back to Devin.
- hoop.dev routes high‑risk statements (for example, DROP TABLE or mass UPDATE) to a human approver, pausing execution until an authorized reviewer approves the operation.
- hoop.dev records every session, capturing the exact query text, timestamps, and the identity that issued it, so you can replay the interaction for forensic analysis.
- hoop.dev enforces just‑in‑time access by granting the temporary credential only for the duration of the approved session, after which the connection is terminated.
All of these outcomes exist because hoop.dev sits in the data path; without that placement the AI agent would either execute the command unchecked or the organization would have to build a custom proxy that replicates the same guarantees.
Benefits for AI‑driven development on Azure
With hoop.dev protecting database access, you can let Devin generate code snippets, suggest schema migrations, or validate data quality without ever exposing a long‑lived secret. The gateway’s inline masking ensures that even if the model tries to exfiltrate protected columns, the data is redacted before it leaves the database. The just‑in‑time approval workflow adds a human safety net for destructive operations, reducing the blast radius of an accidental or malicious query. Finally, the session log can be used as evidence for internal compliance reviews and external audits.
Getting started
To try this architecture, follow the Getting started guide for a quick Docker Compose deployment, then configure a service account for Devin in your IdP. The feature documentation walks you through setting up masking rules, approval policies, and session storage.
Get started by visiting the GitHub repository.
FAQ
Can hoop.dev protect other protocols besides PostgreSQL?
Yes. The gateway supports MySQL, MSSQL, MongoDB, and several other wire‑level protocols, all with the same policy engine.
Does using hoop.dev add latency to database queries?
The additional hop introduces a small amount of round‑trip time, but because the gateway runs close to the database (often in the same VNet), the impact is typically negligible compared to the security benefits.
How does hoop.dev handle credential rotation?
hoop.dev stores the target credentials internally and can be reloaded without downtime. When you rotate a database password, you update the connection profile in the gateway, and all new sessions automatically pick up the new secret.