← all rules

code/js-new-function

new Function() constructor with dynamic body

highCode regexevalCWE-95js

What it detects

new Function(...) is eval by another name and executes whatever string is passed in.

How it runs

Applied line-by-line via a tagged regex with language-specific gating. Comments are skipped. Designed for high-confidence patterns where AST parsing would be overkill.

Found a false positive or want this rule tuned? File an issue. You can also suppress per-repo via a .repoguardignore line.