/** * Path Finder - Enumerate all taint paths from sources to sinks * * Provides detailed flow visualization showing exactly how taint propagates * through variable assignments, method calls, and returns. */ import type { DFG, CallInfo, TaintSource, TaintSink, TaintSanitizer, SourceType, SinkType } from '../types/index.js'; import { CodeGraph } from '../graph/index.js'; /** * A single hop in the taint path */ export interface TaintHop { line: number; column?: number; variable: string; operation: 'source' | 'assign' | 'call_arg' | 'call_return' | 'field_read' | 'field_write' | 'array_access' | 'sink'; code?: string; description: string; } /** * Complete taint path from source to sink */ export interface TaintPath { id: string; source: { line: number; type: SourceType; variable: string; code?: string; }; sink: { line: number; type: SinkType; method: string; code?: string; }; hops: TaintHop[]; sanitized: boolean; sanitizer?: { line: number; method: string; }; confidence: number; length: number; } /** * Result of path finding analysis */ export interface PathFinderResult { paths: TaintPath[]; summary: { totalPaths: number; sanitizedPaths: number; vulnerablePaths: number; avgPathLength: number; maxPathLength: number; }; } /** * Configuration for path finding */ export interface PathFinderConfig { maxPathLength?: number; maxPathsPerSink?: number; includeCode?: boolean; sourceLines?: string[]; } /** * PathFinder - Enumerate taint paths through the DFG */ export declare class PathFinder { private graph; private sources; private sinks; private sanitizers; private config; private sanitizerLines; constructor(graphOrDfg: CodeGraph | DFG, callsOrSources: CallInfo[] | TaintSource[], sourcesOrSinks: TaintSource[] | TaintSink[], sinksOrSanitizers: TaintSink[] | TaintSanitizer[], sanitizersOrConfig?: TaintSanitizer[] | PathFinderConfig, config?: PathFinderConfig); /** * Find all taint paths from sources to sinks */ findAllPaths(): PathFinderResult; /** * Find all paths from a specific source */ private findPathsFromSource; /** * Check if a definition reaches a sink */ private reachesSink; /** * Create a hop description between two definitions */ private createHop; /** * Calculate confidence based on path characteristics */ private calculateConfidence; /** * Get source code at a specific line */ private getCodeAtLine; /** * Find paths to a specific sink */ findPathsToSink(sinkLine: number): TaintPath[]; /** * Find paths from a specific source */ findPathsFromSourceLine(sourceLine: number): TaintPath[]; /** * Get a summary of paths grouped by sink type */ getPathsBySinkType(): Map; } /** * Convenience function to find all paths */ export declare function findTaintPaths(dfg: DFG, calls: CallInfo[], sources: TaintSource[], sinks: TaintSink[], sanitizers?: TaintSanitizer[], config?: PathFinderConfig): PathFinderResult; /** * Format a taint path for display */ export declare function formatTaintPath(path: TaintPath): string; //# sourceMappingURL=path-finder.d.ts.map