How to Integrate Retool and Spanner Safely

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair retool and spanner to build internal tools on top of global databases. This setup lets support and ops staff view and update records from a browser. Linking an internal app builder to a live database brings clear security risks. You must lock down keys, limit user roles, and track every query that runs. How retool and spanner share data and permissions Retool talks to Google Cloud Spanner through a standard cloud service account. Admins create a service account in Google Cloud and

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.

Teams pair retool and spanner to build internal tools on top of global databases. This setup lets support and ops staff view and update records from a browser.

Linking an internal app builder to a live database brings clear security risks. You must lock down keys, limit user roles, and track every query that runs.

How retool and spanner share data and permissions

Retool talks to Google Cloud Spanner through a standard cloud service account. Admins create a service account in Google Cloud and grant it database roles. Then, admins upload the service account key into the Retool resource setup page.

When a user clicks a button in a Retool app, the platform builds a query. Retool sends that query to the Spanner instance using the stored cloud key. Spanner checks the service account permissions and runs the read or write command. The database then sends the result rows back to the user screen.

In this basic flow, Spanner only sees the single Retool service account. It does not see which specific employee clicked the button in the browser. All app users share the exact same database trust level by default.

Common risks with shared service accounts

The biggest risk in this setup is an overly broad service account role. Many teams give the Retool key full read and write permissions across all tables. If an attacker steals that static key, they can read or delete everything. Even without a breach, a bug in one app can corrupt core tables.

Shared accounts also break audit logs inside Google Cloud. When ten people run queries through one resource, the database log shows one identity. Security teams cannot tell who ran a bad update or pulled customer data.

End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Raw query results also expose sensitive fields to too many staff members. Support reps might need to check an order status in the app. If the query pulls the whole row, the screen shows emails and phone numbers. It might also return card numbers or national IDs that staff do not need.

Scoping roles and network paths in production

To reduce risk, never use a single service account for all internal apps. Create separate Google Cloud service accounts for each team or use case. Give the support app key read-only roles on specific tables. Give the billing tool key write access only to the exact tables it updates.

Next, use fine-grained access control inside Spanner to restrict sensitive columns and rows. You can grant a role access to order columns while hiding card numbers. You should also rotate service account keys on a strict schedule. If your setup allows workload identity, use short-lived tokens instead of static JSON keys.

Finally, lock down the network path between the app platform and your database. Do not expose database endpoints to public traffic without strict rules. Use private network routing or strict firewall rules to allow known IP addresses only. Pair these network rules with data masking so matched fields rewrite in query results.

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

Can Spanner logs show which Retool user ran a query?

By default, Spanner logs only show the shared Google Cloud service account name. To track individual users, you must pass user metadata or use per-user identity mapping.

Should we use one Spanner resource for all Retool apps?

No, sharing one resource gives every app the highest permission level needed by any tool. Create separate resources with narrow read or write roles for each team.

How do we protect sensitive fields like emails and phone numbers in Retool?

Do not rely on hiding columns in the front-end table settings alone. Restrict column access in the database role or use masking to rewrite matched fields.

The query runs. The emails stay hidden.