Skip to content

Reject JAR Files with Non-UTF-8 Manifests #245

@mizdebsk

Description

@mizdebsk

As a Java package maintainer,
I want javapackages-validator to detect and reject JAR files that contain manifests not encoded in UTF-8,
so that I can ensure all JAR metadata is reliably parsed and safely handled by Java tools that expect UTF-8, preventing encoding-related errors or unexpected behavior during build or runtime.


Acceptance Criteria

  • The validator inspects all .jar files included in the SRPM or built artifacts.
  • It attempts to read the META-INF/MANIFEST.MF file using UTF-8 encoding.
  • If the manifest cannot be parsed as UTF-8 (e.g., contains invalid byte sequences), validation fails.
  • The error output must include:
    • The name of the JAR file
    • A note that the manifest is not UTF-8 encoded

Test Cases

  • Valid Case: JAR contains a META-INF/MANIFEST.MF file encoded in valid UTF-8
    Validation passes

  • Invalid Case: JAR contains a manifest with non-UTF-8 bytes (e.g., Latin-1 or Windows-1252)
    Validation fails, error message displayed

  • Corrupted Case: JAR manifest contains invalid UTF-8 sequences (e.g., truncated multibyte character)
    Validation fails, manifest identified in output

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions