elharo opened a new pull request, #103:
URL: https://github.com/apache/maven-jarsigner/pull/103

   Fixes #96
   
   ## Problem
   
   `isZipFile()` used `ZipInputStream` which reads from byte 0 and expects the 
ZIP magic number at the start of the file. Spring Boot "fully executable" jars 
have a shell script prepended before the ZIP data, causing `isZipFile()` to 
return `false` and the jar to be silently skipped with "Unsupported artifact 
ignored".
   
   ## Fix
   
   Switch from `ZipInputStream` to `JarFile` in `isZipFile()`. `JarFile` (which 
extends `ZipFile`) reads the End of Central Directory (EOCD) record from the 
end of the file, correctly finding ZIP data regardless of any prepended content.
   
   ## Test
   
   Added `isZipFileWithPrependedData` to `JarSignerUtilTest` that creates a 
fake executable jar (shell script text + real jar bytes) and asserts 
`isZipFile()` returns `true`.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to