Skip to content

Handle installSnapshot decodePeers error without a panic#465

Merged
dnephin merged 1 commit into
mainfrom
dnephin/fix-panic-in-decodePeers
May 4, 2021
Merged

Handle installSnapshot decodePeers error without a panic#465
dnephin merged 1 commit into
mainfrom
dnephin/fix-panic-in-decodePeers

Conversation

@dnephin
Copy link
Copy Markdown
Contributor

@dnephin dnephin commented Apr 30, 2021

decodePeers can be called by the installSnapshot RPC handler, which means that a panic can be caused by an external actor by sending malformed input. Instead handle the error and report it back via the RPC response. This prevents a panic and removes the possibility of an external actor being able to cause a raft peer to panic.

The new test would cause a panic before, and now it confirms the expected error is returned.

Copy link
Copy Markdown
Contributor

@banks banks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for fixing this up.

Comment thread raft_test.go Outdated
decodePeers can be called by the installSnapshot RPC handler, which means that a panic
could be caused by an external actor by sending malformed input. Instead handle the
error and report it back via the RPC response.
@dnephin dnephin force-pushed the dnephin/fix-panic-in-decodePeers branch from 5eed31b to e59f65d Compare May 4, 2021 17:51
@dnephin dnephin merged commit cfb599d into main May 4, 2021
@dnephin dnephin deleted the dnephin/fix-panic-in-decodePeers branch May 4, 2021 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants