/** * Common Scanner Utilities * * Shared functionality across security scanner implementations * to reduce code duplication and centralize security-critical logic. */ import type { Logger } from 'pino'; import { type Result } from '../../types/index.js'; /** * Common error messages and guidance for scanner implementations */ export declare const ScannerErrors: { /** * Create invalid imageId error */ invalidImageId: (imageId: string) => Result; /** * Create scanner not installed error */ scannerNotInstalled: (scannerName: string, installUrl: string) => Result; /** * Create JSON parse error */ jsonParseError: (scannerName: string, parseError: string, outputPreview: string) => Result; /** * Create empty output error */ emptyOutput: (scannerName: string, imageId: string) => Result; /** * Create scan execution error */ scanExecutionError: (scannerName: string, imageId: string, errorMessage: string) => Result; /** * Create version check timeout error */ versionCheckTimeout: (scannerName: string, command: string) => Result; /** * Create version parse error */ versionParseError: (scannerName: string, command: string) => Result; }; /** * Validate imageId against allowlist pattern to prevent command injection * Allows: alphanumeric, dots, colons, slashes, at-signs, underscores, and hyphens */ export declare function validateImageId(imageId: string): boolean; /** * Standardized severity type */ export type StandardSeverity = 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL' | 'NEGLIGIBLE' | 'UNKNOWN'; /** * Normalize severity string to our standard format * Handles various case formats (UPPERCASE, lowercase, TitleCase) */ export declare function normalizeSeverity(severity: string): StandardSeverity; /** * Severity counter helper */ export declare class SeverityCounter { critical: number; high: number; medium: number; low: number; negligible: number; unknown: number; increment(severity: StandardSeverity): void; get total(): number; getCounts(): { criticalCount: number; highCount: number; mediumCount: number; lowCount: number; negligibleCount: number; unknownCount: number; totalVulnerabilities: number; }; } /** * Parse version from scanner output using a regex pattern */ export declare function parseVersion(output: string, pattern: RegExp): string | undefined; /** * Log scanner information */ export declare function logScanStart(logger: Logger, scanner: string, version: string, imageId: string): void; /** * Log scan completion */ export declare function logScanComplete(logger: Logger, scanner: string, imageId: string, totalVulnerabilities: number, criticalCount: number, highCount: number): void; //# sourceMappingURL=scanner-common.d.ts.map