Skip to content

fix(pax): reject empty keys or keys containing '=' in append_pax_extensions (#486) - #494

Open
slopgobblercobbler wants to merge 1 commit into
composefs:mainfrom
slopgobblercobbler:fix/pax-reject-invalid-extension-keys
Open

slopgobblercobbler wants to merge 1 commit into
composefs:mainfrom
slopgobblercobbler:fix/pax-reject-invalid-extension-keys

Conversation

@slopgobblercobbler

Copy link
Copy Markdown

Problem

In Builder::append_pax_extensions, keys containing = or empty keys are accepted without error. When the archive is parsed back, the reader splits on the first = (pax.rs:109), resulting in split corruption where the key is truncated at the first = and the remainder becomes part of the value. For example, ("a=b", b"c") reads back as key: "a", value: "b=c", and ("=", b"") reads back as key: "", value: "=".

According to the POSIX PAX specification (IEEE Std 1003.1), extended header keywords must not contain = and cannot be empty.

Solution

In Builder::append_pax_extensions (src/pax.rs), validate each key before formatting:

  • Reject empty keys
  • Reject keys containing =
  • Reject keys containing newlines or NUL bytes

Added unit test pax_invalid_keys_rejected in tests/all.rs covering these failure paths and ensuring valid keys continue to serialize cleanly.

Fixes #486

This branch has not been deployed

No deployments
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.

append_pax_extensions accepts keys containing '=' that read back as different records

1 participant