Record Class Packager.UnpackLimits
java.lang.Object
java.lang.Record
org.ek9lang.core.Packager.UnpackLimits
- Record Components:
maxEntries- the most entries (files and directories together) one zip may holdmaxEntryUncompressedBytes- the most bytes any ONE entry may write, uncompressedmaxTotalUncompressedBytes- the most bytes the WHOLE unpack may write, uncompressed, summed over every entrymaxExpansionRatio- the most times the total uncompressed bytes may exceed the zip file's own size on diskratioGuardBytes- the expansion ratio is judged only once the total uncompressed bytes pass this - guards the ratio against a false positive dividing by a tiny zipmaxDirectoryDepth- the deepest an entry's path may nest below the unpack folder
- Enclosing class:
Packager
public static record Packager.UnpackLimits(int maxEntries, long maxEntryUncompressedBytes, long maxTotalUncompressedBytes, int maxExpansionRatio, long ratioGuardBytes, int maxDirectoryDepth)
extends Record
THE resource limits
Packager.unpack(File, File) judges WHILE STREAMING a zip's entries - on bytes actually written, never
an entry's declared size, which a crafted zip header can lie about (threat model gap G-01/G-02, Steve
2026-11-14): a small zip of zeros must never be let expand to gigabytes on disk, for any caller (-I,
-Dp resolution, and later the repository's quarantine worker). Constructor-injectable via
Packager(FileHandling, UnpackLimits) so a test can use tiny values; DEFAULT is what
every real caller gets.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Packager.UnpackLimits10,000 entries, 64 MiB per entry, 256 MiB total, 100x expansion (judged once past 1 MiB), 64 levels deep. -
Constructor Summary
ConstructorsConstructorDescriptionUnpackLimits(int maxEntries, long maxEntryUncompressedBytes, long maxTotalUncompressedBytes, int maxExpansionRatio, long ratioGuardBytes, int maxDirectoryDepth) Creates an instance of aUnpackLimitsrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of themaxDirectoryDepthrecord component.intReturns the value of themaxEntriesrecord component.longReturns the value of themaxEntryUncompressedBytesrecord component.intReturns the value of themaxExpansionRatiorecord component.longReturns the value of themaxTotalUncompressedBytesrecord component.longReturns the value of theratioGuardBytesrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
DEFAULT
10,000 entries, 64 MiB per entry, 256 MiB total, 100x expansion (judged once past 1 MiB), 64 levels deep.
-
-
Constructor Details
-
UnpackLimits
public UnpackLimits(int maxEntries, long maxEntryUncompressedBytes, long maxTotalUncompressedBytes, int maxExpansionRatio, long ratioGuardBytes, int maxDirectoryDepth) Creates an instance of aUnpackLimitsrecord class.- Parameters:
maxEntries- the value for themaxEntriesrecord componentmaxEntryUncompressedBytes- the value for themaxEntryUncompressedBytesrecord componentmaxTotalUncompressedBytes- the value for themaxTotalUncompressedBytesrecord componentmaxExpansionRatio- the value for themaxExpansionRatiorecord componentratioGuardBytes- the value for theratioGuardBytesrecord componentmaxDirectoryDepth- the value for themaxDirectoryDepthrecord component
-
-
Method Details
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
maxEntries
public int maxEntries()Returns the value of themaxEntriesrecord component.- Returns:
- the value of the
maxEntriesrecord component
-
maxEntryUncompressedBytes
public long maxEntryUncompressedBytes()Returns the value of themaxEntryUncompressedBytesrecord component.- Returns:
- the value of the
maxEntryUncompressedBytesrecord component
-
maxTotalUncompressedBytes
public long maxTotalUncompressedBytes()Returns the value of themaxTotalUncompressedBytesrecord component.- Returns:
- the value of the
maxTotalUncompressedBytesrecord component
-
maxExpansionRatio
public int maxExpansionRatio()Returns the value of themaxExpansionRatiorecord component.- Returns:
- the value of the
maxExpansionRatiorecord component
-
ratioGuardBytes
public long ratioGuardBytes()Returns the value of theratioGuardBytesrecord component.- Returns:
- the value of the
ratioGuardBytesrecord component
-
maxDirectoryDepth
public int maxDirectoryDepth()Returns the value of themaxDirectoryDepthrecord component.- Returns:
- the value of the
maxDirectoryDepthrecord component
-