@aikidosec/firewall
Version:
Zen by Aikido is an embedded Web Application Firewall that autonomously protects Node.js apps against common and critical attacks
61 lines (60 loc) • 1.72 kB
TypeScript
type SinkCompressedTimings = {
averageInMS: number;
percentiles: Record<string, number>;
compressedAt: number;
};
type SinkStats = {
withoutContext: number;
total: number;
durations: number[];
compressedTimings: SinkCompressedTimings[];
interceptorThrewError: number;
attacksDetected: {
total: number;
blocked: number;
};
};
type SinkStatsWithoutTimings = Omit<SinkStats, "durations">;
export declare class InspectionStatistics {
private startedAt;
private stats;
private readonly maxPerfSamplesInMemory;
private readonly maxCompressedStatsInMemory;
private requests;
constructor({ maxPerfSamplesInMemory, maxCompressedStatsInMemory, }: {
maxPerfSamplesInMemory: number;
maxCompressedStatsInMemory: number;
});
hasCompressedStats(): boolean;
isEmpty(): boolean;
reset(): void;
getStats(): {
sinks: Record<string, SinkStatsWithoutTimings>;
startedAt: number;
requests: {
total: number;
aborted: number;
attacksDetected: {
total: number;
blocked: number;
};
};
};
private ensureSinkStats;
private compressPerfSamples;
interceptorThrewError(sink: string): void;
onDetectedAttack({ blocked }: {
blocked: boolean;
}): void;
onAbortedRequest(): void;
onRequest(): void;
onInspectedCall({ sink, blocked, attackDetected, durationInMs, withoutContext, }: {
sink: string;
durationInMs: number;
attackDetected: boolean;
blocked: boolean;
withoutContext: boolean;
}): void;
forceCompress(): void;
}
export {};