/** * Constant Propagation Engine * * Tracks constant values through variable assignments and evaluates expressions * to detect dead code and reduce false positives in taint analysis. * * @module constant-propagation */ import type { Tree } from 'web-tree-sitter'; import type { ConstantPropagatorResult, ConstantPropagationOptions } from './types.js'; export type { ConstantType, ConstantValue, ConstantPropagatorResult, ConstantPropagationOptions, TaintedParameter } from './types.js'; export { isKnown, createUnknown, createConstant, getNodeText, getNodeLine } from './ast-utils.js'; export { TAINT_PATTERNS, TAINT_PATTERN_REGEX, SANITIZER_METHODS, PROPAGATOR_METHODS } from './patterns.js'; export { ExpressionEvaluator } from './evaluator.js'; export { ConstantPropagator } from './propagator.js'; /** * Analyze source code for constant propagation. * * @param tree - Parsed AST from tree-sitter * @param sourceCode - Original source code * @param options - Analysis options * @returns Constant propagation result with symbols, tainted vars, and unreachable lines */ export declare function analyzeConstantPropagation(tree: Tree, sourceCode: string, options?: ConstantPropagationOptions): ConstantPropagatorResult; /** * Check if a potential vulnerability is a false positive. * * @param result - Constant propagation result * @param sinkLine - Line number of the sink * @param taintedVar - Name of the potentially tainted variable * @returns Object indicating if it's a false positive and the reason */ export declare function isFalsePositive(result: ConstantPropagatorResult, sinkLine: number, taintedVar: string): { isFalsePositive: boolean; reason: string | null; }; /** * Check if a taint flow is a false positive due to correlated predicates. * * This handles cases like: * if(choice) { x = tainted; } * if(!choice) { sink(x); } * * The taint of x only applies when choice=true, but the sink only executes * when choice=false. These are mutually exclusive paths, so no vulnerability. * * @param result - Constant propagation result with conditional taint info * @param flow - The taint flow to check * @returns true if this is a false positive due to correlated predicates */ export declare function isCorrelatedPredicateFP(result: ConstantPropagatorResult, flow: { source: { line: number; }; sink: { line: number; }; path: Array<{ variable: string; line: number; }>; }): boolean; //# sourceMappingURL=index.d.ts.map