Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't map file entries (ZIP) in symbolic links #793

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions dissect/target/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,9 @@ def makedirs(self, path: str) -> VirtualDirectory:

directory = directory[part]

if not isinstance(directory, VirtualDirectory):
raise NotADirectoryError(f"'{directory}' is not a directory")

return directory

def map_fs(self, vfspath: str, fs: Filesystem) -> None:
Expand Down
9 changes: 7 additions & 2 deletions dissect/target/filesystems/zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from dissect.util.stream import BufferedStream

from dissect.target.exceptions import FileNotFoundError
from dissect.target.exceptions import FileNotFoundError, NotADirectoryError
from dissect.target.filesystem import (
Filesystem,
FilesystemEntry,
Expand Down Expand Up @@ -57,7 +57,12 @@ def __init__(

entry_cls = ZipFilesystemDirectoryEntry if member.is_dir() else ZipFilesystemEntry
file_entry = entry_cls(self, rel_name, member)
self._fs.map_file_entry(rel_name, file_entry)

try:
self._fs.map_file_entry(rel_name, file_entry)
except NotADirectoryError:
log.warning(f"'{member.filename}' is part of a symbolic link, which is not supported")
continue

@staticmethod
def _detect(fh: BinaryIO) -> bool:
Expand Down