You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Timo Harter (Jira)" <ji...@apache.org> on 2025/07/17 14:06:00 UTC
[jira] [Created] (NIFI-14759) NarUnpacker fails with NAR file signed with JarSigner
Timo Harter created NIFI-14759:
----------------------------------
Summary: NarUnpacker fails with NAR file signed with JarSigner
Key: NIFI-14759
URL: https://issues.apache.org/jira/browse/NIFI-14759
Project: Apache NiFi
Issue Type: Bug
Affects Versions: 2.2.0
Reporter: Timo Harter
A previously working NAR file fails to be unpacked by the NarUnpacker on startup after it has been signed with JarSigner (using the maven-jarsigner-plugin) plugin. The following error occurs:
{code:java}
java.io.FileNotFoundException: work\nar\extensions\test-nar-2.1.1-SNAPSHOT.nar-unpacked\META-INF\MANIFEST.MF (Das System kann den angegebenen Pfad nicht finden)
at java.base/java.io.FileOutputStream.open0(Native Method)
at java.base/java.io.FileOutputStream.open(FileOutputStream.java:289)
at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:230)
at java.base/java.io.FileOutputStream.<init>(FileOutputStream.java:179)
at org.apache.nifi.nar.NarUnpacker.makeFile(NarUnpacker.java:599)
at org.apache.nifi.nar.NarUnpacker.unpackIndividualJars(NarUnpacker.java:346)
at org.apache.nifi.nar.NarUnpacker.unpackIndividualJars(NarUnpacker.java:323)
at org.apache.nifi.nar.NarUnpacker.unpackNar(NarUnpacker.java:296)
at org.apache.nifi.nar.NarUnpacker.unpackNars(NarUnpacker.java:156)
at org.apache.nifi.nar.NarUnpacker.unpackNars(NarUnpacker.java:85)
at org.apache.nifi.nar.NarUnpacker.unpackNars(NarUnpacker.java:80)
at org.apache.nifi.nar.NarUnpacker.unpackNars(NarUnpacker.java:72)
at org.apache.nifi.runtime.Application.run(Application.java:70)
at org.apache.nifi.runtime.Application.run(Application.java:60)
at org.apache.nifi.NiFi.main(NiFi.java:42) {code}
Some analysis shows that the working NAR file has a zipfile structure (order of entries in the file) like this:
{code:java}
META-INF/
META-INF/MANIFEST.MF
META-INF/bundled-dependencies/
META-INF/docs/
META-INF/docs/additional-details/
... {code}
While the NAR file that does not work after signing has an order like this:
{code:java}
META-INF/MANIFEST.MF
META-INF/KEY_5313.SF
META-INF/KEY_5313.RSA
META-INF/
META-INF/DEPENDENCIES
META-INF/LICENSE
META-INF/NOTICE
META-INF/bundled-dependencies/
META-INF/docs/
META-INF/docs/additional-details/
... {code}
Notice how the entry for the "META-INF/" directory comes after the entry for "META-INF/MANIFEST.MF". This causes the error in the NarUnpacker code because the META-INF output directory has not been created by the time META-INF/MANIFEST.MF is being unpacked.
From my understanding, both these structures are valid zip files and other zip related tools do not seem to have an issue with this ordering.
We fixed this problem for us by unpacking and re-packing the signed NAR file to correct the order of entries, but it would be nice if the NarUnpacker class could be made more tolerant here.
Steps to reproduce:
Add a maven-jarsigner-plugin build step to a NAR project and try to deploy the result.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)