Skip to content

Commit

Permalink
fix: pass ip version to blocklist check to ensure ipv6 accepted
Browse files Browse the repository at this point in the history
  • Loading branch information
Jafferwaffer committed Aug 1, 2024
1 parent de5d554 commit 33a27bf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ const getMiddleware = () => (req, res, next) => {
|| req.socket.remoteAddress || req.connection.socket.remoteAddress;

// Only expect private IPs from this range
if (!blocklist.check(requestingIP)) {
const ipVerion = net.isIPv6(requestingIP) ? 'ipv6' : 'ipv4';

if (!blocklist.check(requestingIP, ipVerion)) {
// eslint-disable-next-line no-console
console.debug(`Blocking request from ${requestingIP}`);

Expand Down

0 comments on commit 33a27bf

Please sign in to comment.