Repository navigation
morca ui: Cloudflare Turnstile before data reads - #547
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017TycszSbyw92Efu4ZeCYL6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Crawlers that rotate addresses get past the per-client limits (#545). With
MORCA_UI_TURNSTILE_SITEKEYandMORCA_UI_TURNSTILE_SECRET(a secret id, read withfetch_secret) set, a visitor without a session passes Turnstile once a day before a data read:morca_humancookie is a 403 page with the widget (actiondata);data.csv,data.jsonand JSON get a 403 in text.POST /turnstile(same-origin) calls siteverify (10 s, fails closed) and needssuccess, actiondataand a hostname inMORCA_UI_TURNSTILE_HOSTNAMES; then setsmorca_human(expiry + HMAC-SHA256 under a key made at startup; HttpOnly, SameSite=Lax, Secure, a day) and 303s to a sanitisednext.TURNSTILE_SITEKEY,secrets/orca/turnstile-secretinSECRETS_FILE(orTURNSTILE_SECRET_FILE),TURNSTILE_HOSTNAMES(UI_URL's host by default).Tests:
test-turnstile(cookie good/expired/tampered, next sanitising);test-ui-drainwith a siteverify stand-in (403 page, failing token, pass sets the cookie, read goes on, forged cookie refused);test-hetzner.🤖 Generated with Claude Code
https://claude.ai/code/session_017TycszSbyw92Efu4ZeCYL6