Skip to content

feat: switch from reCAPTCHA to the CF turnstile - #5166

Open
wescopeland wants to merge 2 commits into
RetroAchievements:masterfrom
wescopeland:cf-turnstile
Open

feat: switch from reCAPTCHA to the CF turnstile#5166
wescopeland wants to merge 2 commits into
RetroAchievements:masterfrom
wescopeland:cf-turnstile

Conversation

@wescopeland

Copy link
Copy Markdown
Member

Google is billing us for reCAPTCHA. There are alternatives; reCAPTCHA isn't worth spending donor money on.

We still need deeper protection on this specific page than Cloudflare WAF. WAF doesn't guard against things like headless browsers using residential IP addresses.

This PR migrates account registration's anti-bot protection measure from reCAPTCHA to the Cloudflare Turnstile, operating in managed mode.

Prod env vars are already set via Forge. For security reasons, they do not work locally. If no env vars are set, the turnstile control does not appear. For testing locally, you can use the following in your .env:

# force success
CLOUDFLARE_TURNSTILE_SITE_KEY="1x00000000000000000000AA"
CLOUDFLARE_TURNSTILE_SECRET_KEY="1x0000000000000000000000000000000AA"

# force failure
CLOUDFLARE_TURNSTILE_SITE_KEY=2x00000000000000000000AB
CLOUDFLARE_TURNSTILE_SECRET_KEY=2x0000000000000000000000000000000AA
Screenshot 2026-08-12 at 8 47 53 AM

@wescopeland
wescopeland requested a review from a team August 12, 2026 12:49
@greptile-apps

greptile-apps Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Migrates registration anti-bot protection from reCAPTCHA to Cloudflare Turnstile.

  • Adds server-side Turnstile verification.
  • Updates registration UI, CSP, configuration, translations, and tests.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (2): Last reviewed commit: "chore: add missing file" | Re-trigger Greptile

Comment thread public/request/auth/register.php
Comment thread tests/Feature/Community/Actions/VerifyTurnstileTokenActionTest.php

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: When the turnstile verification fails, the fields get cleared out. On a short password failure, the fields remain filled in.

Comment thread .env.example
CLOUDFLARE_API_TOKEN=
CLOUDFLARE_ZONE_ID=
CLOUDFLARE_TURNSTILE_SITE_KEY=
CLOUDFLARE_TURNSTILE_SECRET_KEY=

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason not to leave the success and failure keys in here and just comment them out?

I don't expect to be testing this functionality again once the PR is merged, but if I had to, I don't know if I'd be able to find the keys.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated (also happens on master): On success, the page reloads, which triggers another human-validation. Consider redirecting to the main page, or the login page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants