Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Reject blacklist peer in handshake of SCServer
Browse files Browse the repository at this point in the history
  • Loading branch information
ishantiw committed Oct 24, 2019
1 parent 730c1ec commit 878a621
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions elements/lisk-p2p/src/p2p.ts
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,21 @@ export class P2P extends EventEmitter {

return;
}
// Check blacklist to avoid incoming connections from backlisted ips
if (this._sanitizedPeerLists.blacklistedPeers) {
const blacklist = this._sanitizedPeerLists.blacklistedPeers.map(
peer => peer.ipAddress,
);
if (blacklist.includes(socket.remoteAddress)) {
this._disconnectSocketDueToFailedHandshake(
socket,
FORBIDDEN_CONNECTION,
FORBIDDEN_CONNECTION_REASON,
);

return;
}
}
},
);
this._scServer.on(
Expand Down

0 comments on commit 878a621

Please sign in to comment.