All posts

Putting access controls around ChatGPT: database access for AI coding agents (on Snowflake)

Many assume that giving ChatGPT a Snowflake credential is safe because the model cannot retain secrets, but the reality is that language models can surface any data they receive, including credentials or query results. The misconception disappears once you consider that an uncontrolled AI agent can issue arbitrary database access requests, exfiltrate rows, and bypass existing governance. How teams currently expose Snowflake to AI agents In practice, engineering groups often embed a static Sno

Free White Paper

Snowflake Access Control + AI Model Access Control: The Complete Guide

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

Free. No spam. Unsubscribe anytime.

Many assume that giving ChatGPT a Snowflake credential is safe because the model cannot retain secrets, but the reality is that language models can surface any data they receive, including credentials or query results. The misconception disappears once you consider that an uncontrolled AI agent can issue arbitrary database access requests, exfiltrate rows, and bypass existing governance.

How teams currently expose Snowflake to AI agents

In practice, engineering groups often embed a static Snowflake user or service account directly into the prompt or the wrapper code that calls the model. That credential typically has read‑write rights across the warehouse, and the wrapper does not enforce any per‑query review. The AI agent talks straight to Snowflake over the public endpoint, so there is no central point that can see which tables are queried, what columns are returned, or whether a result contains sensitive personally identifiable information. Auditors have no logs of which prompts triggered which queries, and developers cannot retroactively mask a column that was accidentally returned.

The missing piece: a controlled request surface

The immediate fix is to stop using static secrets and to require a non‑human identity that is granted only the permissions needed for a particular task. This step eliminates credential sprawl and forces the AI to operate under least‑privilege constraints. However, without a gateway that sits between the agent and Snowflake, the request still travels directly to the database. The path offers no place to enforce inline masking, request approval, or session recording. In other words, the setup alone does not give you the visibility or protection you need for safe database access.

Why a Layer 7 gateway is the only reliable control point

All enforcement must happen where the traffic can be inspected before it reaches the target system. That inspection point is the data path. By placing a proxy that understands the Snowflake wire protocol, you gain a single place to apply policies that are impossible to bypass from the client side.

Setup: identity and least‑privilege grants

First, configure an OIDC or SAML identity provider (Okta, Azure AD, Google Workspace, etc.) and create a service account that represents the AI coding agent. The provider issues a short‑lived token that proves the agent’s identity and group membership. The token is presented to the gateway, which verifies it before allowing any request to proceed. This step decides who the request is and whether it may start, but it does not enforce any behavior on its own.

The data path: hoop.dev as an identity‑aware proxy

hoop.dev sits on the network segment that connects the AI runtime to Snowflake. The agent never contacts Snowflake directly; instead it opens a connection to hoop.dev using its standard Snowflake client. hoop.dev holds the Snowflake service credentials internally, so the agent never sees them. Because hoop.dev terminates the protocol, it can inspect every SQL statement, the result set, and the metadata associated with the session.

Continue reading? Get the full guide.

Snowflake Access Control + AI Model Access Control: Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

Enforcement outcomes that only hoop.dev can provide

  • hoop.dev records each session, creating a replay‑able audit trail that ties a specific prompt to the exact query and result rows.
  • It masks sensitive columns in real time, ensuring that even if the AI tries to return a credit‑card number, the response is redacted before it reaches the model.
  • It can require just‑in‑time approval for high‑risk statements such as DROP TABLE or data‑exfiltration queries, routing them to a human reviewer.
  • It blocks commands that match a deny list, preventing destructive or out‑of‑policy operations from ever reaching Snowflake.

All of these outcomes exist because hoop.dev occupies the data path; removing the gateway would instantly eliminate masking, approval, and session recording.

Applying the model to ChatGPT and Snowflake

When an AI coding assistant such as ChatGPT needs to run a query, it first obtains an OIDC token that represents its service identity. The token is sent to hoop.dev, which validates it against the configured IdP. Once validated, hoop.dev uses its own Snowflake credential to open a backend connection. The SQL statement generated by the model passes through hoop.dev, where the policy engine checks for prohibited patterns, applies column‑level masking rules, and, if required, pauses for a human approver. After execution, the result set is filtered again before being handed back to the model. Because hoop.dev records the full request‑response cycle, compliance teams can later demonstrate exactly what data the AI accessed.

From an operational perspective, you only need to deploy the gateway once, register the Snowflake target, and point your AI runtime at the proxy endpoint. The rest of the workflow, policy definition, approval routing, and audit review, lives in the hoop.dev configuration and can be updated without redeploying the AI agent.

Getting started

Follow the getting started guide to spin up the gateway with Docker Compose, connect your OIDC provider, and register a Snowflake connection. The documentation also covers how to define masking rules and approval workflows. For deeper insight into the policy model, explore the learn section, which explains how query‑level audit, inline masking, and just‑in‑time approvals are implemented.

Frequently asked questions

Does hoop.dev store Snowflake credentials?

Yes, the gateway holds the service credential internally so that the AI agent never sees it. The credential is managed by the gateway process and is not exposed to the client.

Can I use hoop.dev with other databases besides Snowflake?

Absolutely. hoop.dev supports a wide range of database protocols, but the same architectural pattern applies: the gateway becomes the sole enforcement point for any target.

How does hoop.dev help with compliance audits?

Because hoop.dev records every session and ties it to an identity token, auditors can retrieve a complete audit log of who ran what query and when. The logs also show which columns were masked and which requests required human approval.

Take the next step

Ready to protect AI‑driven database access to Snowflake? Clone the open‑source repository and start experimenting: https://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