/** * Inter-procedural Taint Analysis * * Tracks taint flow through method calls within the same file. * - Propagates taint from arguments to parameters * - Tracks taint through return values * - Handles method call chains */ import type { CallInfo, TypeInfo, DFG, TaintSource, TaintSink, TaintSanitizer } from '../types/index.js'; import { CodeGraph } from '../graph/index.js'; /** * Represents a method in the call graph. */ export interface MethodNode { /** Simple method name */ name: string; /** Fully qualified name: ClassName.methodName */ fqn: string; /** Class/type this method belongs to */ className: string | null; /** Package name if available */ packageName: string | null; parameters: ParameterTaint[]; returnsTainted: boolean; returnTaintType: string | null; /** Which parameter positions flow to the return value (null = all potentially taint) */ returnTaintedFromParams: number[] | null; startLine: number; endLine: number; } /** * Parameter taint information. */ export interface ParameterTaint { name: string; position: number; isTainted: boolean; taintType: string | null; sourceLine: number | null; } /** * A call edge in the call graph. */ export interface CallEdge { callerMethod: string; calleeMethod: string; callLine: number; taintedArgs: number[]; } /** * Result of inter-procedural analysis. */ export interface InterproceduralResult { methodNodes: Map; callEdges: CallEdge[]; taintedMethods: Set; taintedReturns: Map; propagatedSinks: TaintSink[]; } /** * Options for interprocedural analysis. */ export interface InterproceduralOptions { /** Variables marked as tainted by constant propagation (e.g., collections with tainted elements) */ taintedVariables?: Set; } /** * Perform inter-procedural taint analysis. * * Accepts either a CodeGraph (preferred) or the legacy (types, calls, dfg, ...) * signature for backward compatibility. */ export declare function analyzeInterprocedural(graphOrTypes: CodeGraph | TypeInfo[], callsOrSources: CallInfo[] | TaintSource[], dfgOrSinks: DFG | TaintSink[], sourcesOrSanitizers: TaintSource[] | TaintSanitizer[], sinksOrOptions?: TaintSink[] | InterproceduralOptions, sanitizersArg?: TaintSanitizer[], optionsArg?: InterproceduralOptions): InterproceduralResult; /** * Get summary of inter-procedural analysis. */ export declare function getInterproceduralSummary(result: InterproceduralResult): { totalMethods: number; taintedMethods: number; callEdges: number; methodsReturningTaint: number; }; /** * Check if a method exists in the interprocedural result. * Accepts either simple name or FQN. */ export declare function hasMethod(result: InterproceduralResult, nameOrFqn: string): boolean; /** * Get a method node by simple name or FQN. */ export declare function getMethod(result: InterproceduralResult, nameOrFqn: string): MethodNode | undefined; /** * Check if a method is tainted (by simple name or FQN). */ export declare function isMethodTainted(result: InterproceduralResult, nameOrFqn: string): boolean; /** * Find methods that act as "taint bridges" - receiving taint and passing it on. */ export declare function findTaintBridges(result: InterproceduralResult): string[]; /** * Get taint flow paths through methods. */ export declare function getMethodTaintPaths(result: InterproceduralResult, maxDepth?: number): string[][]; //# sourceMappingURL=interprocedural.d.ts.map