How to Configure Codex Snowflake Sandbox

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up a codex snowflake sandbox by creating an isolated database role for your AI agent. Next, you give that role read-only permissions on a separate schema or test clone. Teams often start by handing an AI coding tool their own local login keys. When those personal roles have broad write permissions, a single bad query can drop tables. Giving an automated agent wide warehouse permissions also risks huge compute bills from heavy scans. A dedicated test area limits what the AI tool can read

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up a codex snowflake sandbox by creating an isolated database role for your AI agent. Next, you give that role read-only permissions on a separate schema or test clone.

Teams often start by handing an AI coding tool their own local login keys. When those personal roles have broad write permissions, a single bad query can drop tables. Giving an automated agent wide warehouse permissions also risks huge compute bills from heavy scans. A dedicated test area limits what the AI tool can read or change.

How to set up a codex snowflake sandbox role

First, your data team creates a dedicated user and role inside your cloud warehouse. This specific role should only hold permissions for non-production schemas or sample data tables. You can use data cloning features to build a fast test copy of production tables. That step lets the agent test SQL queries without touching live customer records.

Next, you assign a small compute warehouse to that specific test role. You also set strict resource limits on that warehouse to stop runaway queries early. If the AI tool writes a slow join, the warehouse cancels the job fast. Then you place the login keys into the local environment where the agent runs.

When the coding agent needs schema details, it logs in with that restricted role. It reads table names and column types to write better app code for your team. Because the role lacks write privileges on live schemas, it cannot delete core business data.

What native warehouse roles solve and what they miss

Native warehouse roles do a great job of blocking unauthorized schema changes at login. They decide which tables a user or agent can see during a database session. They also cap compute spend when you link a role to a small warehouse.

Still, static roles only check who logs in at the start of a session. They do not inspect what individual SQL statements do while the session is active. If a test clone holds real customer emails or phone numbers, the role returns them. The database sends those raw fields straight back to the AI agent context window.

Snowflake Access Control + AI Sandbox Environments: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Static credentials also sit on developer laptops in plain text files for months. If a developer shares a project folder, those warehouse keys can leak outside the team. Also, native audit logs only show that the shared agent role ran a query. They do not record which developer prompt triggered that specific SQL statement.

Why query-level controls matter for AI coding agents

AI agents generate and run SQL faster than human engineers can review every line. Even inside a safe test schema, an agent might pull thousands of sensitive rows. When test data mirrors production, it often includes card numbers or national IDs. Masking rules that rewrite matched fields in results keep that sensitive data out of prompts.

Teams also need to approve risky commands before they hit the database engine. A human check on drop or alter statements stops mistakes inside shared test schemas. Tying every query back to an individual user identity also fixes the audit trail gap. You get clear logs showing which person and which tool ran each database command.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev sits inline in the wire protocol beside those services as an open-source proxy, a sidecar for your Postgres or API. On every query an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run, and hoop.dev data masking rewrites matched sensitive values in responses in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

Should a codex snowflake sandbox use read-only permissions?

Yes, starting with read-only permissions is the safest path for any AI coding agent. It lets the tool inspect schemas and test select queries without risking data loss.

How do we stop an AI agent from running expensive warehouse queries?

Assign the agent role to the smallest warehouse size available in your account. Then attach a resource monitor with a low credit limit and short query timeout.

What happens if our test clone contains real customer data?

Standard roles will return all rows that the role has permission to read by default. You should scrub emails, phone numbers, and card numbers before cloning, or mask results dynamically.

The query runs. The emails stay hidden.