You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The list command displays ../escape.txt (a traversal entry) without any warning or error when the archive is a TAR. This is inconsistent with ZIP behavior where list raises PathTraversal error.
Reproduction
# TAR with ../escape.txt entry:
exarch list partial.tar
# Output: shows ../escape.txt as a normal entry, exit 0# ZIP with ../escape.txt entry:
exarch list partial.zip
# Error: path traversal detected: ../escape.txt, exit 1
Root cause
inspection/list.rs: list_tar_entries uses entry.path() (raw tar-rs path, no validation):
let path = entry.path()...into_owned();// no ../ check
ZIP uses entry.enclosed_name() which returns None for traversal paths, converted to PathTraversal error.
Impact
User confusion: list on a malicious TAR shows ../escape.txt as a valid path — no indication the archive is dangerous.
CLI conflict-check bypass: The extract command calls list_archive before extracting to detect conflicts. For TAR, this list call succeeds even with traversal entries, so the conflict check is effectively bypassed. Extraction starts, and traversal is only caught mid-extraction, leaving partial files on disk (see enhancement: extraction is not atomic — partial state left on disk when error occurs mid-archive #89).
Inconsistency: ZIP is safe, TAR is not.
Fix
In list_tar_entries, validate each path component for .. or null bytes, returning PathTraversal error (consistent with ZIP behavior). This also makes the CLI conflict pre-check effective for TAR archives with traversal entries.
The
listcommand displays../escape.txt(a traversal entry) without any warning or error when the archive is a TAR. This is inconsistent with ZIP behavior wherelistraisesPathTraversalerror.Reproduction
Root cause
inspection/list.rs: list_tar_entriesusesentry.path()(raw tar-rs path, no validation):ZIP uses
entry.enclosed_name()which returnsNonefor traversal paths, converted toPathTraversalerror.Impact
liston a malicious TAR shows../escape.txtas a valid path — no indication the archive is dangerous.extractcommand callslist_archivebefore extracting to detect conflicts. For TAR, this list call succeeds even with traversal entries, so the conflict check is effectively bypassed. Extraction starts, and traversal is only caught mid-extraction, leaving partial files on disk (see enhancement: extraction is not atomic — partial state left on disk when error occurs mid-archive #89).Fix
In
list_tar_entries, validate each path component for..or null bytes, returningPathTraversalerror (consistent with ZIP behavior). This also makes the CLI conflict pre-check effective for TAR archives with traversal entries.