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 hold
maxEntryUncompressedBytes - the most bytes any ONE entry may write, uncompressed
maxTotalUncompressedBytes - the most bytes the WHOLE unpack may write, uncompressed, summed over every entry
maxExpansionRatio - the most times the total uncompressed bytes may exceed the zip file's own size on disk
ratioGuardBytes - the expansion ratio is judged only once the total uncompressed bytes pass this - guards the ratio against a false positive dividing by a tiny zip
maxDirectoryDepth - 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 Details

    • DEFAULT

      public static final Packager.UnpackLimits 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 a UnpackLimits record class.
      Parameters:
      maxEntries - the value for the maxEntries record component
      maxEntryUncompressedBytes - the value for the maxEntryUncompressedBytes record component
      maxTotalUncompressedBytes - the value for the maxTotalUncompressedBytes record component
      maxExpansionRatio - the value for the maxExpansionRatio record component
      ratioGuardBytes - the value for the ratioGuardBytes record component
      maxDirectoryDepth - the value for the maxDirectoryDepth record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • maxEntries

      public int maxEntries()
      Returns the value of the maxEntries record component.
      Returns:
      the value of the maxEntries record component
    • maxEntryUncompressedBytes

      public long maxEntryUncompressedBytes()
      Returns the value of the maxEntryUncompressedBytes record component.
      Returns:
      the value of the maxEntryUncompressedBytes record component
    • maxTotalUncompressedBytes

      public long maxTotalUncompressedBytes()
      Returns the value of the maxTotalUncompressedBytes record component.
      Returns:
      the value of the maxTotalUncompressedBytes record component
    • maxExpansionRatio

      public int maxExpansionRatio()
      Returns the value of the maxExpansionRatio record component.
      Returns:
      the value of the maxExpansionRatio record component
    • ratioGuardBytes

      public long ratioGuardBytes()
      Returns the value of the ratioGuardBytes record component.
      Returns:
      the value of the ratioGuardBytes record component
    • maxDirectoryDepth

      public int maxDirectoryDepth()
      Returns the value of the maxDirectoryDepth record component.
      Returns:
      the value of the maxDirectoryDepth record component