Tar-minefield is a test suite and reference policy for tar archive extraction. Tar’s format permits ambiguous or malformed combinations, so tools and libraries can interpret the same archive differently. That creates a security risk when, for example, a scanner checks one file tree but the extractor writes another. The project gives these ambiguities identifiers, supplies crafted test archives and documents expected behavior, aiming to help implementations converge on consistent, strict parsing. Its proposed default policy rejects most ambiguous cases while preserving compatibility: it accepts 99.77% of 82,586 source archives sampled from Spack, nixpkgs, Guix, live-bootstrap, PyPI, crates.io and RubyGems.
A comparison covers 81 cases across command-line extractors and libraries in multiple languages. Results show substantial disagreement: many implementations accept cases the policy says to reject, and several sometimes reject acceptable archives, produce a different tree or crash. Some also write files outside the extraction destination, a particularly serious failure. Rust’s tar-codec, used by uv, matches the policy in 58 cases, the strongest result shown; .NET’s System.Formats.Tar matches in 48, while many others match fewer than 35. The project is therefore useful both as a security benchmark and as a practical guide to edge cases, helping maintainers assess behavior and improve archive handling without sacrificing compatibility with nearly all existing source tarballs.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.