Security context

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

pallets/jinja
main @ 5ef7011
4
Fixes
8
CVEs
HIGH
Peak severity
100.0%
Coverage
Highlights
Sandbox Escape: 2 prior fixes. Scrutinize any change in this area.
src/jinja2/sandbox.py: most-fixed (2 issues). Treat as high-risk during review.
2 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.

Sandbox Escape: Attackers could bypass sandbox controls by utilizing the '|attr' filter, which bypassed the SandboxedEnvironment's safety checks by directly invoking the raw 'getattr' builtin. This allowed arbitrary Python code execution under certain conditions.
Sandbox Bypass: String formatting operations via 'str.format' and 'str.format_map' historically allowed attackers to traverse Python's object hierarchy and escape the template sandbox when they controlled the template content. Security checks had to be reinforced to intercept and wrap these methods during attribute access.
Sandbox Escape: Insufficient restrictions on mutable sequences within the SandboxedEnvironment allowed templates to alter engine state. Specifically, mutable sequences required explicit blocks on methods like 'clear' and 'pop' to prevent unauthorized state modification.