mirror of
https://github.com/farcasterxyz/hub-monorepo.git
synced 2026-04-18 03:00:22 -04:00
Prevent connecting to peers not in allowed peer list (#1102)
We needed to add some additional logic to ensure we didn't connect to peers not in the allowlist.
This commit is contained in:
5
.changeset/angry-lizards-hammer.md
Normal file
5
.changeset/angry-lizards-hammer.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@farcaster/hubble": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Prevent connecting to peers not in allowed peer list
|
||||||
@@ -946,6 +946,12 @@ export class Hub implements HubInterface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async isValidPeer(ourPeerId: PeerId, message: ContactInfoContent) {
|
async isValidPeer(ourPeerId: PeerId, message: ContactInfoContent) {
|
||||||
|
const peerId = ourPeerId.toString();
|
||||||
|
if (MAINNET_ALLOWED_PEERS?.length && !MAINNET_ALLOWED_PEERS.includes(peerId)) {
|
||||||
|
log.warn(`Peer ${ourPeerId.toString()} is not in the allowed peers list`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const theirVersion = message.hubVersion;
|
const theirVersion = message.hubVersion;
|
||||||
const theirNetwork = message.network;
|
const theirNetwork = message.network;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user