From 78c60d11e27c2d74fbece14020cdbdc38fcc1a9d Mon Sep 17 00:00:00 2001 From: Sam Doran Date: Wed, 4 Mar 2026 15:36:20 -0500 Subject: [PATCH] Create directories that contain cache files so they are only owner accessible --- diskcache/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/diskcache/core.py b/diskcache/core.py index 7a3d23b..6c9e282 100644 --- a/diskcache/core.py +++ b/diskcache/core.py @@ -232,7 +232,7 @@ def _write(self, full_path, iterator, mode, encoding=None): for count in range(1, 11): with cl.suppress(OSError): - os.makedirs(full_dir) + os.makedirs(full_dir, 0o700) try: # Another cache may have deleted the directory before @@ -444,7 +444,7 @@ def __init__(self, directory=None, timeout=60, disk=Disk, **settings): if not op.isdir(directory): try: - os.makedirs(directory, 0o755) + os.makedirs(directory, 0o700) except OSError as error: if error.errno != errno.EEXIST: raise EnvironmentError(