extractor: add a total size limit across the whole extraction - #16
Merged
unxed merged 1 commit intoSep 27, 2026
Merged
Conversation
WithExtractorMaxFileSize and WithExtractorMaxRatio each look at one entry at a time, so an archive of many entries that each stay under both limits could still expand to an unbounded total: a 100 MB archive of many small, individually-innocent records could write hundreds of gigabytes to disk without tripping either check. Add WithExtractorMaxTotalSize, checked against the extraction's own running total (the same counter Written() already reports), with a 32 GB default alongside the existing hardcoded defaults. Zero disables it, a negative value is refused, matching the other two limits. The solid-archive scratch copy is deliberately excluded, same as the existing per-file limit: those bytes are removed again before the extraction returns and are not its output. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
unxed
deleted the
lunobot/agent-lb3-zip56/lunobot-3/5-extractor-total-size-limit
branch
September 27, 2026 04:35
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.
Summary
Extractoralready bounds how big any one extracted file may be(
WithExtractorMaxFileSize, 1GB default) and how far any one entry mayexpand relative to its own compressed size (
WithExtractorMaxRatio,4000:1 default), but nothing bounded the sum of what an extraction
writes. An archive of many entries, each individually within both of
those limits, could still expand to a total bounded only by the
archive's own size times the ratio limit: a 100 MB archive could write
hundreds of gigabytes to disk without a single error.
WithExtractorMaxTotalSize, a new limit checked against theextraction's own running total (the same counter
Written()alreadyreports), with a 32GB hardcoded default alongside the existing two.
Zero disables it; a negative value is refused, same as the other two
limits.
the new
ErrTotalSizeLimit.the other two limits already are.
total, for the same reason the per-file limit already excludes it:
those bytes are removed again before the extraction returns and are
not part of its output.
Test plan
go build ./... && go vet ./...go test ./...(full suite, unchanged behavior for existingarchives)
TestExtractor_TotalSizeLimit/TestExtractor_TotalSizeLimit_Disabledcover an archive of ten entries that each stay under the per-file and
ratio limits but whose sum trips (and, with the limit at zero,
doesn't trip) the new total limit.
TestExtractorOptions_RejectNegativeLimitsextended to cover anegative
WithExtractorMaxTotalSize.Touch #5
Lunobot-3
🤖 Generated with Claude Code