Skip to content

Add option to skip signing of JDK runtime on macOS (#138) - #146

Open
geertjanw wants to merge 2 commits into
masterfrom
issue-138-skip-runtime-signing
Open

geertjanw wants to merge 2 commits into
masterfrom
issue-138-skip-runtime-signing

Conversation

@geertjanw

Copy link
Copy Markdown
Member

Fixes #138.

Adds an opt-in option to skip re-signing the bundled JDK runtime on macOS.

New option: package.macos.codesign-runtime (boolean, default true). Leaving it at the default keeps the current behaviour. Setting it to false keeps the runtime's existing signatures, which avoids the jlink "modified runtime" errors described in the issue and mailing-list thread.

Notes on the approach:

  • Filters by the runtime path (Contents/Home) rather than adjusting the signing glob, since FileUtils.find also matches on filename — so the default glob's *.dylib would still catch the runtime libs by name.
  • The final whole-bundle codesign does not use --deep, so it does not re-sign the runtime contents either; filtering the native-binary list is enough to preserve the JDK's original signatures.
  • Adds help text, a short README note, a log line when the runtime is skipped, and a test.

Worth keeping in mind, per the mailing-list thread: skipping runtime re-signing could affect notarization or runtime permissions in some setups, so a package built with codesign-runtime=false should be run through notarization + stapling before leaning on it. Happy to adjust the option name or default if there's a preference.

By default NBPackage re-signs the whole installation payload on macOS,
including the bundled JDK runtime. Re-signing rewrites each runtime
binary's signature, which changes the hash that jlink verifies against
and leads to "modified runtime" errors.

Add a package.macos.codesign-runtime option (boolean, default true) to
keep the runtime's existing signatures. When false, native binaries
under Contents/Home are excluded from the signing list; the final
bundle codesign does not use --deep so the runtime is left untouched.
The nativeBinaries list stores paths with the OS separator, so the
Contents/Home checks failed on Windows. Normalize to forward slashes
before matching.
@geertjanw
geertjanw force-pushed the issue-138-skip-runtime-signing branch from 05dcb07 to 77b841e Compare October 1, 2026 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to skip signing of runtime on macOS

1 participant