All posts

Non-human identity for AI coding agents on Postgres

Imagine a CI pipeline that spins up an autonomous coding agent to generate and apply database migrations on every pull request. The agent runs under a service account, never a human user, and it needs to connect to PostgreSQL without embedding static passwords in source code or build scripts. At the same time, security teams demand full visibility of every statement the agent runs, the ability to block dangerous commands, and automatic redaction of any personally‑identifiable columns that might

Free White Paper

Non-Human Identity Management + AI Human-in-the-Loop Oversight: The Complete Guide

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

Free. No spam. Unsubscribe anytime.

Imagine a CI pipeline that spins up an autonomous coding agent to generate and apply database migrations on every pull request. The agent runs under a service account, never a human user, and it needs to connect to PostgreSQL without embedding static passwords in source code or build scripts. At the same time, security teams demand full visibility of every statement the agent runs, the ability to block dangerous commands, and automatic redaction of any personally‑identifiable columns that might be returned.

Why non-human identity matters for AI agents

Non‑human identities eliminate the credential sprawl that comes from sharing static secrets among bots, scripts, and contractors. When an AI‑driven agent authenticates with an OIDC token, the token proves who (or what) is making the request without exposing a password. However, a token alone does not enforce policy. The request still travels straight to the database, potentially leaking data, executing unintended DDL, or bypassing audit requirements. Without a control point in the data path, the organization cannot guarantee that every query is recorded, that sensitive fields are masked, or that risky statements are reviewed before execution.

Putting the gateway in the data path

The missing piece is a Layer 7 gateway that sits between the identity provider and PostgreSQL. This gateway becomes the sole place where enforcement can happen. It validates the OIDC token, extracts group membership, and then decides whether the request may proceed. Because the gateway proxies the native PostgreSQL wire protocol, the client sees no difference in its workflow – it still uses psql or any standard driver – but the connection never reaches the database without first passing through the gateway.

How hoop.dev enforces policies on Postgres

hoop.dev fulfills the gateway role. It receives the AI agent’s OIDC token, confirms the token against the configured IdP, and maps the token to a scoped identity that is allowed to run only the migration‑related statements required for that CI run. The gateway holds the actual PostgreSQL credentials, so the agent never has direct access to the password. Once the request is authorized, hoop.dev forwards it to the database over TLS, records every SQL statement at command level, and applies inline data masking to any columns marked as sensitive. If a statement matches a guardrail rule – for example, a DROP DATABASE – hoop.dev blocks it and can route the request to a human approver before allowing it to continue. All of these outcomes – audit logging, masking, guardrails, just‑in‑time approval, and session recording – exist only because hoop.dev sits in the data path.

Key enforcement outcomes

  • Command‑level audit: Each query the AI agent issues is captured in an immutable log that can be replayed for compliance reviews.
  • Inline masking: Sensitive columns such as SSN or credit‑card numbers are redacted before the result reaches the agent, protecting downstream services from accidental exposure.
  • Just‑in‑time access: The token grants the minimum scope needed for the specific CI job, and the grant expires as soon as the pipeline finishes.
  • Guardrails and approvals: Potentially destructive statements are either blocked outright or sent to an approver for manual sign‑off.
  • Credential offload: The database password lives only in the gateway, eliminating secret leakage in CI configuration files.

Because hoop.dev is the only component that can see the raw SQL traffic, it is the authoritative enforcement point. Removing hoop.dev would return the request to a direct connection, losing all of the above guarantees.

Continue reading? Get the full guide.

Non-Human Identity Management + AI Human-in-the-Loop Oversight: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

Getting started

To protect AI‑driven PostgreSQL access, deploy hoop.dev’s gateway in the same network as the database. The quick‑start guide walks through a Docker Compose deployment, OIDC configuration, and registering a PostgreSQL connection. Once the gateway is running, configure your CI system to point its database client at the gateway address and to request an OIDC token for the service account that represents the AI coding agent. Detailed steps are available in the getting‑started documentation and the broader feature guide at hoop.dev/learn.

FAQ

Do I need to change my application code?

No. Because hoop.dev proxies the native wire protocol, existing PostgreSQL clients connect exactly as they would to the database, only the host address changes to the gateway.

How does hoop.dev handle credential rotation?

The gateway stores the database credentials internally. When the password is rotated, you update the gateway configuration; the AI agents never need to handle the new secret.

Can I still use IAM authentication for RDS?

Yes. hoop.dev supports per‑user IAM tokens for Amazon RDS, allowing the gateway to obtain temporary credentials on behalf of the AI agent.

What if I need to audit a failed query?

All attempts, successful or blocked, are logged. The audit log includes the statement text, the identity that issued it, and the enforcement decision.

Ready to protect your AI‑driven PostgreSQL workloads? Explore the open‑source repository and start a contribution at github.com/hoophq/hoop.

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