The Simplest Way to Make BigQuery and OIDC Work Like They Should
You can pair bigquery and oidc to let users query data without static keys. This setup links your identity provider straight to your cloud data warehouse. Teams use this workflow to run daily SQL jobs from local machines or pipelines. An engineer logs in with their work account and gets a temporary token. The cloud platform checks this token and lets the query run right away. You do not need to share JSON key files across your team anymore. When someone leaves the company, you turn off their ma
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 can pair bigquery and oidc to let users query data without static keys. This setup links your identity provider straight to your cloud data warehouse.
Teams use this workflow to run daily SQL jobs from local machines or pipelines. An engineer logs in with their work account and gets a temporary token. The cloud platform checks this token and lets the query run right away. You do not need to share JSON key files across your team anymore. When someone leaves the company, you turn off their main login once. Their warehouse permissions stop working at that exact same moment.
How logins and data move between bigquery and oidc
The login flow starts when a user or build job needs data. First, the user signs in to the identity provider. The provider checks their identity and sends back a signed OIDC token. This token holds claims like the user email and group name.
Next, the client sends this token to the cloud identity pool. The cloud pool checks the signature against the provider public keys. It also reads the claims inside the token to check the user group. If the claims match your rules, the cloud pool issues a short-lived token. That new token maps to a specific cloud role or service account.
Finally, the user sends their SQL query with that temporary cloud token. The data warehouse checks the role permissions for that specific dataset and table. If the role allows read rights, the query runs and returns the rows. Every step uses short-lived credentials that expire after a short window.
Common failure modes and how to scope roles
Many teams still fall into the trap of shared service accounts. Five different apps or ten analysts might map to one broad cloud role. When a bad query spikes costs, the audit log shows only the shared role. You cannot tell which human or pipeline ran the bad SQL command.
BigQuery IAM + Protocol Translation (SAML to OIDC): architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Overbroad tokens create another big risk for data teams. If a token claim check is too loose, any repo can assume the role. A test branch could read production tables that hold sensitive customer fields. Unlogged queries also hurt security when analysts run ad-hoc checks on raw tables. Those tables often store private emails, phone numbers, card numbers, or national IDs.
You can fix this by scoping roles down to the smallest needed task. Create separate cloud roles for read jobs, write jobs, and admin tasks. Write strict attribute rules that check the exact user group or repo name. Only map a token if every claim matches your exact rule set.
Lock down network paths so requests only come from known IP ranges. Use private cloud network routes for automated build runners and backend apps. Turn on data audit logs to record every query and token exchange. Review your role mappings each month to cut unused permissions and stale groups.
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
Why use OIDC with BigQuery instead of service account keys?
Service account keys never expire unless you rotate them by hand. If a key leaks in a code repo, attackers can read your tables. OIDC uses short-lived tokens that expire on their own after a brief session.
How do we map OIDC groups to specific dataset permissions?
Your identity provider puts group names inside the OIDC token claims. The cloud identity pool reads those claims during the token exchange step. You then bind each group claim to a cloud role for one dataset.
What happens if an OIDC token expires during a long query?
The warehouse checks your token right when the query job starts. If the token is valid at the start, the query finishes its run. You only need a fresh token when you fetch the next page of results.
Related guides
In this post