Skip to content

Skip global PAX metadata in TAR readers - #71

Merged
andrew merged 1 commit into
mainfrom
fix/pax-metadata
Nov 1, 2026
Merged

andrew merged 1 commit into
mainfrom
fix/pax-metadata

Conversation

@andrew

@andrew andrew commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Git-generated tarballs include a global PAX header named pax_global_header. Both readers expose it as an empty regular file with mode 000. This prevents common-root detection, breaks normalized file paths and archive comparisons, and causes permission errors when consumers scan extracted files.

Skip tar.TypeXGlobalHeader in buffered and streaming TAR readers. Regression coverage checks root detection, extraction, stream entry limits, and preservation of real files named pax_global_header across compressed TAR, gem, and conda archives.

Copilot AI balanced review requested due to automatic review settings November 1, 2026 11:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

There are no active review issues for the changes that prevent global PAX metadata from being treated as TAR files.

No open issues 🎉

What changed in this PR

This PR prevents global PAX metadata from appearing as files in TAR archives, restoring common-root detection, normalized paths, and extraction behavior.

Changes:

  • Skip global PAX headers in buffered and streaming TAR readers.
  • Add regression coverage for compressed TAR, gem, and conda archives, including stream entry limits and real files named pax_global_header.
  • Verify browser root detection and filesystem extraction.
File Description
tar.go Skip global PAX headers before counting or collecting archive entries.
tar_pax_test.go Test metadata filtering, real-file preservation, entry limits, and root detection.
stream_tar.go Skip global PAX headers when advancing the stream.
extract_test.go Verify extraction omits metadata while preserving real files.

Review effort: Balanced

@andrew
andrew merged commit 5584573 into main Nov 1, 2026
7 checks passed
@andrew
andrew deleted the fix/pax-metadata branch November 1, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants