All posts

Putting access controls around Devin: database access for AI coding agents (on Postgres)

Giving an AI coding agent unfettered database access on a production Postgres instance is a recipe for data leaks and operational chaos. Why database access for AI agents needs tighter control In many teams the quickest way to let an assistant like Devin run queries is to drop a static username and password into a configuration file, grant that credential super‑user rights, and let the agent connect directly. The connection bypasses any human review, leaves no trace of who asked for which que

Free White Paper

AI Model Access Control + Vector Database Access Control: The Complete Guide

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

Free. No spam. Unsubscribe anytime.

Giving an AI coding agent unfettered database access on a production Postgres instance is a recipe for data leaks and operational chaos.

Why database access for AI agents needs tighter control

In many teams the quickest way to let an assistant like Devin run queries is to drop a static username and password into a configuration file, grant that credential super‑user rights, and let the agent connect directly. The connection bypasses any human review, leaves no trace of who asked for which query, and provides no way to hide sensitive columns such as credit‑card numbers or personal identifiers.

Common mistakes to avoid

Even when teams adopt a service‑account model and use OIDC tokens to identify the agent, the request still travels straight to the database engine. That approach fixes the identity problem – the system now knows who is making the request – but it leaves the data path completely open. Without a gateway, there is no place to enforce query‑level policies, no inline masking of result sets, and no opportunity to pause a destructive command for human approval.

How hoop.dev enforces database access policies for Devin

hoop.dev acts as a Layer 7 gateway that sits between the AI agent and the Postgres endpoint. After the agent presents an OIDC token, hoop.dev validates the token, extracts group membership, and then proxies the connection on behalf of the agent. Because the proxy is the only point where traffic passes, hoop.dev can apply the required guardrails before any statement reaches the database.

Enforcement outcomes provided by hoop.dev:

  • Every session is recorded, providing a replay that auditors can inspect.
  • Result sets are scanned in real time; columns that match a masking policy are redacted before they reach the agent.
  • Statements that match a risk pattern – for example drop database or bulk deletes – trigger a just‑in‑time approval workflow, halting execution until a human reviewer signs off.
  • Commands that violate a deny‑list are blocked outright, preventing accidental or malicious data destruction.

These outcomes exist only because hoop.dev occupies the data path; the underlying identity setup alone cannot provide them.

Designing a policy bundle for Devin

Start by defining the data domains that Devin is allowed to read. A typical policy might grant read‑only access to the analytics schema while denying any write privileges on production tables. Next, list the columns that contain personally identifiable information and mark them for inline masking. Finally, create a risk rule set that flags any statement containing keywords such as delete, truncate, or alter, routing those queries to an approval queue.

Continue reading? Get the full guide.

AI Model Access Control + Vector Database Access Control: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

Because policies are evaluated at the protocol layer, they apply uniformly regardless of the client library or language the agent uses. This eliminates the need to embed security checks in the application code, reducing the attack surface and simplifying maintenance.

Monitoring and incident response

hoop.dev’s session recordings give you a complete forensic trail. When a suspicious query is flagged, you can replay the exact interaction, see the raw SQL, the masked response, and the identity of the requesting agent. Integrate the audit stream with your existing SIEM or log‑aggregation platform to generate alerts on repeated denial events or unusual access patterns.

Scaling the solution across multiple clusters

Deploy the gateway close to each Postgres cluster – for example as a Docker Compose service on the same network segment or as a Kubernetes sidecar in the same namespace. The gateway’s credential store isolates the service account password from the agent, allowing you to rotate secrets centrally without touching the agent configuration. As the number of AI agents grows, the policy engine continues to enforce the same guardrails because every request must pass through the same proxy.

Getting started with hoop.dev for Devin

To protect database access for an AI coding agent, begin by deploying the hoop.dev gateway. The quick‑start guide walks you through a Docker Compose launch that includes built‑in OIDC verification, masking, and guardrails. Next, register the Postgres instance as a connection, supplying the host, port, and a service credential that the gateway will store – the agent never sees the password. Finally, define a policy bundle for Devin that specifies which schemas it may read, which columns require masking, and which statements need approval. The getting‑started documentation provides step‑by‑step guidance, and the learn section dives deeper into policy syntax and workflow configuration.

FAQ

Q: Does hoop.dev replace the need for role‑based permissions inside Postgres?
A: No. hoop.dev works alongside native database roles. It adds a layer of runtime governance – masking, approval, and audit – that cannot be expressed with static grants alone.

Q: Will the AI agent notice any latency when its queries are proxied?
A: The additional hop introduces a small, predictable overhead, but the benefit of real‑time protection and full session recording outweighs the performance impact for most production workloads.

Q: How are audit logs stored?
A: hoop.dev writes session records to a configurable backend that can be integrated with existing SIEM or log‑aggregation pipelines. The exact storage mechanism is documented in the learn area.

For the full source code and to contribute improvements, visit the hoop.dev GitHub repository.

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