Adjust session history

Signed-off-by: Artem Savchenko <armisav@gmail.com>
This commit is contained in:
Artem Savchenko
2026-05-28 11:22:03 +07:00
parent 23f9866ac5
commit edfccfc341
24 changed files with 545 additions and 86 deletions
+6 -2
View File
@@ -35,7 +35,9 @@ export class NoopPolicyEngine implements SecurityPolicyEngine {
const { event, recentHistory } = input
const anomalyCodes = new Set<string>()
const sameIpFailures = recentHistory.filter((entry) => !entry.success && entry.ip != null && event.ip != null && entry.ip === event.ip)
const sameIpFailures = recentHistory.filter(
(entry) => !entry.success && entry.ip != null && event.ip != null && entry.ip === event.ip
)
if (!event.success && sameIpFailures.length >= 4) {
anomalyCodes.add('repeated_failed_attempts_from_ip')
}
@@ -129,7 +131,9 @@ export async function resolveSecurityPolicyEngine (ctx: MeasureContext): Promise
| undefined
if (typeof createEngine !== 'function') {
ctx.warn('SECURITY_POLICY_MODULE loaded but createSecurityPolicyEngine is missing, fallback to noop', { moduleName })
ctx.warn('SECURITY_POLICY_MODULE loaded but createSecurityPolicyEngine is missing, fallback to noop', {
moduleName
})
cachedPolicyEngine = new NoopPolicyEngine()
return cachedPolicyEngine
}