feat: make event state constructor-only and immutable
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -139,7 +139,6 @@ class FirewallService
|
||||
return;
|
||||
}
|
||||
|
||||
$event->setTenantId($tenantId);
|
||||
$log = $this->securityLog($event);
|
||||
if ($log === null || !$this->store->createLogOnce($log)) {
|
||||
return;
|
||||
@@ -195,8 +194,12 @@ class FirewallService
|
||||
int $blockDuration
|
||||
): void {
|
||||
// Publish brute force event
|
||||
$event = SecurityEvent::bruteForceDetected($ipAddress, $failureCount, $windowSeconds);
|
||||
$event->setTenantId($tenantId);
|
||||
$event = SecurityEvent::bruteForceDetected(
|
||||
$ipAddress,
|
||||
$failureCount,
|
||||
$windowSeconds,
|
||||
$tenantId,
|
||||
);
|
||||
$this->events->dispatch($event);
|
||||
|
||||
$this->rules->blockIp(
|
||||
@@ -308,9 +311,9 @@ class FirewallService
|
||||
$deviceFingerprint,
|
||||
$rule->getId(),
|
||||
$rule->getScope(),
|
||||
$rule->getReason()
|
||||
$rule->getReason(),
|
||||
$this->tenantContext->identifier(),
|
||||
);
|
||||
$event->setTenantId($this->tenantContext->identifier());
|
||||
$this->events->dispatch($event);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user