Security context

What an agent needs to avoid regressing past fixes and find the next vuln in this repo.

jashkenas/underscore
master @ 5f37c37
6
Fixes
2
CVEs
HIGH
Peak severity
50.0%
Coverage
Highlights
Denial of Service: 3 prior fixes. Scrutinize any change in this area.
modules/_flatten.js: most-fixed (2 issues). Treat as high-risk during review.
4 high-severity fixes in this history; regressions here are high-impact.
Recurring patterns

The bug types that recur here, drawn from past fixes, not open vulnerabilities.

Remote Code Execution: The template compilation mechanism generates dynamic JavaScript functions. Without strict regex validation ensuring that user-provided variables are bare identifiers, attackers can inject arbitrary code to achieve server-side or client-side execution (as seen in CVE-2021-23358).
Denial of Service: Recursive deep object comparison is susceptible to call stack exhaustion crashes when processing deeply nested input. Mitigation requires avoiding function-call recursion in favor of an explicit, iterative trampoline-based loop.
Denial of Service: Array flattening operations that rely on standard recursion can be abused by crafted recursive structures to trigger stack overflows. Protecting this path requires using a non-recursive implementation managed via an explicit stack.