UNPKG

sicua

Version:

A tool for analyzing project structure and dependencies

56 lines (55 loc) 1.62 kB
/** * Detector for insecure random number generation in security contexts */ import { BaseDetector } from "./BaseDetector"; import { Vulnerability } from "../types/vulnerability.types"; import { ScanResult } from "../../../types"; export declare class InsecureRandomDetector extends BaseDetector { private static readonly RANDOM_PATTERNS; constructor(); detect(scanResult: ScanResult): Promise<Vulnerability[]>; /** * Detect usage of secure random alternatives in the file */ private detectSecureRandomUsage; /** * Validate if a random pattern match is in a security context */ private validateRandomMatch; /** * AST-based analysis for insecure random usage */ private analyzeASTForInsecureRandom; /** * Find Math.random() call expressions */ private findMathRandomCalls; /** * Find Date.now() usage in random contexts */ private findDateNowRandomUsage; /** * Analyze the security context of a Math.random() call */ private analyzeRandomSecurityContext; /** * Get the variable name that a random call is assigned to */ private getAssignmentVariableName; /** * Check if variable name suggests security context */ private isSecurityRelatedVariable; /** * Check if function name suggests security context */ private isSecurityRelatedFunction; /** * Check if context suggests security usage */ private isInSecurityContext; /** * Extract function name from AST node context */ private extractFunctionFromAST; }