UNPKG

sicua

Version:

A tool for analyzing project structure and dependencies

44 lines (43 loc) 1.34 kB
/** * Detector for dangerous eval() usage and similar code execution vulnerabilities */ import { BaseDetector } from "./BaseDetector"; import { Vulnerability } from "../types/vulnerability.types"; import { ScanResult } from "../../../types"; export declare class DangerousEvalDetector extends BaseDetector { private static readonly EVAL_PATTERNS; constructor(); detect(scanResult: ScanResult): Promise<Vulnerability[]>; /** * Validate if a pattern match is actually dangerous eval usage */ private validateEvalMatch; /** * AST-based analysis for sophisticated eval detection */ private analyzeASTForDangerousEval; /** * Fixed analyzeCallExpression function - properly handles CallExpression vs NewExpression */ private analyzeCallExpression; /** * Separate function to analyze NewExpression for Function constructor */ private analyzeNewExpression; /** * Get the type of an argument for better context */ private getArgumentType; /** * Check if an expression represents a string variable */ private isStringVariable; /** * Extract function name from AST node context */ private extractFunctionFromAST; /** * Check if text is inside a string literal */ private isInStringLiteral; }