A contractor who once had read‑only access to a codebase leaves the organization, but the CI pipeline still runs a GitHub Copilot‑powered assistant that writes SQL against a production PostgreSQL instance. The assistant never logs its queries, and the team has no way to prove what data it touched before the bug was discovered.
When AI coding agents interact with databases, the lack of session recording creates a blind spot for any internal developer who runs Copilot locally. The model can suggest INSERTs, UPDATEs, or SELECTs that expose sensitive rows, and without a reliable audit trail the organization cannot answer compliance questions or investigate incidents. This is where session recording becomes essential.
To mitigate that risk, the control must sit on the data path, not in the client or the AI service. A dedicated gateway can inspect every wire‑level request, enforce policies, and record the full interaction before it reaches PostgreSQL.
Why session recording matters for AI‑driven database access
Session recording captures the complete request‑response exchange, including the exact SQL statements generated by the AI, the parameters supplied, and the results returned. With that evidence you can:
- Demonstrate compliance with internal governance and external audit requirements.
- Identify accidental data exposure or malicious manipulation caused by an AI suggestion.
- Replay a session to reproduce a bug or verify that a remediation step succeeded.
- Provide forensic context for post‑mortem analysis without relying on the AI service’s internal logs.
Because the AI model runs in a separate process, its own logs are not trustworthy for security purposes. Only a component that cannot be tampered with by the client can guarantee an immutable record.
How hoop.dev captures sessions for GitHub Copilot
hoop.dev acts as a Layer 7 gateway that terminates the PostgreSQL protocol on behalf of the client. The flow looks like this:
- Developers or CI jobs authenticate to hoop.dev using OIDC or SAML tokens issued by the corporate IdP.
- The gateway validates the token, extracts group membership, and decides whether the request is allowed.
- When a request is permitted, hoop.dev forwards it to the PostgreSQL server using a credential that only the gateway knows. The client never sees the database password.
- Before forwarding, hoop.dev records the raw query and, after receiving the response, records the result set. Both are stored in an audit log.
- If a policy requires inline masking, such as redacting credit‑card numbers, hoop.dev rewrites the response before it reaches the client.
Because hoop.dev is the only component that sees both the inbound query and the outbound response, it is the sole source of truth for session recording. Removing hoop.dev would eliminate the guarantee that every interaction is captured.
