Repository navigation
fix(api): Turnstile sees the proxying client's visitor, not its egress IP - #1048
Merged
Merged
Conversation
…s IP `verifyTurnstileOrFail` sent `cf-connecting-ip` as siteverify's `remoteip`, which for a consumer that proxies the create server-side is the proxy's own address. An authenticated `clients` request may now name the visitor in `x-client-ip`; any other caller's header is ignored, and an absent one falls back to `cf-connecting-ip` and never refuses a submission. `credentialRejection` stays on `cf-connecting-ip`, and its comment now says why. `docs/rules/api-clients.md` states the header a proxying consumer sends, and that Cloudflare's verdict on a mismatched `remoteip` is unverified. Closes #808 Co-Authored-By: Claude Opus 5.5 <[email protected]>
From review: the published Atlas key means an authenticated client is no trust signal, so the comment and the rule say what the header is worth. Co-Authored-By: Claude Opus 5.5 <[email protected]>
railway-app
Bot
temporarily deployed
to
sahajcloud / SahajCloud-pr-1048
October 29, 2026 22:14
Destroyed
|
🚅 Deployed to the SahajCloud-pr-1048 environment in sahajcloud
1 service not affected by this PR
|
Contributor
This branch was successfully deployed
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.
Summary
clientsrequest may name the visitor inx-client-ip;verifyTurnstileOrFailsends it as siteverify'sremoteip, falling back tocf-connecting-ip. Any other caller's header is ignored, and an absent one never refuses a submission.credentialRejectionstays oncf-connecting-ip, and its comment now says why (a rejected credential is no authenticated client).docs/rules/api-clients.mdstates the header a proxying consumer sends, that any key holder (the published Atlas key included) can set it, and that Cloudflare's verdict on a mismatchedremoteipis unverified.Closes #808. Unblocks sydevs/WeMeditateWeb#208.
Change outline
Tests
tests/unit/anti-spam-guard.spec.ts— forwarded, fallback, and ignored for a manager and an anonymous caller. Watched red with the collection gate removed (2 cases) and with the fallback-only read (1 case).tests/int/user-submissions-create.int.spec.ts— a proxied create through the real write guard, with and without the header. The forwarded case watched red against the old read.Review
Adversarial review run locally (the bot is out of usage). No blockers; adopted its two doc findings — the trust wording and a stale
@param.Notes for reviewer
x-client-ipvs.x-forwarded-forchoice and thecredentialRejectioncarve-out are the ticket's recorded decisions.🤖 Generated with Claude Code