libp2p / libp2p/jvm-libp2p

Refine DoS protection and other security/performance concerns

Open
#449 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

partial-messages
Dominant language
Kotlin
Stars
366
Forks
85
Avg merge
2d 39m
Merged PRs (30d)
6

Description

Implements the per-group lifecycle and DoS protection (Step 8 of #435, plus caps referenced from #446).

Scope

DoS caps on peer-initiated groups (match go-libp2p defaults)
  • peerInitiatedGroupLimitPerTopic = 255 (across all peers, per topic).
  • peerInitiatedGroupLimitPerTopicPerPeer = 8 (per (topic, peer)).
  • Over-cap behaviour: log and drop the RPC. No disconnect. No score penalty (match go-libp2p; revise if spec adds guidance).
TTL + heartbeat GC
  • GroupState.ttlInHeartbeats, default minimum 3.
  • Decrement each heartbeat; GC on ttl == 0 or peerStates empty.
  • Reset TTL on any publishPartial(topic, groupId, …) call for the group.
Cleanup hooks
  • Peer disconnect → remove peerStates[peer] entries across all groups.
  • Local unsubscribe from a topic → drop all group state for that topic.
Performance / safety
  • GroupState must be a plain HashMap (not thread-safe), accessed only on the pubsub event loop. Do NOT use ConcurrentHashMap (PR #433 had this wrong).
  • Limits exposed on GossipParams or the handler config.

Reference

Design: docs/partial-messages.md §6 (lands with the first PR on #435).
go-libp2p: partialmsgs.go:255 (heartbeat), :335-348 (peer-initiated cap).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with docs/partial-messages.md §6 and the partial-message implementation around GroupState, publishPartial, heartbeat, peer disconnect, and unsubscribe handling. Compare the limits and heartbeat behavior with go-libp2p's partialmsgs.go:255 and :335-348; done means the caps, TTL garbage collection, cleanup hooks, and event-loop-only HashMap access are implemented and tested.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
networking, performance, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.