/**
 * Data Flow Analysis Module
 *
 * Tracks data flow from sources (user input, API responses) to sinks
 * (database writes, command execution) to identify potential vulnerabilities.
 *
 * This module provides the foundation for semantic vulnerability detection
 * by identifying risky data flows that bypass sanitization.
 *
 * @module analysis/data-flow
 */
import type { Severity } from "../certification/types.js";
/**
 * Trust level of a data source
 */
export type TrustLevel = "untrusted" | "semi-trusted" | "trusted";
/**
 * Types of data sources
 */
export type DataSourceType = "user-input" | "api-response" | "file-read" | "env-var" | "database" | "url-param" | "form-data" | "header" | "cookie";
/**
 * Types of data sinks (dangerous operations)
 */
export type DataSinkType = "sql-query" | "command-exec" | "file-write" | "network-request" | "eval" | "template-render" | "html-render" | "redirect" | "log-output" | "response-body";
/**
 * Risk level of a sink
 */
export type SinkRiskLevel = "critical" | "high" | "medium" | "low";
/**
 * File location reference
 */
export interface FileLocation {
    /** File path */
    file: string;
    /** Line number */
    line: number;
    /** Column number (optional) */
    column?: number;
    /** Code snippet */
    snippet?: string;
}
/**
 * A data source (entry point for potentially tainted data)
 */
export interface DataSource {
    /** Unique identifier */
    id: string;
    /** Type of source */
    type: DataSourceType;
    /** Location in code */
    location: FileLocation;
    /** Variable or expression that holds the data */
    variable: string;
    /** Trust level */
    trustLevel: TrustLevel;
    /** Description */
    description: string;
    /** Framework-specific pattern that matched */
    pattern?: string;
}
/**
 * A data sink (potentially dangerous operation)
 */
export interface DataSink {
    /** Unique identifier */
    id: string;
    /** Type of sink */
    type: DataSinkType;
    /** Location in code */
    location: FileLocation;
    /** Function or method call */
    function: string;
    /** Risk level */
    riskLevel: SinkRiskLevel;
    /** Description */
    description: string;
    /** Parameters that are dangerous */
    dangerousParams?: string[];
    /** Framework-specific pattern that matched */
    pattern?: string;
}
/**
 * A sanitizer that can make data safe
 */
export interface Sanitizer {
    /** Unique identifier */
    id: string;
    /** Function or method name */
    function: string;
    /** Location in code */
    location: FileLocation;
    /** What sink types this sanitizes for */
    sanitizesFor: DataSinkType[];
    /** Description */
    description: string;
}
/**
 * A path from a source to a sink
 */
export interface DataFlowPath {
    /** Source of the data */
    source: DataSource;
    /** Sink where the data ends up */
    sink: DataSink;
    /** Intermediate locations in the path */
    path: FileLocation[];
    /** Whether the flow passes through a sanitizer */
    passesThroughSanitizer: boolean;
    /** Sanitizer locations if any */
    sanitizerLocations?: FileLocation[];
    /** Overall risk assessment */
    riskLevel: Severity;
    /** Description of the vulnerability */
    description: string;
}
/**
 * Complete data flow context for a project
 */
export interface DataFlowContext {
    /** All identified sources */
    sources: DataSource[];
    /** All identified sinks */
    sinks: DataSink[];
    /** All identified sanitizers */
    sanitizers: Sanitizer[];
    /** All data flow paths */
    flows: DataFlowPath[];
    /** Statistics */
    stats: {
        totalSources: number;
        totalSinks: number;
        totalSanitizers: number;
        totalFlows: number;
        riskyFlows: number;
        sanitizedFlows: number;
    };
}
/**
 * Build data flow context for a project
 */
export declare function buildDataFlowContext(projectPath: string, files?: string[]): Promise<DataFlowContext>;
/**
 * Get only risky (unsanitized) flows
 */
export declare function getRiskyFlows(context: DataFlowContext): DataFlowPath[];
/**
 * Get flows by severity
 */
export declare function getFlowsBySeverity(context: DataFlowContext, severity: Severity): DataFlowPath[];
/**
 * Format context for LLM analysis
 */
export declare function formatContextForLLM(riskyFlows: DataFlowPath[], maxFlows?: number): string;
//# sourceMappingURL=data-flow.d.ts.map