Skip to content

Commit 96410fb

Browse files
author
Filippo Montani
committed
addressing attempts count issue
1 parent 0509810 commit 96410fb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Listeners/BlockIp.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ public function handle(AttackDetected $event)
2222
$start = $end->copy()->subSeconds(config('firewall.middleware.' . $event->log->middleware . '.auto_block.frequency'));
2323

2424
$log = config('firewall.models.log', Log::class);
25-
$count = $log::where('ip', $event->log->ip)->whereBetween('created_at', [$start, $end])->count();
25+
$count = $log::where('ip', $event->log->ip)
26+
->where('middleware', $event->log->middleware)
27+
->whereBetween('created_at', [$start, $end])->count();
2628

27-
if ($count != config('firewall.middleware.' . $event->log->middleware . '.auto_block.attempts')) {
29+
if ($count < config('firewall.middleware.' . $event->log->middleware . '.auto_block.attempts')) {
2830
return;
2931
}
3032

0 commit comments

Comments
 (0)