laravel-firewall icon indicating copy to clipboard operation
laravel-firewall copied to clipboard

Update BlockIp.php

Open OzanKurt opened this issue 1 year ago • 1 comments

The check has to be "less than" comparison instead of "not equals".

I was testing the firewall to see if it blocks:

  • first the attempts was 10
  • then I reloaded the page with a "blockable" content 6 times
  • then I reduced the attempts to 5

This caused the firewall to NOT block the IP.

Here is a before after comparison for the example above:

// before
if ($count != config('firewall.middleware.' . $event->log->middleware . '.auto_block.attempts')) {
    return;
}
// values
if (6 != 5) {
    return; // doesn't block the IP
}
// after
if ($count < config('firewall.middleware.' . $event->log->middleware . '.auto_block.attempts')) {
    return;
}
// values
if (6 < 5) {
    return; // blocks the IP
}

OzanKurt avatar Feb 13 '24 12:02 OzanKurt

Good idea 👍

thomascombe avatar Feb 13 '24 13:02 thomascombe

yeah, I mentioned that issue in #66, they made me remove it from the pr.

Carnicero90 avatar Apr 02 '24 11:04 Carnicero90