/** * Taint Analysis Module for JavaScript/TypeScript * Tracks data flow from untrusted sources to dangerous sinks * * Inspired by CodeQL's taint tracking methodology */ import { Severity, ThreatType, SecurityStandard } from '../../types'; /** * Represents a taint source - where untrusted data enters */ export interface TaintSource { /** Source type identifier */ type: string; /** Pattern to match the source */ pattern: RegExp; /** Description of the source */ description: string; /** Variable capture group index in regex */ captureGroup?: number; /** Context hints for better detection */ contextHints?: string[]; } /** * Represents a taint sink - dangerous operations */ export interface TaintSink { /** Sink type identifier */ type: string; /** Pattern to match the sink */ pattern: RegExp; /** Threat type this sink can cause */ threatType: ThreatType; /** Severity level */ severity: Severity; /** Description of the vulnerability */ description: string; /** CWE/OWASP references */ standards?: SecurityStandard[]; /** Remediation advice */ remediation: string; } /** * Represents a taint flow from source to sink */ export interface TaintFlow { /** The source of tainted data */ source: { type: string; variable: string; line: number; code: string; }; /** The sink where tainted data is used */ sink: { type: string; line: number; code: string; threatType: ThreatType; severity: Severity; }; /** Intermediate steps (if any) */ propagation: { variable: string; line: number; code: string; }[]; /** Confidence score 0-100 */ confidence: number; } /** * Taint sources - entry points for untrusted data */ export declare const TAINT_SOURCES: TaintSource[]; /** * Taint sinks - dangerous operations */ export declare const TAINT_SINKS: TaintSink[]; /** * Taint Analyzer Class * Performs intra-procedural taint analysis for JavaScript/TypeScript */ export declare class TaintAnalyzer { private taintedVariables; private lines; private filePath; /** * Analyze code for taint flows */ analyze(content: string, filePath: string): TaintFlow[]; /** * Phase 1: Identify all taint sources in the code */ private identifySources; /** * Phase 2: Track taint propagation through assignments */ private trackPropagation; /** * Phase 3: Check if tainted data reaches sinks */ private checkSinks; /** * Calculate confidence score for a taint flow */ private calculateConfidence; /** * Remove duplicate flows */ private deduplicateFlows; /** * Get human-readable description for a source type */ static getSourceDescription(sourceType: string): string; /** * Get sink information */ static getSinkInfo(sinkType: string): TaintSink | undefined; } export default TaintAnalyzer; //# sourceMappingURL=taintAnalyzer.d.ts.map