Skip to content

openmhc: harden archive extraction — tarfile.extractall without filter="data", no checksum validation of downloads #92

Description

@NarayanSchuetz

From a full-repo review (line refs from ecb7fe0). Complementary to #13 (which covers the split-tar stream crash — this issue is about extraction safety on all paths, including the working xs path).

  • src/openmhc/_dataset.py:295-297: tarfile.extractall(...) without filter="data" — on Python < 3.14 (no safe default) a malicious/tampered archive can path-traverse outside the target dir. Applies to the outer download and every nested tarball.
  • No checksum or size validation of downloaded files against the Dataverse manifest — a truncated/corrupted download is only detected (if at all) by downstream failures.

Suggested fix: pass filter="data" on every extractall (both the current xs path and the full path being fixed in #13), and verify Dataverse-provided MD5s (the datafile API exposes them) before extraction, failing loud on mismatch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions