The Simplest Way to Make Cloud Run and Fido2 Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Pairing cloud run and fido2 lets teams protect serverless apps with hardware security keys. The user proves identity with a key before the container handles any request. This setup blocks phishing attacks on internal tools and admin dashboards. Teams get strong login checks without managing dedicated servers. How cloud run and fido2 handle login and data flow The workflow splits state between the client browser and the stateless container. First, a user opens the web app hosted on the server

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.

Pairing cloud run and fido2 lets teams protect serverless apps with hardware security keys. The user proves identity with a key before the container handles any request.

This setup blocks phishing attacks on internal tools and admin dashboards. Teams get strong login checks without managing dedicated servers.

How cloud run and fido2 handle login and data flow

The workflow splits state between the client browser and the stateless container. First, a user opens the web app hosted on the serverless platform.

The container generates a random cryptographic challenge and stores it in a shared store. It sends this challenge back to the browser over a secure channel.

Next, the browser asks the user to touch their hardware security key. The key signs the challenge bound to the exact domain name of the app.

The browser sends the signed payload back to a running container instance. That instance reads the original challenge from the shared store and checks the signature.

After the signature passes the check, the app issues a short session token. The user can now run actions based on their assigned role.

Common failure modes and how to scope permissions

Stateless containers spin up and shut down based on incoming traffic. If an app stores login challenges in local memory, checks will fail.

A second request might land on a brand new container instance. Teams must store challenges and public keys in an external database.

Domain mismatches also break hardware key checks in production. Keys bind to a specific web origin during the initial setup phase.

FIDO2 / WebAuthn + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

If a team routes traffic through custom domains, the app must know that domain. Every container instance needs the exact same origin settings.

Overbroad service accounts create another major risk for serverless apps. Many teams attach a single admin role to every running container.

If an attacker finds a bug in the app, they gain wide permissions. Instead, give each service its own narrow role with minimal read and write rights.

Unlogged actions also leave blind spots during security audits. Passing a hardware key check only proves who started the session.

Teams still need clear audit logs showing every query and command run afterward. Tie every backend action back to the verified user identity.

Finally, protect the database that holds user public keys. If someone alters that table, they can register a rogue key.

Restrict write permissions on the key table to the registration service alone. Audit every change to user key records and alert the security team.

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

Why do hardware key checks fail when containers scale out?

When containers store challenges in memory, a new instance cannot read them. Store all pending challenges in a shared external database instead.

How should teams handle custom domains with hardware keys?

Hardware keys lock credentials to the exact domain name used during registration. Keep your domain name static and match it in your app settings.

What happens if a developer loses their registered hardware key?

Allow users to register a backup hardware key during their initial setup. Admins can also revoke the lost key and trigger a fresh registration flow.

Teams that document these role rules and review logs each month catch config drift early. Clear ownership for each role keeps live systems simple to run and easy to audit across the whole team.

The query runs. The emails stay hidden.