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

fix(net): prevent panicking when finding an unknown HTTP status code #2394

Merged
merged 2 commits into from
Sep 21, 2023

Conversation

aesedepece
Copy link
Member

This prevents a potential DoS attack to where witnessing nodes could be forced into a temporal desynchronization state and slashing could be triggered on them on purpose.

@aesedepece
Copy link
Member Author

Thanks @guidiaz for discovering this security bug! 💪

@aesedepece aesedepece added bug 🐜 Something isn't working security 🛡️ Changes that affect software security for the good or the bad liveness ⚡️ Affects the availability or throughput of the network labels Sep 12, 2023
@aesedepece aesedepece force-pushed the fix/net/http-status-codes branch 2 times, most recently from 2674a40 to 6a0528a Compare September 12, 2023 15:53
let mut res = surf::http::Response::new(status);
let code = status.status.as_u16();
let mut res =
std::panic::catch_unwind(|| surf::http::Response::new(status)).map_err(|_| {
Copy link
Member

Choose a reason for hiding this comment

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

Could we add a comment explaining that we need to use catch_unwind because the surf library panics instead of returning a Result?

@aesedepece aesedepece merged commit 672e22d into witnet:master Sep 21, 2023
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐜 Something isn't working liveness ⚡️ Affects the availability or throughput of the network security 🛡️ Changes that affect software security for the good or the bad
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants