BaseExtractor: fix _validate_archive_entries by milahu · Pull Request #4754 · pyload/pyload · GitHub
Skip to content

BaseExtractor: fix _validate_archive_entries#4754

Draft
milahu wants to merge 2 commits into
pyload:developfrom
milahu:fix-BaseExtractor-validate_archive_entries
Draft

BaseExtractor: fix _validate_archive_entries#4754
milahu wants to merge 2 commits into
pyload:developfrom
milahu:fix-BaseExtractor-validate_archive_entries

Conversation

@milahu

@milahu milahu commented May 29, 2026

Copy link
Copy Markdown

fix: BaseExtractor._validate_archive_entries fails on absolute self.dest paths

reproduce

git checkout a08224391d595021d7acc2c521333f97670b11f4
echo hello >test.txt
rar a test.rar test.txt
# good: relative filepath
python -m src.pyload.plugins.extractors.UnRar test.rar
# bad: absolute filepath
# ArchiveError: Attempted path traversal in archive
python -m src.pyload.plugins.extractors.UnRar "$PWD"/test.rar

the Attempted path traversal error makes no sense
because the archive does not contain bad paths like

../bad/path
/bad/path

extractor plugins like UnRar
had absolute file paths in self.files since forever

BaseExtractor._validate_archive_entries has been broken since

  • ad249dd 2026-05-26 if normalized.startswith("/"):
    • probably this works on windows with paths like C:/Users/...
  • f092019 2026-05-23 if os.path.isabs(entry_path):

milahu added 2 commits May 29, 2026 09:21
todo also debug
src/pyload/plugins/base/extractor.py
if normalized.startswith("/"):
    raise ArchiveError(f"Attempted path traversal in archive: {entry}")
if self.dest is an absolute path
then file_list has absolute paths
so we must allow absolute paths
milahu added a commit to milahu/pyload that referenced this pull request May 29, 2026
if self.dest is an absolute path
then file_list has absolute paths
so we must allow absolute paths

pyload#4754
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant