refactor(security): add typed suspicious-activity event

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-08-05 23:38:59 -04:00
parent 688afbe5a1
commit f4df769b3c
8 changed files with 176 additions and 16 deletions
@@ -14,6 +14,7 @@ use KTXC\Security\Event\AccessDeniedEvent;
use KTXC\Security\Event\AuthenticationFailedEvent;
use KTXC\Security\Event\BruteForceDetectedEvent;
use KTXC\Security\Event\RateLimitExceededEvent;
use KTXC\Security\Event\SuspiciousActivityEvent;
use KTXC\Service\FirewallService;
use KTXC\Service\FirewallRuleCache;
use KTXC\Service\FirewallRuleManager;
@@ -320,11 +321,9 @@ class FirewallServiceTest extends TestCase
&& $log->getMetadata()['detector'] === 'payload-signature';
}))
->willReturnArgument(0);
$event = \KTXC\Security\Event\SecurityEvent::create(
\KTXC\Security\Event\SecurityEvent::SUSPICIOUS_ACTIVITY,
'203.0.113.20',
null,
['detector' => 'payload-signature'],
$event = new SuspiciousActivityEvent(
ipAddress: '203.0.113.20',
detector: 'payload-signature',
tenantId: 'tenant-a',
requestPath: '/admin',
requestMethod: 'POST',