Nested agents let a single compromised credential amplify access across your Postgres fleet, breaking least privilege guarantees.
Most teams still rely on a shared superuser password or a static service account that is baked into deployment scripts. Engineers log in with the same credential from their laptops, CI pipelines, and monitoring tools. The password lives in configuration files, environment variables, or secret stores that are not centrally audited. When a breach occurs, every system that trusts that credential is instantly exposed, and there is no reliable record of who ran which query.
To reduce operational friction, many organizations introduce a “nested agent” pattern. An outer agent runs on a bastion host, authenticates to Postgres, and then spawns a second‑level agent that executes queries on behalf of a workload. The inner agent inherits the outer agent’s session and reuses the same database credential, so the workload never needs to manage its own secret. This pattern appears to limit credential distribution, but it also creates a hidden trust chain.
The nested‑agent approach fixes the problem of credential sprawl, yet it leaves the request path unchanged. The inner agent still talks directly to the database server using the original privileged credential. No gateway intercepts the traffic, so there is no inline masking of sensitive columns, no command‑level approval, and no session recording. Auditors cannot tell whether a data‑exfiltration query originated from a human operator or an automated script.
What you really need is a place where enforcement can happen, a boundary that sits between every agent, nested or not, and the database. The boundary must be able to examine each SQL statement, apply policy, and produce reliable evidence of the interaction.
hoop.dev provides that boundary. It is a Layer 7 gateway that proxies every Postgres connection, regardless of whether the client is a developer’s psql session, a CI job, or a nested agent. hoop.dev verifies the caller’s OIDC token, then enforces least privilege policies at the query level. hoop.dev records each session, masks columns that contain personal data, and blocks statements that exceed the granted scope. Because the gateway sits in the data path, the enforcement outcomes exist only because hoop.dev is present.
