[MSHARED-815] Sanitize newlines in manifest entry values#363
Open
elharo wants to merge 2 commits into
Open
Conversation
Newlines (\\n, \\r\\n, \\r) in manifest entry values can produce invalid MANIFEST.MF files, particularly when empty lines create section separators. Replace all newline characters with spaces before storing values in manifest attributes. Applies sanitization in both addManifestAttribute() (for main manifest attributes) and the manifest section entries loop. Fixes apache#362
Simplified the addManifestAttribute method by removing unnecessary conditional checks for empty values.
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.
Fixes #362
Newlines (\n, \r\n, \r) in manifest entry values can produce invalid
MANIFEST.MF files, particularly when empty lines create section separators.
Replace all newline characters with spaces before storing values in manifest
attributes.
Applies sanitization in both
addManifestAttribute()(for main manifestattributes) and the manifest section entries loop.
Includes a test verifying newlines are replaced via
getManifest()(in-memory) and a test verifying the JAR output with empty-line values
remains readable (no manifest corruption).