How to Configure OpenHands Snowflake Data Masking

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up openhands snowflake data masking by binding column rules to agent database roles. These rules rewrite sensitive fields like emails or card numbers before the agent reads them. Teams often give an AI coding agent a broad shared role to finish tasks fast. That broad role lets the agent pull raw customer records into its prompt history. If the agent sends that prompt to an outside model, private records leak out. How openhands snowflake data masking works in practice OpenHands runs in

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 openhands snowflake data masking by binding column rules to agent database roles. These rules rewrite sensitive fields like emails or card numbers before the agent reads them. Teams often give an AI coding agent a broad shared role to finish tasks fast. That broad role lets the agent pull raw customer records into its prompt history. If the agent sends that prompt to an outside model, private records leak out.

How openhands snowflake data masking works in practice

OpenHands runs in a sandbox and executes tasks by writing code and running queries. When the agent needs warehouse records, it authenticates to Snowflake using a assigned role. The warehouse checks the active role during each query run. If the role matches a masking rule, the database engine rewrites the matched column values. It changes emails, phone numbers, and national IDs into scrambled strings or fixed placeholders.

To make this work, an admin first creates a dedicated role for the agent. Next, the admin writes a masking rule that checks which role is running the query. Then, the admin attaches that rule to every column that holds private user details by default. When OpenHands logs in with its role, the rule changes matched fields in the results. The agent gets table structures and safe values so it can still write good code.

How to scope agent roles for warehouse tasks

Start by creating a separate service user and a dedicated role for the coding agent. Never let the agent share a role with human engineers or analytics apps. Grant this new role read permissions only on the specific schemas needed for the task. Keep production write permissions off this role so the agent cannot drop or alter tables.

Next, map out every column in those schemas that stores emails, phone numbers, or card numbers. Attach your column rules to those fields and test them using the agent role. Run a test query with that role to verify that the results show rewritten values. Also, check that the agent cannot switch to a higher role during its session. This keeps the agent locked into the safe view while it builds and tests code.

Data Masking (Static) + Snowflake Access Control: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

What native column rules solve and where gaps remain

Native column rules work well when your team knows where every sensitive field lives. They rewrite known columns inside the warehouse before the query results leave the database engine. This stops raw card numbers or national IDs from entering the agent container workspace. It also keeps those known fields out of the agent logs and model prompts.

Still, native warehouse rules only check who logs in and which tagged columns they query. They do not inspect what individual queries do in flight or scan untagged text columns. Engineers add new tables and free-text columns every week, and rules often lag behind. If an agent queries a new table or a raw JSON column, unmasked data slips through. Also, storing static warehouse keys inside the agent sandbox creates a risk if a prompt goes wrong.

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 runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values 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

Why does an AI coding agent need masked warehouse records?

Coding agents put query results directly into their context window to plan their next steps. Rewriting emails and card numbers in results keeps private data out of third-party model prompts.

Can OpenHands still write and test SQL when fields are masked?

Yes, the agent only needs valid data types and table schemas to write working queries. Rewritten emails or phone numbers keep the same format, so agent tests still pass.

What happens when someone adds a new table to the warehouse?

In a native setup, an admin must manually tag and attach rules to the new columns. Until someone attaches those rules, the agent role can read raw values from that new table.

The query runs. The emails stay hidden.