The Simplest Way to Make Cloud Run and SAML Work Like They Should
Teams pair cloud run and saml to check user identity before running containers. This setup lets workers log in once to reach internal web apps. Google Cloud Run hosts stateless containers that scale up and down fast. SAML passes signed login data from an identity provider to those apps. Together, they keep public network traffic away from private company tools. How cloud run and saml share login data A user opens a browser and tries to reach the container app. The system stops the request an
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 cloud run and saml to check user identity before running containers. This setup lets workers log in once to reach internal web apps.
Google Cloud Run hosts stateless containers that scale up and down fast. SAML passes signed login data from an identity provider to those apps. Together, they keep public network traffic away from private company tools.
How cloud run and saml share login data
A user opens a browser and tries to reach the container app. The system stops the request and sends the user to the login page. The identity provider checks the user password and second factor.
After a good login, the provider builds an XML document called an assertion. It signs this document with a private key and sends it back. The Google load balancer or app reads the signed XML file. It checks the digital signature against a saved public certificate.
Next, the system reads user attributes like email and group names. Google Cloud IAM maps these group names to specific container roles. If the user has the right role, the container processes the request. The container reads user headers to know who sent the call.
This flow keeps password checks out of your custom app code. Developers write business logic while the platform handles the login flow. Every request carries verified user identity data from the start.
Common failure modes and how to scope roles
Many teams make mistakes when they set up this login flow. A common flaw is using one shared service account for all containers. If one app gets hacked, the attacker can reach every backend database.
Another bad habit is trusting broad group claims without checking them. Teams sometimes grant full admin roles to every user in the directory. This breaks least privilege rules and puts sensitive data at risk.
SAML 2.0 + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Unlogged requests also create huge blind spots during a security audit. When apps only see a shared load balancer identity, logs lose value. You cannot tell which person ran a bad command or read data.
You can fix these issues by scoping roles and network paths tightly. Give each container service its own dedicated service account with small roles. Map SAML group attributes to narrow Google IAM roles for each app.
Set your network ingress rules to block direct public internet traffic. Force all traffic to pass through the external load balancer first. This step stops attackers from bypassing the SAML login check.
Keeping audit logs and user sessions clean
Short session times reduce the risk of stolen browser cookies. Set your SAML assertions to expire after a few hours of work. When the timer runs out, the user must log in again.
Make sure your app writes the user email into every log line. Pair the network request ID with the SAML user attribute in logs. This habit helps security teams trace actions back to one real person.
Test your certificate rotation steps before the old key expires. An expired SAML certificate will lock out your whole engineering team fast. Keep a secondary certificate ready in your identity settings during updates.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
Does Cloud Run support SAML assertions on its own?
No, the container runtime uses Google IAM or OIDC tokens by default. You must put Identity Platform or custom code in front to read SAML.
How do we pass SAML group roles to a container?
Your identity provider sends group names inside the signed SAML assertion. The front-end login service reads those groups and passes them as HTTP headers.
What happens when a SAML signing certificate expires?
The login check fails right away and blocks all new user sessions. Teams must upload the new public key to their cloud settings before expiration.
Related guides
In this post