`eval()` & `new Function()`: AI's Static Analysis Black Holes
JavaScript's `eval()` and `new Function()` constructs allow code to be generated and executed at runtime, creating new types and scopes that are entirely opaque to AI static analysis tools, which operate without code execution.
The top 3
- Runtime Code Generation: AI's Static Analysis Blind Spot: `eval()` and `new Function()` execute code from strings at runtime, making it impossible for AI static analysis to build accurate Abstract Syntax Trees (ASTs) or control flow graphs pre-execution, fundamentally hindering predictability.
- Dynamic Scope Tampering: AI's Contextual Nightmare: `eval()` can dynamically modify or introduce variables within its calling scope, severely complicating AI's ability to statically track data flow, variable states, and potential side effects across the application.
- Top 3 Security Risks from `eval()` & `new Function()`: These functions are primary vectors for Cross-Site Scripting (XSS), arbitrary code execution, and data theft, as they can run malicious, user-supplied code, bypassing static security checks.
Sources
Open the full topic