UNPKG

pompelmi

Version:

RFI-safe file uploads for Node.js — Express/Koa/Next.js middleware with deep ZIP inspection, MIME/size checks, and optional YARA scanning.

103 lines (102 loc) 3.18 kB
/** * Dynamic Taint Analysis Engine * * Advanced taint tracking implementation for comprehensive data flow analysis * with support for memory tainting, register tracking, and vulnerability detection. */ import type { TaintSource, TaintLabel, TaintedMemory, TaintedRegister, TaintConfig, TaintAnalysisResult, TaintCapableEngine } from '../types/taint-tracking'; /** * Advanced dynamic taint analysis engine with comprehensive tracking capabilities */ export declare class DynamicTaintEngine implements TaintCapableEngine { private config; private memoryState; private registerState; private taintLabels; private propagationRules; private analysisSession; private hipaa; private analysisStartTime; private instructionCount; constructor(config?: Partial<TaintConfig>); private createDefaultConfig; private createHipaaUtilities; private createDefaultRules; /** * Configure taint tracking settings */ configureTaint(config: TaintConfig): Promise<void>; /** * Perform comprehensive taint analysis on binary data */ performTaintAnalysis(data: Uint8Array): Promise<TaintAnalysisResult>; /** * Get current taint state for debugging and analysis */ getTaintState(): Promise<{ memory: TaintedMemory[]; registers: TaintedRegister[]; }>; /** * Add a custom taint source at a specific location */ addTaintSource(address: string, source: TaintSource, label?: Partial<TaintLabel>): Promise<void>; /** * Check if a memory location is currently tainted */ isTainted(address: string): Promise<boolean>; /** * Identify entry points and potential taint sources through static analysis */ private identifyEntryPoints; /** * Initialize taint sources based on identified entry points */ private initializeTaintSources; /** * Perform taint propagation analysis through simulated execution */ private performTaintPropagation; /** * Generate simulated instructions for demonstration * In practice, this would come from a real dynamic analysis engine */ private generateSimulatedInstructions; /** * Process a single instruction for taint propagation */ private processInstruction; /** * Find the best matching propagation rule for an instruction */ private findMatchingRule; /** * Get taint information from source operands */ private getSourceTaints; /** * Get taint labels associated with an operand */ private getTaintsForOperand; /** * Propagate taint from sources to destinations */ private propagateTaint; /** * Create a taint flow when reaching a sink */ private createTaintFlow; /** * Analyze flows for security vulnerabilities */ private analyzeVulnerabilities; private getTotalSources; private getTotalSinks; private isFlowSanitized; private isAddressInRange; private isRegister; private determineSinkType; private calculateSeverity; private getCWEForSink; private getSuggestedMitigations; }