/** * ═══════════════════════════════════════════════════════════════════════════════ * PROMPTSPEAK SECURITY AUDIT LOG * ═══════════════════════════════════════════════════════════════════════════════ * * Security audit logging for forensics and anomaly detection. * Logs all symbol operations, security violations, and access patterns. * * ═══════════════════════════════════════════════════════════════════════════════ */ import type { InjectionViolation, FullValidationResult } from './sanitizer.js'; export type AuditEventType = 'SYMBOL_CREATE' | 'SYMBOL_CREATE_BLOCKED' | 'SYMBOL_UPDATE' | 'SYMBOL_UPDATE_BLOCKED' | 'SYMBOL_DELETE' | 'SYMBOL_ACCESS' | 'SYMBOL_FORMAT' | 'VALIDATION_WARNING' | 'INJECTION_ATTEMPT' | 'SECURITY_ALERT'; export interface AuditEntry { timestamp: string; eventType: AuditEventType; symbolId?: string; details: Record; violations?: InjectionViolation[]; riskScore?: number; sourceIp?: string; userId?: string; } export interface AuditStats { totalEvents: number; eventsByType: Record; blockedAttempts: number; injectionAttempts: number; symbolAccessCount: number; highRiskEvents: number; lastEventTime?: string; } export declare class AuditLogger { private logPath; private writeCount; private stats; constructor(logsDir: string); private log; /** * Log symbol creation */ logCreate(symbolId: string, success: boolean, validation?: FullValidationResult, details?: Record): void; /** * Log symbol update */ logUpdate(symbolId: string, success: boolean, validation?: FullValidationResult, details?: Record): void; /** * Log symbol deletion */ logDelete(symbolId: string, reason: string): void; /** * Log symbol access (read) */ logAccess(symbolId: string, found: boolean, format?: string): void; /** * Log injection attempt */ logInjectionAttempt(symbolId: string, violations: InjectionViolation[], riskScore: number, blocked: boolean): void; /** * Log validation warning (non-blocking) */ logValidationWarning(symbolId: string, violations: InjectionViolation[], riskScore: number): void; /** * Log security alert */ logSecurityAlert(message: string, details: Record): void; /** * Log a security-related event with risk assessment */ logSecurityEvent(eventType: string, riskScore: number, details: object): void; /** * Query audit log entries with filtering options */ query(options: { symbolId?: string; eventType?: string; since?: Date; limit?: number; }): AuditEntry[]; private checkRotation; private rotateLog; /** * Get current audit statistics */ getStats(): AuditStats; /** * Read recent audit entries */ getRecentEntries(limit?: number): AuditEntry[]; /** * Get entries for a specific symbol */ getEntriesForSymbol(symbolId: string): AuditEntry[]; /** * Get all injection attempts */ getInjectionAttempts(): AuditEntry[]; } export declare function initializeAuditLogger(logsDir: string): AuditLogger; export declare function getAuditLogger(): AuditLogger | null; //# sourceMappingURL=audit.d.ts.map