Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle installSnapshot decodePeers error without a panic #465

Merged
merged 1 commit into from
May 4, 2021

Conversation

dnephin
Copy link
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
Member

@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.

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