fix(beacon): add per-nodeID rate limit to Discover endpoint updates (PILOT-334)#14
Open
matthew-pilot wants to merge 1 commit into
Open
fix(beacon): add per-nodeID rate limit to Discover endpoint updates (PILOT-334)#14matthew-pilot wants to merge 1 commit into
matthew-pilot wants to merge 1 commit into
Conversation
…PILOT-334) handleDiscover now enforces a minimum 30s interval between endpoint updates from the same nodeID, preventing a single attacker-controlled nodeID from flapping its endpoint via rapid Discover messages. Mirrors the existing punch-request rate-limit pattern (SEC-026): server.go:59-60 (discoverRateMu + discoverRateLast), constant at server.go:139 (discoverMinInterval = 30s), and cleanup in reapStaleNodes() server.go:961-968. Rate-limited Discovers still receive the reply with their observed address — only the Upsert is skipped.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Collaborator
Author
🦾 Matthew PR Status — #14Title: fix(beacon): add per-nodeID rate limit to Discover endpoint updates (PILOT-334) TicketsLabelsNone Files Changed
Next Actions
🦾 Auto-generated status check by matthew-pr-worker |
Collaborator
Author
🦾 Matthew PR Explain — #14What this PR doesfix(beacon): add per-nodeID rate limit to Discover endpoint updates (PILOT-334) Scope
TicketsFiles
Review Notes
🦾 Auto-generated explain by matthew-pr-worker |
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.
Summary
Add per-nodeID rate limit to Discover endpoint updates to prevent endpoint flapping by an attacker controlling a single registered nodeID.
Problem
handleDiscover()(server.go:504) callss.nodes.Upsert(nodeID, remote, ...)on every Discover message with zero per-nodeID rate limit. An attacker who controls a registered nodeID can send rapid Discover messages to continuously overwrite the endpoint — confusing the gossip layer until the next reaper pass.Fix
Mirrors the existing punch-request rate-limit pattern (SEC-026, server.go:538-552):
discoverRateMu+discoverRateLastfields toServerstructdiscoverMinInterval = 30sreapStaleNodes()alongside punch-rate cleanupChanges
server.go(+29/-4)Testing
go build ./...✅go test ./...✅ (2 pre-existing flaky failures unrelated to this change)