All posts

Putting access controls around GitHub Copilot: data masking for AI coding agents (on Snowflake)

When a development team grants GitHub Copilot access to a Snowflake warehouse, the AI can surface query results directly in the editor. Applying data masking at the gateway prevents those results from leaking sensitive fields. In practice, a junior engineer may type a vague request like “show recent sales” and receive a full table that includes customer emails, credit‑card fragments, and internal project codes. The same happens when a CI pipeline runs automated code generation against a data‑ric

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.

When a development team grants GitHub Copilot access to a Snowflake warehouse, the AI can surface query results directly in the editor. Applying data masking at the gateway prevents those results from leaking sensitive fields. In practice, a junior engineer may type a vague request like “show recent sales” and receive a full table that includes customer emails, credit‑card fragments, and internal project codes. The same happens when a CI pipeline runs automated code generation against a data‑rich test database. The result is a rapid, convenient flow, but it also creates a channel where sensitive fields can be copied into source files, tickets, or even public repositories without anyone noticing.

Most organizations solve this by limiting the Copilot token or by manually scrubbing results after the fact. Those approaches leave the request path untouched: the Copilot client still talks directly to Snowflake, the Snowflake credentials travel unchanged, and there is no record of what data left the warehouse. The request reaches the data source, the response is returned, and any downstream leak happens outside of any enforcement boundary.

What is missing, therefore, is a dedicated data path that can inspect every response before it reaches the AI agent, apply masking rules, and log the interaction for later review. The identity that initiates the request, whether a human engineer, a CI service account, or an AI‑driven bot, must be verified, but verification alone does not stop the raw data from flowing out.

Data masking architecture for Copilot

hoop.dev provides the required data path. It sits as a Layer 7 gateway between the identity provider and Snowflake, proxying the connection with an internal agent that lives on the same network as the warehouse. The gateway validates OIDC or SAML tokens, extracts group membership, and then forwards the request to Snowflake using a credential that only the gateway knows. Because the traffic passes through hoop.dev, the system can apply data masking policies in real time.

When Snowflake returns a result set, hoop.dev examines each column against the configured masking rules. Fields that match patterns for personally identifiable information, payment data, or proprietary identifiers are replaced with placeholder values before the payload is handed to the Copilot client. The masking happens inline, so the AI never sees the original values, and the engineer sees only the sanitized output in the editor.

How the enforcement works

hoop.dev is the active enforcer of the masking policy. It records every session, stores the audit trail, and can replay a query later for compliance checks. Because the gateway is the only place where the response is visible in clear text, any attempt to bypass masking would have to circumvent the gateway itself, which is prevented by the network‑level placement and the strict identity checks performed at the start of each connection.

In addition to masking, hoop.dev can require a human approver for queries that touch high‑risk tables. The request is paused at the gateway, an approver is notified, and only after explicit consent does the gateway let the query proceed. This just‑in‑time approval model further reduces the blast radius of accidental data exposure.

Continue reading? Get the full guide.

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

Free. No spam. Unsubscribe anytime.

Setting up the environment

The first step is to configure the identity source. Connect your corporate IdP, Okta, Azure AD, Google Workspace, or any OIDC‑compatible provider, to hoop.dev. The gateway becomes the relying party, verifies the token, and extracts the user’s groups. Those groups drive the masking policy: for example, the "analytics" group may see sales totals but not raw customer emails.

Next, deploy the gateway. The quick‑start guide walks you through a Docker Compose deployment that runs the gateway and the network‑resident agent near your Snowflake cluster. Register Snowflake as a connection in the gateway UI, supply the service‑level Snowflake credential, and define which databases and schemas the gateway may access. The credential never leaves the gateway, so engineers and AI agents never handle it directly.

Finally, author data masking rules in the hoop.dev policy editor. The rules are expressed as field‑level selectors combined with pattern matches (e.g., columns named *email* or *ssn*). Once saved, the gateway enforces them on every response that flows through the data path.

Why this model matters

Because hoop.dev sits in the data path, the masking guarantee is not an after‑the‑fact process. The system records each query, applies the policy before the data reaches the AI, and can produce audit evidence that satisfies SOC 2 Type II requirements. If you removed hoop.dev from the architecture, the same identity checks would still happen, but the raw Snowflake response would be exposed directly to Copilot, and no masking or audit would be possible.

This separation of concerns, setup for identity, gateway for enforcement, and outcomes for masking and audit, aligns with the principle of least privilege. Engineers get the access they need, AI agents receive only sanitized data, and security teams retain full visibility into who queried what and when.

Next steps

To try it out, follow the getting‑started guide which walks you through deploying the gateway, connecting Snowflake, and defining masking policies. The learn section provides deeper examples of policy language and approval workflows.

For the full source code, configuration options, and contribution guidelines, visit the open‑source repository on GitHub. The community welcomes pull requests and feedback.

FAQ

Does hoop.dev store my Snowflake credentials?
No. The credentials are kept inside the gateway process and never exposed to users or AI agents.

Can I define custom masking patterns?
Yes. The policy editor lets you combine column selectors with regular‑expression matches to target any sensitive data you need to hide.

Will the gateway add noticeable latency?
hoop.dev processes responses at the protocol layer, adding only minimal overhead compared to a direct connection.

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