How to Configure OpenHands Bigquery Audit Log

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up an openhands bigquery audit log by linking cloud logs to your agent. You create a dedicated service account and turn on data access logs in your cloud project. Many teams give their coding agents broad database roles to speed up early testing. Broad permissions let an autonomous agent read private tables or run expensive queries by mistake. How the openhands bigquery audit log workflow operates OpenHands runs as an autonomous coding agent inside its own workspace container. It writ

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 an openhands bigquery audit log by linking cloud logs to your agent. You create a dedicated service account and turn on data access logs in your cloud project. Many teams give their coding agents broad database roles to speed up early testing. Broad permissions let an autonomous agent read private tables or run expensive queries by mistake.

How the openhands bigquery audit log workflow operates

OpenHands runs as an autonomous coding agent inside its own workspace container. It writes code, runs shell commands, and queries cloud data to finish tasks. When the agent needs warehouse data, it uses a cloud service account key. You place this credential inside the agent workspace before the task starts.

BigQuery records activity through Google Cloud audit logs. Admin logs track table creation and role changes by default. Data access logs track who reads tables and runs queries. You must turn on data access logs in your cloud console first. Once active, every query from the OpenHands service account creates a detailed log entry. This entry shows the caller identity, the SQL text, and the job status. Security teams route these log entries to a central sink for review.

What native logging solves and what it misses

Native cloud logs give you a clear history of past agent actions. You can see which tables the agent read during a coding session. You can also see how much data each query scanned for billing checks. If a bad query runs, the log tells you which service account sent it.

Still, native cloud logs only record events after the query finishes. The cloud role decides who logs in, not what individual statements do in flight. If the agent has read permissions on a dataset, it can pull every column by default. Native logs will not stop the agent from reading emails, phone numbers, or card numbers. The agent loads those raw rows into its memory and sends them to external models. Also, every task using that same service key looks identical in the cloud log. You cannot link a specific SQL query back to the human who prompted the agent.

Audit Log Integrity + BigQuery IAM: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Managing agent permissions and query safety

To reduce risk, teams scope the agent service account to specific datasets. You should never grant project-wide editor or owner roles to an autonomous tool. Create a custom role that only allows running jobs and reading safe tables. Keep sensitive customer tables in a separate project or dataset.

Even within safe datasets, some columns still hold private user details. Dynamic data masking rewrites matched fields like national IDs or phone numbers in query results. Adding approval rules for drop or delete commands also prevents accidental data loss. Pairing query controls with your cloud logs gives you both prevention and history.

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

Does BigQuery log every OpenHands query by default?

No, BigQuery only records admin changes by default. You must enable data access audit logs in your cloud project to capture read queries.

How do we tell OpenHands queries apart from human queries?

Give the OpenHands workspace its own dedicated cloud service account. All queries from the agent will show that specific service account email in the log.

Can native audit logs block a dangerous query from running?

No, native audit logs only record queries after they hit the database. You need in-flight query controls or strict role permissions to block bad statements.

The query runs. The emails stay hidden.