mitsuhiko/jinja2 — pull request #296 by thoger (2014-02-09 18:00:32+00:00)
Title: Fix for CVE-2014-0012

Commit acb672b attempted to fix insecure temporary file use in FileSystemBytecodeCache by introducing per-user temporary directory. However, if directory already exists, it is used without checking its ownership and permissions. Local attacker able to create temporary directory with victim's uid before victim does so can achieve the same impact as with the original issue.

This attempts to address the issue by introducing ownership, permission and type check and makes jinja2 raise an exception if existing directory has unexpected attributes.

Further discussion can be found in:
https://bugzilla.redhat.com/show_bug.cgi?id=1051421