Skip to content

Challenges and CAPTCHA Since v0.1 ​

A challenge step sends a browser navigation to a page that runs a short proof of work and sets a token cookie. A captcha step asks for a CAPTCHA: our own self-hosted one, or Turnstile, hCaptcha or reCAPTCHA. API calls, apps and scripts are never sent these pages.

Before you begin ​

  • Role: operator for the application. Changing the secret and the keys is recorded in the audit log.
  • Add a challenge or captcha step to the response ladder.
  • A third-party CAPTCHA needs outbound HTTPS from the inspection nodes to the provider, or an outbound proxy.

Set the challenge ​

The token lifetime, the proof-of-work size and the paths never challenged are settings of the Challenge group.

text
1. Open Applications > All applications > the application > Request checks > Bot mitigation.
2. Open the Challenge and CAPTCHA tab, Challenge section.
3. Change Token lifetime, Proof of work or Never challenge these paths.
4. Select Preview changes, then Apply.
sh
waap bots set -app shop -m "challenge" challenge.token_ttl=1h challenge.work=100000 challenge.skip=/healthz,/status*
yaml
bots:
  challenge:
    token_ttl: 1h
    work: 100000
    skip: ["/healthz", "/status*"]

Clients that cannot run the challenge get the Clients that cannot run a challenge action (log by default, or block). The dashboard shows challenges solved of those sent.

Exclude health checks

Put health checks and status pages under Never challenge these paths. A challenge step logs there instead. Block and ban steps still apply.

Use a CAPTCHA ​

The self-hosted CAPTCHA needs nothing else. For a third-party provider:

text
1. Open the Challenge and CAPTCHA tab, CAPTCHA section.
2. Choose the Provider and enter the Site key. Select Preview changes, then Apply.
3. Enter the provider's secret and select Save secret.
4. Select Test with the provider.
sh
waap bots set -app shop -m "captcha" captcha.provider=turnstile captcha.site_key=0x4AAA...
waap bots captcha set -app shop < secret.txt
waap bots captcha test -app shop
yaml
# the secret is never in the configuration
bots:
  captcha:
    provider: turnstile
    site_key: "0x4AAA..."

Remove the secret (waap bots captcha remove -app shop) to return to the self-hosted CAPTCHA. waap bots captcha get -app shop shows the provider, site key and whether a secret is set, never the secret.

Provider outages

When the provider cannot verify, the application's failure policy decides: fail-open lets the client through with a short JavaScript-level token, fail-closed asks to try again.

Rotate the signing keys ​

The active node creates the signing keys when bot mitigation is turned on and rotates them every Key rotation. The Challenge tab shows when each was made, never the key. Rotate at once after a suspected leak. Tokens signed before the previous rotation stop working and their browsers are challenged again.

text
1. Open the Challenge and CAPTCHA tab, Signing keys section.
2. Select Rotate now and confirm.
sh
waap bots challenge-keys list -app shop
waap bots challenge-keys rotate -app shop

Use your own page ​

The challenge and CAPTCHA pages can be replaced. The page needs exactly once and may use , , and . At most 64 KiB.

text
1. Open the Challenge and CAPTCHA tab and the page section for the challenge or the CAPTCHA.
2. Enter or upload the HTML and select Preview changes, then Apply.
3. To go back, tick Use the built-in challenge page (or CAPTCHA page).
sh
waap bots page set -app shop -kind challenge -m "own page" -f page.html
waap bots page reset -app shop -kind challenge
yaml
# policy.bots.challenge.page (and captcha.page) holds the HTML

Settings reference ​

Challenge ​

SettingWhat it doesDefaultAllowed valuesApplies in
Token lifetime (challenge.token_ttl)How long a solved challenge lets the client through.30m1m to 168hchallenge steps
Key rotation (challenge.key_rotation)A new signing key this often; the previous one stays valid until the next rotation.24h1h to 2160h; at least the token lifetimechallenge steps
Bind to IPv4 network (challenge.bind.ipv4_prefix)A token works from addresses in the same network of this size.248 to 32 bitschallenge steps
Bind to IPv6 network (challenge.bind.ipv6_prefix)Same, for IPv6.6416 to 128 bitschallenge steps
Bind to the TLS fingerprint (challenge.bind.tls_fingerprint)A token works only from the TLS stack (JA4) that solved it.truetrue, falseHTTPS listeners
Proof of work (challenge.work)Expected SHA-256 computations to solve it.500001000 to 10000000challenge steps
Ignored after (challenge.ignored_after)Challenges within 10 minutes without a solve before bot.challenge.ignored is added.5up to 1000challenge steps
Never challenge these paths (challenge.skip)Paths where challenge steps log instead.noneexact paths or prefixes ending in *challenge steps
Reserved path (challenge.path)Path prefix inspection answers itself; requests under it never reach the server./.waap/a path prefixchallenge steps

CAPTCHA ​

SettingWhat it doesDefaultAllowed valuesApplies in
Provider (captcha.provider)Which CAPTCHA to show.selfself, turnstile, hcaptcha, recaptchacaptcha steps
Site key (captcha.site_key)The provider's public key.nonetextthird-party providers
Work after the button (captcha.work)Self-hosted: computations after the button is pressed.3000001000 to 50000000provider self
Provider timeout (captcha.timeout)How long a provider's verification may take.5s1s to 15sthird-party providers
Outbound proxy (captcha.proxy)Proxy for calls to the provider.none (direct)a URLthird-party providers
Verification URL (captcha.verify_url)Overrides the provider's verification endpoint, for a mirror or a test double.nonea URLthird-party providers

Tarpit ​

SettingWhat it doesDefaultAllowed valuesApplies in
Tarpit delay (tarpit.delay)How long a tarpit step holds the refusal.10s1s to 60starpit steps
Tarpit capacity (tarpit.max_concurrent)Refusals held at once on a node.200up to 10000tarpit steps; over it, steps block at once

Examples ​

Challenge at 30, then a CAPTCHA at 60, with a longer token:

yaml
bots:
  challenge: {token_ttl: 2h}
  responses:
    - { at: 30, action: challenge }
    - { at: 60, action: captcha }
    - { at: 90, action: block }

Limits ​

LimitValue
Custom page size64 KiB
Signing keysone signs, the previous still verifies
Provider callup to 15s

Troubleshooting ​

Users loop on the challenge page ​

  • Cause: the token is bound to a network or TLS fingerprint that changes between requests.
  • Fix: widen Bind to IPv4 network, or turn off Bind to the TLS fingerprint.

Third-party CAPTCHA never loads ​

  • Cause: the inspection node cannot reach the provider.
  • Check: Test with the provider or waap bots captcha test -app shop.
  • Fix: allow outbound HTTPS to the provider, or set Outbound proxy.