@aikidosec/firewall
Version:
Zen by Aikido is an embedded Application Firewall that autonomously protects Node.js apps against common and critical attacks, provides rate limiting, detects malicious traffic (including bots), and more.
86 lines (85 loc) • 2.6 kB
TypeScript
import { OperationKind } from "./api/Event";
type OperationCompressedTimings = {
averageInMS: number;
percentiles: Record<string, number>;
compressedAt: number;
};
type OperationStats = {
kind: OperationKind;
withoutContext: number;
total: number;
durations: number[];
compressedTimings: OperationCompressedTimings[];
interceptorThrewError: number;
attacksDetected: {
total: number;
blocked: number;
};
};
type OperationStatsWithoutTimings = Omit<OperationStats, "durations">;
type UserAgentBotKey = string;
type IPListKey = string;
export declare class InspectionStatistics {
private startedAt;
private operations;
private readonly maxPerfSamplesInMemory;
private readonly maxCompressedStatsInMemory;
private sqlTokenizationFailures;
private requests;
private userAgents;
private ipAddresses;
constructor({ maxPerfSamplesInMemory, maxCompressedStatsInMemory, }: {
maxPerfSamplesInMemory: number;
maxCompressedStatsInMemory: number;
});
hasCompressedStats(): boolean;
isEmpty(): boolean;
reset(): void;
getStats(): {
operations: Record<string, OperationStatsWithoutTimings>;
startedAt: number;
sqlTokenizationFailures: number;
requests: {
total: number;
aborted: number;
rateLimited: number;
attacksDetected: {
total: number;
blocked: number;
};
attackWaves: {
total: number;
blocked: number;
};
};
userAgents: {
breakdown: Record<string, number>;
};
ipAddresses: {
breakdown: Record<string, number>;
};
};
private ensureOperationStats;
private compressPerfSamples;
interceptorThrewError(operation: string, kind: OperationKind): void;
onDetectedAttack({ blocked }: {
blocked: boolean;
}): void;
onIPAddressMatches(matches: IPListKey[]): void;
onUserAgentMatches(matches: UserAgentBotKey[]): void;
onAbortedRequest(): void;
onRequest(): void;
onRateLimitedRequest(): void;
onAttackWaveDetected(): void;
onInspectedCall({ operation, kind, blocked, attackDetected, durationInMs, withoutContext, }: {
operation: string;
kind: OperationKind;
durationInMs: number;
attackDetected: boolean;
blocked: boolean;
withoutContext: boolean;
}): void;
forceCompress(): void;
onSqlTokenizationFailure(): void;
}
export {};