Skip to content

Commit 5bb4190

Browse files
committed
fix: ensure extracted directories stay writable
1 parent 3c67308 commit 5bb4190

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

python/unblob/file_utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,10 @@ def mkdir(self, path: Path, *, mode=0o777, parents=False, exist_ok=False):
546546
logger.debug("creating directory", dir_path=path, _verbosity=3)
547547
safe_path = self._get_extraction_path(path, "mkdir")
548548

549-
safe_path.mkdir(mode=mode, parents=parents, exist_ok=exist_ok)
549+
# Directories with restrictive permission bits (e.g. 0o000) immediately
550+
# block creation of nested entries, so force owner rwx during extraction.
551+
safe_mode = mode | 0o700
552+
safe_path.mkdir(mode=safe_mode, parents=parents, exist_ok=exist_ok)
550553

551554
def mkfifo(self, path: Path, mode=0o666):
552555
logger.debug("creating fifo", path=path, _verbosity=3)

0 commit comments

Comments
 (0)