/** * @fileoverview Vulnerability scanner - AST-based static analysis for security vulnerabilities * @module @nahisaho/musubix-security/analysis/vulnerability-scanner * @trace REQ-SEC-SCAN-001, REQ-SEC-SCAN-002, REQ-SEC-SCAN-003 * * NOTE: This scanner uses ts-morph for AST-based vulnerability detection, providing * higher accuracy than regex-only approaches by analyzing actual code structure * (template expressions, binary expressions, call expressions, etc.). * * A lightweight regex-only OWASP scanner also exists in @nahisaho/musubix-core at * packages/core/src/symbolic/security-scanner.ts for embedded use in the symbolic * reasoning pipeline. Both detect overlapping vulnerability categories (SQL injection, * XSS, command injection, SSRF, etc.) but use fundamentally different detection * approaches: this scanner walks the AST; the core scanner matches regex patterns. * This separation is intentional to preserve core's zero-dependency isolation. */ import type { SourceFile } from 'ts-morph'; import type { Vulnerability, ScanOptions, ScanResult } from '../types/index.js'; import { ASTParser } from '../infrastructure/ast-parser.js'; /** * Vulnerability detector interface */ interface VulnerabilityDetector { ruleId: string; detect(sourceFile: SourceFile, parser: ASTParser): Vulnerability[]; } /** * Reset vulnerability counter (for testing) */ export declare function resetVulnCounter(): void; /** * Vulnerability scanner */ export declare class VulnerabilityScanner { private parser; private fileScanner; private detectors; constructor(options?: { tsConfigPath?: string; }); /** * Scan a single file */ scanFile(filePath: string): Vulnerability[]; /** * Scan a directory */ scanDirectory(rootPath: string, options?: ScanOptions): Promise; /** * Add a custom detector */ addDetector(detector: VulnerabilityDetector): void; /** * Get list of rule IDs */ getRuleIds(): string[]; /** * Get number of rules */ getRuleCount(): number; } /** * Create a vulnerability scanner */ export declare function createVulnerabilityScanner(options?: { tsConfigPath?: string; }): VulnerabilityScanner; export {}; //# sourceMappingURL=vulnerability-scanner.d.ts.map