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

security: Rate limit GetAddr responses #7955

Merged
merged 26 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
969819f
Updates ADDR_RESPONSE_LIMIT_DENOMINATOR to 4
arya2 Nov 16, 2023
ba0cfc6
Moves logic getting a fraction of Zebra's peers to a method in the ad…
arya2 Nov 16, 2023
70e0cc1
Adds and uses CachedPeerAddrs struct in inbound service
arya2 Nov 16, 2023
81cf5a5
moves and documents constant
arya2 Nov 16, 2023
f28c529
fixes test
arya2 Nov 16, 2023
a82a404
Apply suggestions from code review
arya2 Nov 17, 2023
78234ba
updates docs
arya2 Nov 17, 2023
a5d6b25
renames sanitized_window method
arya2 Nov 17, 2023
a431e1b
renames CachedPeerAddrs to CachedPeerAddrResponse
arya2 Nov 17, 2023
66e1cfc
updates test
arya2 Nov 17, 2023
788c620
moves try_refresh to per request
arya2 Nov 17, 2023
29f3aed
Make unused sanitization method pub(crate)
teor2345 Nov 19, 2023
2032361
Apply suggestions from code review
arya2 Nov 20, 2023
f2c2968
moves CachedPeerAddrResponse to a module
arya2 Nov 20, 2023
2ee9a20
updates unit test
arya2 Nov 20, 2023
4d9bc0f
fixes unit test
arya2 Nov 20, 2023
7c35da6
removes unnecessary condition
arya2 Nov 20, 2023
cca2857
clears cached getaddr response if it can't refresh for over a minute …
arya2 Nov 20, 2023
7c84398
tests that inbound service gives out the same addresses for every Pee…
arya2 Nov 20, 2023
f72a52b
Applies suggestion from code review
arya2 Nov 20, 2023
5327d17
fixes doc link
arya2 Nov 20, 2023
1e3fb0e
renames constant
arya2 Nov 20, 2023
a4a8963
Fix docs on new constant
arya2 Nov 20, 2023
f902adb
applies suggestion from code review
arya2 Nov 20, 2023
120b6a5
uses longer cache expiry time
arya2 Nov 20, 2023
48f419e
Adds code comments
arya2 Nov 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixes doc link
  • Loading branch information
arya2 committed Nov 20, 2023
commit 5327d1771d28e42078ba04cfee7f5ec246e30f6a
2 changes: 1 addition & 1 deletion zebrad/src/components/inbound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ pub enum Setup {
/// a shared list of peer addresses used to periodically refresh the partial list.
///
/// Refreshed from the address book in `poll_ready` method
/// after [`INBOUND_CACHED_ADDRS_REFRESH_INTERVAL`].
/// after [`INBOUND_CACHED_ADDRS_REFRESH_INTERVAL`](cached_peer_addr_response::INBOUND_CACHED_ADDRS_REFRESH_INTERVAL).
cached_peer_addr_response: CachedPeerAddrResponse,

/// A `futures::Stream` that downloads and verifies gossiped blocks.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use super::*;

/// The maximum duration that a `CachedPeerAddrResponse` is considered fresh before the inbound service
/// should get new peer addresses from the address book to send as a `GetAddr` response.
const INBOUND_CACHED_ADDRS_REFRESH_INTERVAL: Duration = Duration::from_secs(10 * 60);
pub const INBOUND_CACHED_ADDRS_REFRESH_INTERVAL: Duration = Duration::from_secs(10 * 60);
teor2345 marked this conversation as resolved.
Show resolved Hide resolved

/// The maximum duration that a `CachedPeerAddrResponse` is considered fresh before the inbound service
teor2345 marked this conversation as resolved.
Show resolved Hide resolved
/// should get new peer addresses from the address book to send as a `GetAddr` response.
Expand Down
Loading