How to Configure Spanner Password Policy

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up a spanner password policy inside your Google Cloud identity provider. Cloud Spanner does not use local database passwords at all. Instead, it relies on cloud IAM accounts and external login rules. Teams often assign broad cloud roles to make database logins easy. Those broad roles let users run risky queries once they log in. How a spanner password policy works in Google Cloud Cloud Spanner handles user logins in a different way than older databases. You cannot create a local user

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 a spanner password policy inside your Google Cloud identity provider. Cloud Spanner does not use local database passwords at all. Instead, it relies on cloud IAM accounts and external login rules. Teams often assign broad cloud roles to make database logins easy. Those broad roles let users run risky queries once they log in.

How a spanner password policy works in Google Cloud

Cloud Spanner handles user logins in a different way than older databases. You cannot create a local user with a secret text string inside the database. Every person or app must log in through Google Cloud IAM first. Because of this design, your password rules live in your identity provider. You set length rules, character rules, and reset timers in Google Workspace or Cloud Identity.

Many teams also link an external identity tool through workforce identity federation. In that setup, your main identity provider checks the user password and multi-factor token. Once the user logs in, Google Cloud checks their assigned IAM roles. These roles decide if the user can open a database session. Spanner also offers fine-grained roles inside the database for table permissions.

To build a strong spanner password policy, you must lock down both layers. First, enforce strict login rules and short session timers in your identity directory. Second, map each user group to the smallest possible IAM and database role. Do not use long-lived service account keys for human users or local tests. Require every engineer to log in with their own cloud account and fresh tokens.

What native identity rules solve and what they miss

Identity provider rules and IAM roles solve the front door problem well. They make sure users type strong passwords and pass multi-factor checks. They also stop unknown users from reaching your database instances. When a worker leaves the team, you disable one cloud account to stop logins. Fine-grained database roles also help restrict which tables a role can read.

Still, login checks only decide who gets into the database. Once a session starts, the native login policy steps out of the way. An engineer with read rights on a customer table can query every row. Native password rules cannot spot a query that dumps ten thousand customer records. They also cannot rewrite sensitive fields like emails, phone numbers, or card numbers.

Application-to-Application Password Management: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Shared roles for on-call work create another big gap for security teams. During an outage, teams often grant broad write roles to fix broken data. A strong login rule does not stop a bad update statement from running. Database audit logs can show who logged in and ran a query. Still, turning on full data read logs across huge instances adds high storage costs.

Managing live database sessions beyond login rules

True database safety requires controls that work after the login check passes. You need a way to inspect every SQL statement before the database runs it. Instead of granting standing write roles, teams can require approval for single risky commands. That keeps day-to-day permissions small while allowing fast fixes during a live outage.

Data masking in flight also closes a major privacy gap during support work. When a developer runs a select query, masking rules can rewrite matched fields in results. The developer sees the table structure and safe rows to fix the bug. Sensitive columns like national IDs or card numbers get replaced before reaching the screen. Combining strong identity rules with live query checks gives you full control over data.

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 inline in the protocol beside the service as an open-source proxy, a sidecar for your database or API. On every production query an agent or human runs, hoop.dev decides whether to pass, mask, block, or escalate it for review.

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 approval, and hoop.dev data masking rewrites sensitive fields in responses in memory. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Does Cloud Spanner have built-in database user passwords?

No, Cloud Spanner does not store local database users or passwords. It uses Google Cloud IAM and your connected identity provider to check every login.

Where do I set password length and reset rules for Spanner users?

You set those rules inside Google Cloud Identity, Google Workspace, or your federated identity provider. Those rules apply when users sign in to get a cloud session token.

How can I protect sensitive columns when users query Spanner?

You can use fine-grained database roles to block whole tables or columns. To rewrite emails or card numbers in query results, add a runtime masking tool.

The query runs. The emails stay hidden.