Repository navigation
BUGFIX: Cap total uncompressed size in data-tar validation - #42
Draft
bmdavis419 wants to merge 1 commit into
Draft
bmdavis419 wants to merge 1 commit into
bmdavis419 wants to merge 1 commit into
Conversation
ValidateDataTar capped member count but not summed regular-file size, so a small crafted .tx9 could pass validation and expand without bound when tx9 import extracted it onto a volume. Reject archives past 100 GiB total (mirroring guest/hermes-state MAX_UNCOMPRESSED) and reject negative member sizes. Includes cumulative and boundary regression tests and marks the 2026-08-27 audit item addressed.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Caps total uncompressed archive size in
ValidateDataTar, so a crafted.tx9can no longer pass validation and then expand without bound onto a box volume duringtx9 import.Why this item (highest-value open reliability/correctness fix):
Considered from
docs/audit-2026-08-27.md+docs/audit-2026-10-04.md:guest/hermes-statealready ships (MAX_UNCOMPRESSED), so it needs no new product call.This item wins because any
.tx9file a user is handed can trigger it today, validation already runs before extraction (so the gate is cheap and fail-fast), and it is testable hermetically with no Docker.Important files:
internal/archive/validator.gomaxArchiveUncompressedBytes(100 GiB, test-lowerable var likemaxArchiveMembers) and enforces the cumulative regular-file total during header collection, before any extraction writes.internal/archive/validator_test.goundefined: maxArchiveUncompressedBytes/ no cap) and pass after.docs/audit-2026-08-27.mdChecks:
make checkpassed (syntax, ShellCheck, guest regressions, gofmt,go vet,go test ./...); focusedgo test ./internal/archive/ -run TestValidateDataTarpassed. Draft only — not merged, nothing deployed or released.Note
Cap total uncompressed regular-file size at 100 GiB in
ValidateDataTararchive.ValidateDataTarnow sums the declared sizes of regular-file members while scanning tar headers and rejects the archive if the total exceeds a new 100 GiB limit. It also rejects regular members with a negative size. Both checks run before any extraction logic. An archive whose total exactly equals the limit is still accepted. The limit lives in the mutable package variablearchive.maxArchiveUncompressedBytesso tests can adjust it; new tests in validator_test.go cover the exceeded and exact-boundary cases.Macroscope summarized 35f5790.