Skip to content
Merged
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
11 changes: 10 additions & 1 deletion deepsecrets/core/modes/iscan_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,11 @@ def _get_files_list(self) -> List[str]:
self._skip(full_path, f'excluded_path:{exclusion}')
continue

if os.path.islink(full_path) and not os.path.exists(full_path):
# a dangling symlink cannot be opened or stat'ed: os.path.getsize would raise below
self._skip(full_path, 'broken_symlink')
continue

if not self._size_check(full_path):
self._skip(full_path, 'max_file_size')
'''
Expand Down Expand Up @@ -430,7 +435,11 @@ def _size_check(self, path: str):
if self.config.max_file_size == 0:
return True

size = os.path.getsize(path)
try:
size = os.path.getsize(path)
except OSError:
# e.g. a path that vanished or a dangling symlink raced away between discovery and here
return False
if size > self.config.max_file_size:
return False
return True
Expand Down
Loading