fix: prevent stale peer removal in PeerRemovalQueue - #132
Open
synackd wants to merge 1 commit into
Open
Conversation
synackd
force-pushed
the
pr/a-peer-removal-queue-fix
branch
2 times, most recently
from
August 31, 2026 16:28
b5b15fe to
2394366
Compare
Resolve a race condition in the PeerRemovalQueue where a removal job could be processed after a node had reconnected and its public key changed. The queue now stores the peer's public key at enqueue time and validates it against the current key before invoking RemovePeer. If the keys differ, the stale removal is skipped and a warning is logged. Added a new removalJob struct to carry the key, updated the queue logic, and introduced comprehensive unit tests (TestPeerRemovalQueueStaleRemovalSkipped and TestPeerRemovalQueueConcurrentEnqueue) to verify correct behavior. This improves reliability of WireGuard peer management during rapid reconnect scenarios. Signed-off-by: Devon Bautista <17506592+synackd@users.noreply.github.com>
synackd
force-pushed
the
pr/a-peer-removal-queue-fix
branch
from
August 31, 2026 16:30
2394366 to
43fdabf
Compare
15 tasks
synackd
marked this pull request as ready for review
August 31, 2026 16:42
17 tasks
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.
Description
This PR addresses a race condition in the
PeerRemovalQueuewhere a removal job could be processed after a node had re‑connected and its public key changed. The queue now stores the peer's public key at enqueue time and validates it against the current key before invokingRemovePeer. If the keys differ, the stale removal is skipped and a warning is logged. Added a newremovalJobstruct to carry the key, updated the queue logic, and introduced comprehensive unit tests (TestPeerRemovalQueueStaleRemovalSkippedandTestPeerRemovalQueueConcurrentEnqueue) to verify correct behavior. This improves reliability of WireGuard peer management during rapid reconnect scenarios.Fixes #128 (comment)
Checklist
make test(or equivalent) locally and all tests passgit commit -s) with my real name and email<filename>.licensesidecarLICENSES/directoryType of Change