How to Configure OpenHands Snowflake Permissions
You set up openhands snowflake permissions by creating a custom role and a service user. Then you grant that role read rights on specific schemas and tables. Many engineering teams start by giving their autonomous coding agent a broad admin role. That shortcut lets the agent run any command across the entire data warehouse. Broad roles allow a confused agent to drop tables or read private records. How openhands snowflake permissions work in practice Snowflake uses role-based rules to control
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 permissions by creating a custom role and a service user. Then you grant that role read rights on specific schemas and tables. Many engineering teams start by giving their autonomous coding agent a broad admin role. That shortcut lets the agent run any command across the entire data warehouse. Broad roles allow a confused agent to drop tables or read private records.
How openhands snowflake permissions work in practice
Snowflake uses role-based rules to control what users and bots can do. Every action inside the cloud warehouse runs under an active role. You start by making a dedicated role just for the OpenHands agent. Next, you create a service user and assign that new role as its default. You also give the role usage rights on a small compute warehouse. This compute warehouse runs the queries that the agent writes during a task.
After the compute warehouse is ready, you grant usage on one database. You also grant usage on the specific schema the agent needs to inspect. Finally, you grant select privileges on the tables inside that single schema. The agent now logs in with a key pair or password from its workspace. When OpenHands runs a task, it uses those stored credentials to start a session. The database engine checks the active role before running any SQL statement.
What native roles solve and where they fall short
Native database roles stop the agent from touching other databases on your account. They also block the agent from changing table structures if you only grant read rights. Cost controls on the compute warehouse stop runaway queries from burning your budget. These native controls handle the basic question of who can log in.
Still, static roles cannot inspect what an individual query does while it runs. Once a role has select rights on a table, it can read every row by default. It can also read every column inside that table without limits. If a table holds customer emails, phone numbers, or card numbers, the agent gets them. The agent then pulls those raw values into its prompt context and local logs. Native roles also lack a step to pause a risky command for human approval. And because the workspace holds raw keys, a bad script can steal them.
Snowflake Access Control + AI Agent Permissions: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Steps to tighten agent roles and data rules
You can reduce risk by splitting agent tasks into separate database roles. Create one read-only role for bug checks and schema lookups. Create a second role that only writes to a clean staging schema. Never let the agent write straight to production tables during an automated run. Keep production data separate from the sandbox tables that the agent tests against.
You should also turn on row filtering and column masking inside the data warehouse. Data masking rewrites matched fields like national IDs or card numbers in query results. This step keeps raw private strings out of the agent workspace and external model logs. Set short timeouts on the compute warehouse so bad queries fail fast. Rotate the service user keys on a regular schedule to limit key leaks. Review your query history logs each week to spot strange agent behavior early.
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
Should OpenHands use a personal engineer account for database tasks?
No, you should never give an autonomous agent a personal user account. Always create a dedicated service user so you can track and limit agent queries.
How do I stop the agent from running huge queries?
Assign the agent role to a small compute warehouse with strict timeout limits. You can also set a daily credit quota on that specific compute warehouse.
Can native database roles hide private columns from the agent?
Standard table grants allow reading all columns at once by default. You must add dynamic masking policies to rewrite emails or phone numbers in results.
Related guides
In this post