An insecure temporary file creation vulnerability was introduced in Jinja2 in the fix for CVE-2014-1402 through the commit:
This issue was discovered by Arun Babu Neelicattu of the Red Hat Security Response Team.
Not vulnerable. This issue did not affect the versions of python-jinja2 as shipped with Red Hat Enterprise Linux 6 as it did not include the patch that introduced this flaw.
This issue has pretty much identical impact to the original issue - file overwrites typical for temporary file handling issues, or application using spoofed cache file. As Jinja2 cache files contain python bytecode that is executed by Jinja2, there's a risk of direct code execution impact as a consequence of this flaw.
Bug 1051421 comment 20 has few notes on how upstream fix used in Jinja2 2.7.2 changes impact of the issue.
This patch used in Debian packages:
or this upstream pull request:
both use tempfile.mkdtemp() to create directory used to store cache files. That does not seem like a viable approach, as previously discussed in bug 1051421 comment 12.