Skip to content

fix(sponsord-onramp): spread untracked clients over overflow windows - #3011

Merged
alpergundogdu merged 1 commit into
mainfrom
claude/onramp-overflow-windows
Nov 27, 2026
Merged

alpergundogdu merged 1 commit into
mainfrom
claude/onramp-overflow-windows

Conversation

@alpergundogdu

Copy link
Copy Markdown
Contributor

Refs #2851
Refs #2772

Covers these checklist items:

  • security review at b5e29ae: low-severity hardening items #2851 Onramp overflow window. Past MAX_TRACKED distinct clients, each further client counts in one of 1,024 overflow windows, picked by a RandomState (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/capability and /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.
  • security review at b5e29ae: low-severity hardening items #2851 Onramp without ConnectInfo. docs/sponsord/integrator.md now serves the router with into_make_service_with_connect_info::<SocketAddr>(), as main.rs does, 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::Peer with no ConnectInfo).
  • onramp/gateway: web-facing pages lack framing and cross-site spend protections #2772 §3 nginx. deploy/sponsord/sponsord-onramp.env.example names the proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; directive nginx needs to append the address.

docs/sponsord/operator.md describes 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-features clean.

🤖 Generated with Claude Code

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]>
@github-code-quality

Copy link
Copy Markdown

Code coverage overview

Languages: Rust

Rust / code-coverage/cargo-llvm-cov

main 4c4801f claude/onramp-overfl... a0a5c19 +/-
78% 78% 0%
View coverage of the 4 most impacted files.
File main 4c4801f claude/onramp-overfl... a0a5c19 +/-
crates/protocol/src/framing.rs 93% 92% -1%
crates/client/src/lib.rs 89% 89% 0%
crates/sponsord...ramp/src/net.rs 100% 100% 0%
crates/node/src/dht/publish.rs 77% 79% +2%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.

@alpergundogdu
alpergundogdu merged commit 26ddd6a into main Nov 27, 2026
36 checks passed
@alpergundogdu
alpergundogdu deleted the claude/onramp-overflow-windows branch November 27, 2026 10:04
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.

1 participant