How to Configure OpenHands Bigquery Permissions

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up openhands bigquery permissions by assigning cloud roles to a dedicated service account. Then you restrict that account to read or run jobs on specific datasets. Many teams start by giving the coding agent a broad project editor role. That shortcut lets the agent drop tables, scan huge datasets, and read sensitive customer columns. How openhands bigquery permissions work in practice OpenHands runs in a local container or cloud sandbox to write code and run queries. When the agent ne

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 bigquery permissions by assigning cloud roles to a dedicated service account. Then you restrict that account to read or run jobs on specific datasets. Many teams start by giving the coding agent a broad project editor role. That shortcut lets the agent drop tables, scan huge datasets, and read sensitive customer columns.

How openhands bigquery permissions work in practice

OpenHands runs in a local container or cloud sandbox to write code and run queries. When the agent needs warehouse data, it uses cloud credentials stored in its runtime space. Google Cloud checks two distinct permission types before running any query. First, the account needs job permissions at the project level to start a query job. Second, the account needs data permissions at the dataset or table level to read rows.

To keep the setup tight, create a new service account just for the agent. Grant job user rights on a dedicated billing project so the agent can run queries. Next, grant data viewer rights only on the specific datasets the agent should inspect. Avoid granting data viewer roles at the top project level. Project-level roles expose every dataset in that project to the agent.

If the agent builds test tables, create a separate scratch dataset for writes. Grant data editor rights only on that scratch dataset. You can also set cost controls on the billing project to cap daily query spend. This stops a looping agent from scanning petabytes of data by mistake.

What native cloud roles solve and what they miss

Cloud roles do a great job of blocking access to whole datasets and projects. They verify which service account logs in and which tables it can touch. They also let you separate read tables from write tables using dataset rules. For coarse boundaries between teams or projects, native cloud roles are essential.

Still, static cloud roles leave a large operational gap during live agent sessions. Once an agent has read rights on a table, it can run any select statement. Native roles cannot inspect individual SQL statements in flight before they reach the warehouse. If a permitted table holds emails, phone numbers, or card numbers, the query returns them.

BigQuery IAM + AI Agent Permissions: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

You can set up cloud column tags, but managing tags across hundreds of tables takes effort. Native roles also do not require human approval when an agent runs a risky statement. Plus, static service account keys stored inside an agent container can leak through prompt mistakes. Teams need a way to check queries in flight and rewrite sensitive fields in results.

Steps to harden agent query sessions

Start by removing long-lived service account key files from the agent disk. Use short-lived credentials or workload identity where your cloud setup supports it. Next, review your dataset list and strip away any project-wide viewer or editor roles. Give the agent a small sandbox dataset with sample rows whenever possible.

Set a strict bytes-billed limit on the project that runs the agent jobs. Monitor the cloud audit logs to see which tables the agent queries most often. If an agent never uses a dataset, remove that dataset permission right away. Regular checks keep your warehouse safe as the agent takes on new tasks.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

What is the safest cloud role for an OpenHands agent?

Give the agent project-level job user rights and dataset-level data viewer rights on chosen datasets. Never assign project owner, editor, or bigquery admin roles to an autonomous agent.

How do I stop the agent from running huge queries?

Apply a custom quota on the billing project to limit daily bytes scanned per user. This stops runaway loops before they rack up large cloud bills.

Can native dataset roles hide sensitive columns from the agent?

Dataset roles alone apply to whole tables and views, not single columns. You must configure separate policy tags or use dynamic data masking to rewrite emails or card numbers.

The query runs. The emails stay hidden.