Skip to content

tar.extractall() runs with the extraction filter disabled on both paths #725

Description

@christian-byrne

Whatextract_tarball() calls tar.extractall(filter=None) on the non-progress path, and on the progress path passes a custom _filter that returns tinfo unmodified. Both bypass Python's data_filter, so a tarball member with an absolute path or ../ traversal is written wherever it points.

Why it matters here — This is the CVE-2007-4559 class. It matters here because StandalonePython.FromTarball(fpath) accepts an arbitrary caller-supplied path, and FromDistro() downloads from a configurable asset_url_prefix rather than a pinned source. The default path is a trusted HTTPS distro, which is why this is recommended and not critical — but the entry point is general.

Worth being clear: this was a knowing tradeoff, not an oversight. The code carries # TODO: ideally we'd use data_filter here, but it's busted: https://github.com/python/cpython/issues/107845. The ask is to recheck whether that upstream bug is still open on the Python versions comfy-cli now supports, not to fix a mistake.

Evidence

$ ruff check --select S202 --output-format concise comfy_cli
comfy_cli/utils.py:174:13: S202 Uses of `tarfile.extractall()`
comfy_cli/utils.py:195:13: S202 Uses of `tarfile.extractall()`

$ sed -n '173,175p;184,195p' comfy_cli/utils.py
        with tarfile.open(inPath) as tar:
            tar.extractall(filter=None)
...
        def _filter(tinfo: tarfile.TarInfo, _path: PathLike):
            ...
            # TODO: ideally we'd use data_filter here, but it's busted: cpython#107845
            # return tarfile.data_filter(tinfo, _path)
            return tinfo

$ grep -n 'extract_tarball' comfy_cli/standalone.py
128:        extract_tarball(inPath=fpath, outPath=rpath, show_progress=show_progress)

Fix

Recheck cpython#107845 against the minimum supported Python. If it is fixed, switch both paths to data_filter. If not, keep the progress callback for UI but have _filter delegate to tarfile.data_filter(tinfo, _path) for the safety decision — the progress bar and the filter are separable concerns, and the current code conflates them.


Found by repo-audit during repo improvement sweep 2026-08-17. Parent: #723

Activity

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

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions