fix: bound remote pubsub subscriptions to prevent memory exhaustion - #1350
fix: bound remote pubsub subscriptions to prevent memory exhaustion#1350acul71 wants to merge 5 commits into
Conversation
Status update — GHSA-4f8r-922h-2vgv / #1349cc @seetadev @sumanjeet0012 for review — this addresses the GossipSub subscription-flood memory exhaustion pattern reported across the libp2p ecosystem (js GHSA-4f8r-922h-2vgv, go go-libp2p-pubsub#710, cpp cpp-libp2p#349). What’s been accomplishedCore mitigations (shared
Tests —
CI — What’s still missing / out of scope for this PR
Ecosystem parity (rough)
Happy to adjust default limits, add scorer penalties, or scope a follow-up PoC test if maintainers prefer. Thanks for any guidance. |
Fix GHSA-4f8r-922h-2vgv by enforcing inbound RPC size and subscription limits, tracking per-peer subscription counts, and deleting empty topic entries from peer_topics on unsubscribe and disconnect. Fixes #1349 Co-authored-by: Cursor <cursoragent@cursor.com>
Clear peer_topics on Pubsub shutdown, add optional allowed_topics filter, and expand regression tests for dead-peer teardown, blacklist cleanup, RPC boundary cases, and idempotent resubscribe. Co-authored-by: Cursor <cursoragent@cursor.com>
Use main's forget helpers, assert oversize peer teardown, and replace fixed sleeps with condition waits for more reliable CI. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Empty topic map entries are now deleted by _forget_*; update assertions to use .get() / key absence instead of indexing removed topics. Co-authored-by: Cursor <cursoragent@cursor.com>
2034748 to
957fa6a
Compare
Status update — rebased onto
|
Summary
peer_topicsentries on unsubscribe and peer removal (disconnect / blacklist).Fixes #1349
Related
Test plan
pytest tests/core/pubsub/test_pubsub_subscription_limits.py -vpytest tests/core/pubsub/test_pubsub.py::test_handle_subscription -vpytest tests/core/pubsub/test_pubsub.py::test_peers_subscribe -vmake lint && make typecheck && make test && make linux-docsMade with Cursor