What happens
archive.extract-member passes the member name to tar without --:
tar xzOf "$src" "$member" # observe
tar xzOf "$src" "$member" > "$staged" # apply
A member whose name starts with a dash is read as options. Reproduced:
$ tar xzOf /t/a.tgz "-rf.txt"
tar: You may not specify more than one '-Acdtrux', '--delete' or '--test-label' option
$ tar xzOf /t/a.tgz -- "-rf.txt"
content
Scope, honestly
Low severity. The member has to be named -rf.txt without a ./ prefix, which tar czf … . does not produce — the archive has to come from elsewhere, or from --transform.
It is a one-token fix, and the surrounding defs already treat hostile arguments as ordinary
input (#535), so leaving this one inconsistent is the thing to correct rather than the risk
itself.
Build
-- before the member in both places. Check the other tar calls in the same file while
there: tar xzf "$src" -C "$dst" and tar tzf "$src" take no member, so they are not
affected — confirm rather than assume.
Validation
- An adverse case extending
adverse-archive.extract-member.shellf: an archive built with
--transform so a member is named -rf.txt, extracted by name. Red before the fix.
What happens
archive.extract-memberpasses the member name totarwithout--:A member whose name starts with a dash is read as options. Reproduced:
Scope, honestly
Low severity. The member has to be named
-rf.txtwithout a./prefix, whichtar czf … .does not produce — the archive has to come from elsewhere, or from--transform.It is a one-token fix, and the surrounding defs already treat hostile arguments as ordinary
input (#535), so leaving this one inconsistent is the thing to correct rather than the risk
itself.
Build
--before the member in both places. Check the othertarcalls in the same file whilethere:
tar xzf "$src" -C "$dst"andtar tzf "$src"take no member, so they are notaffected — confirm rather than assume.
Validation
adverse-archive.extract-member.shellf: an archive built with--transformso a member is named-rf.txt, extracted by name. Red before the fix.