When an AI coding agent silently writes queries against your data warehouse, a single over‑privileged credential can expose millions of rows in seconds.
Most teams treat the agent like any other service account: they create a Google service account, grant it the bigquery.admin role, and hand the JSON key to the model. The agent then runs unrestricted SELECT, INSERT, or even DROP statements directly against BigQuery, and the organization loses visibility into which queries were issued, by whom, and why.
Why least privilege matters for AI coding agents
Least privilege is the practice of giving a principal only the permissions it needs to perform its intended function. For an AI coding assistant, that function is usually to generate SELECT statements that read data for analysis or reporting. Granting bigquery.admin or owner rights violates the principle because the agent can also create tables, alter schemas, or delete datasets.
When the principle is ignored, the blast radius of a mistake or a malicious prompt expands dramatically. A single errant prompt that asks the model to “show all user records” can retrieve personal data that should be restricted, and the organization may be unable to prove who authorized the request.
What least privilege alone doesn’t solve
Even if you tighten the service account to bigquery.dataViewer or a custom role that limits column access, the request still travels straight from the agent to BigQuery. The data path remains unobserved, so you lose three critical controls:
- Audit: there is no guaranteed record of which query was executed, when, and under which identity.
- Masking: sensitive columns such as SSNs or credit‑card numbers are returned in clear text to the agent.
- Approval: high‑risk operations like exporting data or creating temporary tables bypass any human review.
These gaps exist because the enforcement point is missing. The setup – OIDC authentication, service‑account provisioning, and role assignment – tells the system who the request is, but it does not inspect the traffic flowing to BigQuery.
How hoop.dev enforces least privilege on the data path
hoop.dev inserts a Layer 7 gateway between the AI agent and BigQuery. The gateway becomes the only place where traffic can be examined, altered, or blocked.
