NIFI-15675 - Add NAR signing support using JDK JarSigner#48
Open
pvillard31 wants to merge 2 commits intoapache:mainfrom
Open
NIFI-15675 - Add NAR signing support using JDK JarSigner#48pvillard31 wants to merge 2 commits intoapache:mainfrom
pvillard31 wants to merge 2 commits intoapache:mainfrom
Conversation
Contributor
exceptionfactory
left a comment
There was a problem hiding this comment.
Thanks for proposing this addition @pvillard31, supporting the ability to sign a NAR aligns well with general JAR signing features. I plan to take a closer look at the implementation soon.
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.
https://issues.apache.org/jira/browse/NIFI-15675
Add NAR signing support using JDK JarSigner
When NiFi dynamically downloads or auto-loads NARs from external sources, there is currently no mechanism to verify that a NAR has not been tampered with or that it originates from a trusted publisher. This is the build-side prerequisite for enabling signature verification in the NiFi runtime.
Since a NAR is structurally a JAR, the JDK's built-in JAR signing mechanism is the natural fit. This issue covers adding optional signing parameters to the existing goal in the plugin. Signing is disabled by default for full backward compatibility. A follow-up issue will cover runtime verification in NiFi itself.
nargoal using the JDK'sjdk.security.jarsigner.JarSignerAPInar.sign=false) — fully backward compatible, no behavioral change unless explicitly opted increateArchive()produces the NAR, the newsignNar()step signs it in place using the configured keystore, then the signed NAR is registered as the project artifactConfiguration
Seven new parameters on the
nargoal, all optional:signnar.signfalsesignKeystorenar.sign.keystoresignStorepassnar.sign.storepasssignAliasnar.sign.aliassignKeypassnar.sign.keypasssignStoretypenar.sign.storetypePKCS12signTsanar.sign.tsaMinimal usage:
Or entirely via command line with no POM changes:
Signed NARs can be verified with standard JDK tooling:
jarsigner -verify -verbose -certs target/my.narApproach
A NAR is structurally a JAR. Rather than inventing a custom signature format, this uses the JDK's
JarSignerAPI (available since Java 9, stable in Java 21) which signs each entry inside the archive with SHA-256 digests and produces standard PKCS#7 signature blocks. This means:jarsigner -verifyby anyonejdk.security.jarsigner.JarSigneris part of the JDK itselfMETA-INF/like any signed JARVerification building nifi-aws-nar
NAR build
NAR content
Verification
Manifest