28 lines
882 B
Diff
28 lines
882 B
Diff
diff --git a/jinja2/bccache.py b/jinja2/bccache.py
|
|
index 09ff845..c31a905 100644
|
|
--- a/jinja2/bccache.py
|
|
+++ b/jinja2/bccache.py
|
|
@@ -16,6 +16,7 @@
|
|
"""
|
|
from os import path, listdir
|
|
import os
|
|
+import stat
|
|
import sys
|
|
import errno
|
|
import marshal
|
|
@@ -230,6 +231,14 @@ class FileSystemBytecodeCache(BytecodeCache):
|
|
if e.errno != errno.EEXIST:
|
|
raise
|
|
|
|
+ if os.lstat(actual_dir).st_uid != os.getuid():
|
|
+ raise RuntimeError('Someone else owns temp directory with your '
|
|
+ 'uid. You need to explicitly provide another.')
|
|
+
|
|
+ if stat.S_IMODE(os.lstat(actual_dir).st_mode) != 448:
|
|
+ raise RuntimeError('Bad permission flags on temp directory, '
|
|
+ 'shoud be 0700. You need to fix this.')
|
|
+
|
|
return actual_dir
|
|
|
|
def _get_cache_filename(self, bucket):
|