How to Configure OpenHands Snowflake Credentials

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up openhands snowflake credentials by passing database keys into the agent workspace. The coding agent then uses those keys to log in and run queries. Most teams start by giving the agent a standard user role with broad read permissions. When a role is too wide, the agent can read sensitive tables or drop data. How openhands snowflake credentials work in agent workflows OpenHands runs tasks inside an isolated container workspace. The agent writes code, runs scripts, and checks databas

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 credentials by passing database keys into the agent workspace. The coding agent then uses those keys to log in and run queries. Most teams start by giving the agent a standard user role with broad read permissions. When a role is too wide, the agent can read sensitive tables or drop data.

How openhands snowflake credentials work in agent workflows

OpenHands runs tasks inside an isolated container workspace. The agent writes code, runs scripts, and checks database outputs to solve tickets. To query your data warehouse, the agent needs valid login keys inside its workspace. Teams pass account names, usernames, and private keys through workspace secrets.

When a task starts, the agent reads those local secrets from the container memory. It builds a database session using standard driver libraries. Snowflake checks the user key and assigns a default role for the session. That role controls which warehouses, databases, and tables the agent can use.

Good setup starts with a dedicated service role for the AI agent. Admins grant this role read rights only on specific schemas. They also set warehouse size limits to stop huge bills from bad queries. Using key pair login instead of basic passwords makes rotation much easier for the team.

What native database roles solve and what they miss

Native roles in your data warehouse do a great job at login time. They confirm who the user is and which objects that role can see. If the agent tries to query a restricted schema, the database blocks the run. This keeps the agent inside its assigned boundary during normal work.

Still, static roles cannot judge what an individual query does in flight. Once the agent has table permissions, it can pull every row and column inside by default. If a table holds emails, phone numbers, or card numbers, those values enter the prompt. The agent might also run a slow query or alter rows in a writable test table.

Ephemeral Credentials + Snowflake Access Control: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Another gap is secret exposure inside the agent workspace. Because the container holds the raw key, a bad script could print it in logs. Teams also struggle to link a single database query back to the human who prompted it. Standard logs only show the shared service account name, not the developer running the agent.

Best practices for scoping agent database sessions

Teams should separate read roles from write roles when setting up agent workflows. Give the agent a read-only role for daily debugging and schema checks. If a task requires schema changes, review the plan before running any write scripts. Never store warehouse admin keys in the local workspace files.

You should also mask sensitive columns before results reach the agent context window. Rewriting matched fields like national IDs or emails in results keeps private data out of prompts. Pairing narrow warehouse roles with query-level checks gives teams safe, fast agent runs.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.

Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Where does OpenHands read database secrets during a run?

The agent reads secrets from local variables injected into its runtime container. Any script inside that container can read those values while the task runs.

Should my coding agent use a shared human account?

No, you should always create a separate service role with narrow permissions. Shared human accounts make audit logs messy and often hold too many table rights.

How can I stop agents from pulling private customer rows?

Restrict the agent role to safe views or apply data masking on columns. Data masking rewrites matched fields like card numbers and phone numbers in query results.

The query runs. The emails stay hidden.