Repository navigation
fix(api): resolve trusted visitor IPs across dashboard rate limits - #788
Merged
Merged
Conversation
Resolve Railway edge and verified Cloudflare visitor IPs without enabling global proxy trust. Share client identity across limiter scopes, partition ingest by API key public ID, and preserve authenticated affiliate forwarding. Add opt-in IP diagnostics, deployment guidance, and spoofing, IPv6, NAT, and application-level rate-limit coverage.
Extend the shared client-IP resolver to authenticate dashboard forwarding for every rate-limit scope using the existing server-only secret. Route server-side dashboard API fetches through a guarded helper and resolve visitors only through Railway and verified Cloudflare peers. Preserve affiliate forwarding, add dashboard diagnostics and regression coverage, and document the shared runtime configuration.
… /health fetch static
This was referenced Oct 12, 2026
Merged
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.
Railway internal proxy addresses previously determined rate-limit buckets. Resolve edge-set X-Real-IP and accept CF-Connecting-IP only from Cloudflare networks. All limiter scopes share the resolver; ingest adds the API key public ID to isolate projects behind a NAT. Existing limits and affiliate feature flags remain unchanged.
Server-side dashboard requests now forward each visitor IP with the existing AFFILIATE_CLIENT_IP_FORWARD_SECRET. The shared API resolver validates the secret in constant time before accepting a single visitor IP, giving dashboard auth/API requests separate visitor buckets. Both dashboard fetch helpers and all direct API callers use the guarded fetch wrapper. Forwarding credentials are omitted in browsers and when unconfigured. Dashboard IP resolution never uses XFF; duplicated Cloudflare ranges have a parity test.
Opt-in diagnostics include the dashboard source while excluding secrets and authorization headers. Deployment, environment examples, and changelog describe the configuration.
Validation:
Postgres validation used a fresh isolated database initialized with Prisma db push, UTC, and the original migration seed rows because local Postgres 14 does not support the existing security_invoker migration. An initial run against an older local test schema failed for missing columns; the fresh-schema run passed.
Update existing ready PR #788 on fix/client-ip-resolution to develop. No MCP feature changes, limit reductions, merge, deployment, release, production data access, or affiliate disabling.