All posts

Putting access controls around Claude: database access for AI coding agents (on internal SaaS)

Why database access needs tighter control for Claude Claude’s coding agents often run with a static service‑account credential that grants full read‑write rights to production databases, effectively giving the AI unrestricted database access. The secret lives in CI pipelines, is shared across teams, and rarely rotates, giving the model the ability to query or modify any table. Because the agent connects straight to the database, there is no central point to inspect queries, mask personally‑ide

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.

Why database access needs tighter control for Claude

Claude’s coding agents often run with a static service‑account credential that grants full read‑write rights to production databases, effectively giving the AI unrestricted database access. The secret lives in CI pipelines, is shared across teams, and rarely rotates, giving the model the ability to query or modify any table.

Because the agent connects straight to the database, there is no central point to inspect queries, mask personally‑identifiable information, or require a human to approve destructive commands. Audit logs only show generic database events, not the originating AI request.

You may have already federated Claude with an OIDC provider, so authentication works, but without an intervening gateway the request still reaches the target unfiltered. The missing piece is a data‑path control that can enforce just‑in‑time access, inline masking, and command‑level audit.

One way to address this gap is to place a protocol‑aware proxy between the AI and the database. The proxy would terminate the client session, validate the identity token, and then apply policy checks before forwarding the request. By centralising enforcement, you gain a single place to log every statement, hide sensitive columns, and pause potentially destructive operations for review.

Introducing the enforcement layer

hoop.dev provides exactly that data‑path control. It sits between Claude’s agent and the database, acting as a Layer 7 gateway that terminates the client connection, validates the OIDC token, and then forwards the request to the backend only after applying policy checks.

The gateway holds the database credential, so the AI never sees the password. When a request arrives, hoop.dev can:

  • Require a human approver for any statement that alters schema or drops tables.
  • Mask columns that contain personally‑identifiable data before the response reaches Claude.
  • Block commands that match a deny list, such as destructive DELETE or TRUNCATE operations.
  • Record the full session, including the original query and the masked response, for replay and audit.

Each of these outcomes is enforced because hoop.dev sits in the data path; the same request would pass unchecked if the gateway were removed.

Architectural flow for Claude’s database access

When Claude generates a query, the agent authenticates to hoop.dev using an OIDC token issued by your identity provider. hoop.dev verifies the token, extracts group membership, and checks the request against a policy that defines which users or service accounts may run which statements against which schemas. If the policy requires approval, hoop.dev routes the request to a reviewer and only forwards it after consent.

Continue reading? Get the full guide.

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

Free. No spam. Unsubscribe anytime.

Because the policy evaluation happens at the gateway, you get a single source of truth for who did what, when, and with what result. The recorded session can be stored in a secure log that auditors can query without ever seeing the underlying credential.

Benefits of a zero‑trust data path for AI agents

By forcing every query through hoop.dev, you gain visibility that would otherwise be invisible. The gateway logs the exact statement, the identity that issued it, and the masked result, giving you a comprehensive audit log. This visibility makes it easier to detect anomalous patterns, such as a sudden surge of DELETE statements, and to respond before data loss spreads.

Inline masking also protects downstream consumers. If Claude is used to generate reports that include customer PII, the gateway can replace those fields with tokenized values, ensuring that downstream systems never receive raw personal data. Because the masking happens at the protocol level, the AI never learns the original values, reducing the risk of data leakage through model training.

Just‑in‑time approval turns a static permission model into a dynamic one. Instead of granting blanket write access for weeks, you require a reviewer to approve each potentially destructive operation. The approval request includes the full SQL statement, so the reviewer can make an informed decision without needing to reproduce the context.

Compliance and audit readiness

Regulators often ask for proof that only authorized personnel touched sensitive data. Because hoop.dev records every query with identity and timestamps, the logs satisfy typical evidence requirements for SOC 2 audits without additional tooling.

Getting started with Claude and hoop.dev

The quick‑start guide walks you through deploying the gateway and registering a PostgreSQL connection. Follow the step‑by‑step instructions in the getting‑started documentation to launch the Docker Compose stack, configure OIDC, and add the database as a connection.

For deeper policy options such as column‑level masking and approval workflows, see the learn section. The open‑source repository contains the full source code and example configurations.

FAQ

Can hoop.dev enforce per‑column masking for AI‑generated results? Yes. The gateway can rewrite response rows to replace sensitive fields before they are returned to Claude.

What happens if an approval is denied? hoop.dev aborts the session and returns an error to the agent, ensuring no unauthorized change reaches the database.

Is session replay possible for forensic analysis? Every query and its masked response are recorded, allowing you to replay the exact interaction for investigation.

Ready to secure Claude’s database access? Explore the hoop.dev repository on GitHub and start building a zero‑trust data path today.

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