Many assume that AI coding assistants such as GitHub Copilot automatically log every database query they generate. In reality, Copilot runs as a normal client, uses the same credentials you would give a developer, and leaves the database unaware of who or what asked for the data. Without an explicit control plane, there is no audit trail, no way to mask sensitive columns, and no gatekeeper to stop risky statements.
When a team lets Copilot write SQL against a production Postgres instance, the typical workflow looks like this: a developer enables the Copilot extension, the extension sends generated statements to the local client, the client authenticates with a static password or a service account, and the query reaches the database directly. The database sees a trusted connection and executes the statement, while the organization loses visibility into which AI‑generated statements were run, when, and by which user. The result is a blind spot that makes forensic analysis, compliance reporting, and incident response difficult.
Why the existing identity setup is not enough
Modern environments already use OIDC or SAML providers to issue short‑lived tokens for humans and service accounts. Those tokens decide whether a request may start, but they do not inspect the traffic that follows. In the Copilot scenario, the token proves that the request originates from an authorized identity, yet the request still travels straight to Postgres without any intermediate enforcement. No command‑level audit, no inline masking, and no just‑in‑time approval are applied. The identity layer alone cannot guarantee that every generated statement is recorded or that sensitive fields are hidden.
How audit trails are enforced with hoop.dev
hoop.dev is a Layer 7 gateway that sits between the AI agent and the database. It receives the OIDC‑validated identity, then proxies the connection to Postgres. Because the gateway sits in the data path, it can inspect each SQL command before it reaches the server. At that point hoop.dev records the statement, the identity that issued it, and the response. The recorded session becomes an audit trail that can be replayed later for investigation or compliance purposes.
In addition to recording, hoop.dev can mask sensitive columns in query results, ensuring that even if Copilot receives a row containing passwords or tokens, those fields are redacted before they reach the client. The gateway can also enforce just‑in‑time approvals for high‑risk operations such as schema changes or bulk deletes, routing those requests to a human approver before they are allowed to execute. All of these enforcement outcomes exist because hoop.dev is the only component that sits in the data path; the identity provider and the database remain unaware of the additional controls.
