When an AI coding agent is given unfettered access to a production database, the organization inherits the same risks it faces when a developer checks a shared password into source control. Using a non-human identity for that agent changes the security calculus. Accidental queries can corrupt data, exfiltrate personally identifiable information, or trigger costly compliance violations. The financial and reputational impact of a single rogue query often far exceeds the modest effort required to secure the connection.
Most teams today solve the problem by creating a single database user for the agent, embedding the password in CI pipelines, or granting the agent the same role as a human engineer. Those approaches give the agent more privileges than it needs, leave no trail of what was run, and make it impossible to redact sensitive columns on the fly. In practice the agent reaches PostgreSQL directly, meaning the database itself must enforce all guardrails, masking, and logging.
Introducing a non-human identity changes the first part of the equation. Instead of a static password, the agent authenticates with an OIDC token that represents a service account. The token can be scoped to a specific database schema, a limited time window, or a particular set of tables. This reduces the attack surface and aligns the agent with the principle of least privilege. However, the request still travels straight to the PostgreSQL endpoint, so enforcement must happen before the database sees the command.
That is where a data‑path gateway becomes essential. hoop.dev sits between the identity layer and the PostgreSQL server, acting as a wire‑protocol proxy. By placing enforcement at the gateway, every query passes through a single control surface that can apply policy before the database ever sees the command.
Why non‑human identity matters for AI agents
Non‑human identities give you granular control over who, or what, can talk to PostgreSQL. An AI coding agent can be issued a short‑lived token that only allows SELECT on a reporting schema. When the token expires, the agent loses access without any manual revocation. This model eliminates credential sprawl and makes it easy to rotate secrets centrally.
How hoop.dev enforces policy on the PostgreSQL wire protocol
When the agent presents its OIDC token, hoop.dev validates the token, extracts the group or role information, and maps it to a named identity that the gateway uses to talk to the database. The gateway holds the actual PostgreSQL credentials, so the agent does not obtain the database password directly. As each SQL statement flows through the proxy, hoop.dev can:
