All posts

SOC 2 for AI coding agents: guardrails for code and data access (on Postgres)

An AI coding agent running in a CI pipeline pulls source files, generates queries against a production Postgres database, and writes results back to a shared artifact store. The agent runs under a service account that holds a static database password. When a new version of the model is pushed, the same credential is reused, and no one sees which statements the agent executed. This pattern looks efficient, but it collides with the evidence requirements of soc 2. The framework expects a record of

Free White Paper

AI Guardrails + AI Code Generation Security: The Complete Guide

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

Free. No spam. Unsubscribe anytime.

An AI coding agent running in a CI pipeline pulls source files, generates queries against a production Postgres database, and writes results back to a shared artifact store. The agent runs under a service account that holds a static database password. When a new version of the model is pushed, the same credential is reused, and no one sees which statements the agent executed.

This pattern looks efficient, but it collides with the evidence requirements of soc 2. The framework expects a record of who accessed which data, when the access occurred, and whether any protected fields were exposed. With a static credential, every run appears identical, and the database logs contain only the service account name. No inline masking protects sensitive columns, and no approval step blocks risky commands. The result is a black box that auditors cannot verify.

Why continuous evidence is essential for soc 2

soc 2 evaluates the effectiveness of security controls over time. Auditors look for continuous logs that reliably record the identity associated with each operation. They also require proof that sensitive data, such as personally identifiable information or credit card numbers, was never sent in clear text to an untrusted consumer. When evidence is collected only during periodic reviews, gaps appear, and the organization must explain every missing event.

Continuous evidence solves those gaps. Every connection, every query, and every response becomes part of a comprehensive audit trail. The trail can be queried on demand, exported for third‑party review, and correlated with identity data to demonstrate least‑privilege enforcement. Inline masking adds another layer: even if a query returns a protected column, the mask operation itself is recorded.

How hoop.dev provides the data‑path guardrails

The missing piece in the scenario above is a data‑path enforcement layer. hoop.dev acts as a Layer 7 gateway that sits between the AI agent and the Postgres instance. The gateway receives the agent’s request, verifies the OIDC token that represents the agent’s service account, and then applies a series of controls before the request reaches the database.

First, hoop.dev records each session. The record includes the identity, timestamp, executed SQL, and the exact response payload. Because the gateway owns the connection, the log cannot be altered by the agent.

Second, hoop.dev masks sensitive fields in real time. When a SELECT statement returns a column marked as protected, the gateway replaces the value with a placeholder before it reaches the agent. The masking event is logged alongside the original value, providing proof that the data never left the protected boundary.

Third, hoop.dev enforces just‑in‑time approval for high‑risk commands. If the agent attempts a DROP TABLE or an UPDATE on a critical table, the request is paused and routed to an authorized human for approval. The approval decision, approve or deny, is stored with the session record, satisfying the soc 2 requirement for controlled privileged actions.

Continue reading? Get the full guide.

AI Guardrails + AI Code Generation Security: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

Finally, hoop.dev blocks commands that match a deny list, preventing accidental or malicious destructive actions. The block decision is also logged, creating a complete picture of attempted versus successful operations.

Putting the pieces together

The compliance story starts with a proper identity foundation. The AI coding agent authenticates to an OIDC provider, receives a short‑lived token, and presents that token to the gateway. The token tells hoop.dev which groups the agent belongs to, allowing fine‑grained policy decisions.

Once the identity is verified, the gateway becomes the sole enforcement point. All audit, masking, approval, and blocking happen inside the data path, meaning the agent never sees raw credentials or unmasked data. Because hoop.dev controls the connection, every enforcement outcome is guaranteed to exist; removing the gateway would eliminate the audit trail, the masks, and the approval workflow.

From a soc 2 perspective, the organization now has continuous, verifiable evidence that:

  • Every query is tied to a specific service account token.
  • Sensitive columns are never exposed in clear text to the agent.
  • Privileged commands require documented human approval.
  • All attempts, successful or blocked, are recorded for later review.

These artifacts satisfy the Trust Services Criteria for security, availability, and confidentiality without requiring manual log collection or retroactive analysis.

Getting started

To adopt this approach, begin with the getting‑started guide. It walks you through deploying the gateway, configuring an OIDC trust, and registering a Postgres target. The learn section provides deeper coverage of masking policies, approval workflows, and session replay features.

Because hoop.dev is open source, you can inspect the code, contribute improvements, or host the gateway in your own VPC. The gateway runs as a Docker container or Kubernetes pod, scales with your traffic, and records logs that you can forward to your preferred storage solution.

Explore the source code on GitHub to see how the gateway integrates with your existing CI pipelines and identity provider.

FAQ

How does hoop.dev help an organization meet soc 2 requirements?

hoop.dev generates a continuous audit trail, masks protected data in real time, and forces just‑in‑time approvals for privileged actions. Those controls produce the evidence auditors expect for the security and confidentiality criteria of soc 2.

Do I need to replace my existing IAM system?

No. hoop.dev consumes the tokens issued by your OIDC or SAML provider. It adds a data‑path layer that enforces policies without altering the underlying identity management.

Is the solution suitable for production workloads?

Yes. The gateway runs as a Docker container or Kubernetes pod, scales with your traffic, and records logs that you can forward to your preferred storage solution. The open‑source nature lets you audit the implementation yourself.

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