It depends where. Inside a server application, fail fast and fail safe.
Now if I'm a user trying to extract the file then I'd want to get as much as possible.
You really want two different modes. If you're parsing untrusted tarballs (eg. ones uploaded to your website) then you should err on the side of rejecting anything that's even slightly suspicious. But in another mode you are a user who needs to extract any data you can from your corrupted family photos archive.
It is somewhat unfortunate that tar has two main purposes with very different threat models, namely backup and (software) distribution.
The POSIX standard promotes best-effort extraction, which is reasonable for backups, but a liability for distribution.
Julia's Tar.jl was developed for Pkg.jl and tar-codec for uv, so these are focused on the security aspect of software distribution.
Re:The Hardest Tarball?
by yjftsjthsd-h on Tuesday November 10, 2026 @02:28PM
(#50445065)
Really what I think I'd want out of any archive utility is a safe default mode (for whatever "safe" means here), but the ability for a user to pull out everything in the archive one way or another. If an archive can be read as having multiple versions of a given file, the user should be able to pick to extract any or all of them at will, but only on purpose.
> While this is the safest choice, it is the least helpful, I would always prefer to get something out of an archive then nothing. Damage/irregularity to an archive shouldn't prevent data inspection, just a warning and a way to fall back with caveats for what can be extracted.
I would argue the correct answer can have both.
Fail by default, fail with a clear error that says the file is damaged, then offer an explicitly opt-in path to try your best anyways, preferably one where the command line option is something like --dangerous-try-extract-anyways and will itself fail on non-broken files so it can't just be shoved in a script as a way to "make sure it works".
While this is the safest choice, it is the least helpful, I would always prefer to get something out of an archive then nothing. Damage/irregularity to an archive shouldn't prevent data inspection, just a warning and a way to fall back with caveats for what can be extracted.