Repository navigation
fix(sponsord-onramp): spread untracked clients over overflow windows - #3011
Merged
Merged
Conversation
Past MAX_TRACKED distinct clients, each further client counts in one of 1,024 overflow windows picked by a per-process keyed hash, so a flood of addresses spends only the windows it lands in instead of 429ing every untracked client. A request with no peer address and no client-IP header logs a one-time warning, and the integrator guide serves the router with ConnectInfo. The env example names the nginx directive that appends X-Forwarded-For. Refs #2851 Refs #2772 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 26, 2026
Code coverage overviewLanguages: Rust Rust / code-coverage/cargo-llvm-cov
View coverage of the 4 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. |
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.
Refs #2851
Refs #2772
Covers these checklist items:
MAX_TRACKEDdistinct clients, each further client counts in one of 1,024 overflow windows, picked by aRandomState(SipHash, random key per process) hash of the client, so a sender cannot aim addresses at one window. A flood of addresses spends only the windows it lands in, not every untracked client's budget on/v1/capabilityand/v1/fund. Memory stays bounded (16 KiB of windows). New test: with the map full, two untracked clients in different windows keep separate budgets; the existing test now checks that clients in the same window share one.docs/sponsord/integrator.mdnow serves the router withinto_make_service_with_connect_info::<SocketAddr>(), asmain.rsdoes, and says what happens without it. The library cannot see at startup how the embedder serves the router, so it warns once, at the first request that has neither a peer address nor a configured client-IP header (ClientIpSource::Peerwith noConnectInfo).deploy/sponsord/sponsord-onramp.env.examplenames theproxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;directive nginx needs to append the address.docs/sponsord/operator.mddescribes the overflow windows.No HTTP API change.
Tested:
cargo nextest run -p sponsord-onramp -p sponsord-e2e(66 passed),cargo clippy --workspace --all-targets --all-featuresclean.🤖 Generated with Claude Code