The Simplest Way to Make Step Functions and Webauthn Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Combining step functions and webauthn lets teams gate automated cloud workflows behind hardware security keys. The workflow pauses at a callback task until a user signs a browser challenge. Cloud teams use state machines to run database updates, billing fixes, and server patches. Some steps carry high risk and need a human check before they run. A simple button click in a chat app is easy to spoof or click by mistake. Hardware key checks prove that a real, approved person signed off on that exa

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.

Combining step functions and webauthn lets teams gate automated cloud workflows behind hardware security keys. The workflow pauses at a callback task until a user signs a browser challenge.

Cloud teams use state machines to run database updates, billing fixes, and server patches. Some steps carry high risk and need a human check before they run. A simple button click in a chat app is easy to spoof or click by mistake. Hardware key checks prove that a real, approved person signed off on that exact task.

How step functions and webauthn pass identity and state

A state machine runs a sequence of cloud tasks based on rules you set up. When the flow hits a sensitive step, it stops and creates a task token. The state machine sends this unique token to an internal approval app and waits.

The approval app asks the user to prove their identity with WebAuthn in their browser. The browser talks to a local authenticator, like a fingerprint reader or a USB key. The hardware key signs a challenge tied to the app domain and the task token.

Next, the app backend checks that cryptographic signature against the stored public key. If the signature matches, the backend calls the state machine API with the task token. The workflow then moves to the next step and logs who approved the run.

Common failure modes and how to scope roles

Many teams set up this flow with a single shared role for the approval app. If that app role has broad permissions, any bug can resume any paused workflow. Attackers who compromise the web app could approve tasks without a real hardware key check.

Another common mistake is skipping the link between the signed challenge and the task payload. If the check only proves login status, an attacker could swap the task token. The backend must bind the task ID and action details into the data being signed.

FIDO2 / WebAuthn + Cloud Functions IAM: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Unlogged database queries during the workflow also create blind spots for security audits. You might know who tapped their key, but not what rows the state machine changed. Also, masking should rewrite matched emails, phone numbers, card numbers, and national IDs in results.

To fix these issues, scope the app role to only send task status updates. Split your state machine roles so each step uses its own tight set of permissions. Set a short timeout on every wait state so dead tasks fail safe and close.

Auditing human approvals across automated workflows

Auditors need a clear chain of custody from the human tap to the final action. Log the public key ID, the user email, and the task token in one record. Store these records in an append-only log bucket that workflow roles cannot delete or alter.

When a state machine runs a database query, pass the approver identity in the payload. This practice links the automated run back to the person who tapped their security key. Teams can then review every high-risk change with full context during security checks.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

How does a state machine wait for a WebAuthn tap?

The workflow uses a callback task token pattern and pauses execution. It waits until your backend checks the hardware signature and sends the token back.

What happens if the user never completes the WebAuthn check?

You set a heartbeat or task timeout on the wait state in your workflow. When time runs out, the state machine cancels the run or moves to a failure path.

Can one WebAuthn tap approve multiple workflow steps at once?

Each sensitive step generates its own unique task token and requires a separate check. You should require a fresh hardware signature for every high-risk state transition.

The query runs. The emails stay hidden.