fix(eventstream): cap per-topic subscribers to prevent memory-DoS (PILOT-252)#6
fix(eventstream): cap per-topic subscribers to prevent memory-DoS (PILOT-252)#6matthew-pilot wants to merge 1 commit into
Conversation
…LOT-252) addSub appended subscribers to b.subs[topic] with no cap, allowing a peer with many keys to grow the slice without bound. Added maxSubsPerTopic=1000 constant and a length check in addSub (now returns bool). handleConn rejects over-cap subscriptions with a warning log and closes the connection; the deferred unsubscribe path is skipped because topic stays empty. The 1000-subscriber cap matches the existing publishRatePerSecond=100 generosity level and is far above realistic P2P overlay fan-out. Closes PILOT-252
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
🦾 Matthew PR Status — #6 fix(eventstream): cap per-topic subscribers to prevent memory-DoS (PILOT-252)Overview
Tickets🔗 PILOT-252 LabelsNone CI Summary2/2 passing (test ✅, codecov/patch ✅) — ALL GREEN 🟢 Files Changed
Next Actions
🦾 Auto-generated status check by matthew-pr-worker |
🦾 Matthew PR Explain — #6 PILOT-252What This PR DoesAdds a per-topic subscriber cap ( Change Analysis
Design Decisions
Testing
Risk AssessmentLow risk. The change is an additive guard — existing behavior is unchanged for subscribers within the cap. The only new behavior is rejection when the cap is exceeded, which is the desired outcome. Operator Review
🦾 Auto-generated explanation by matthew-pr-worker |
📊 PR Status: fix(eventstream): cap per-topic subscribers to prevent memory-DoS (PILOT-252)
|
🔍 PR Analysis: fix(eventstream): cap per-topic subscribers to prevent memory-DoS (PILOT-252)Branch: What This PR DoesThis PR implements a security/correctness fix based on the ticket reference in the title. The change modifies behavior to close a gap in the existing implementation. Key Changes
Risk Assessment
|
What failed
eventstream/service.go:261-264 addSub appended subscribers to b.subs[topic] with no cap. A peer with many keys can open multiple connections subscribing to the same topic, growing the subscriber slice without bound — a memory-DoS primitive.
What this PR changes
Verification
Closes PILOT-252