Skip to content

CertWizard 2.2.1 crashes on first launch MacOS 27.2 (26B123) A64 #67

Open

Description

@rob-c

As in the title, the latest 2.2.1 release crashes on a new ARM MacBook when running. First time, and every time.

I was using this to migrate certs/etc. between laptops but didn't even get to point the wizard at a directory. I guess it's either a permission or a bug introduced into the code without check.

This is a slightly modified ootb setup with very, very little installed at this point in terms of 3rd party libraries/tools but I doubt the laptop software env is to blame.

2.2.0 works fine so I've dropped back to that build for now and afaict the changes are minimal.

If I get a chance I'll throw AI at building the latest branch and see if it's been fixed but right now it's a non-starter.

Activity

  1. rob-c commented on Nov 6, 2026

    @rob-c
    Author

    Root cause found: the 2.2.1 Mac bundles are signed without JVM entitlements

    I dug into this with Claude Code. This is not a code bug, and it is not a permissions problem on my machine. It's a packaging and signing defect, and it affects both Mac downloads (ARM64 and Intel64).

    What's wrong

    The 2.2.1 .app bundles are signed with the hardened runtime (flags=0x10000(runtime)) but carry zero entitlements. The 2.2.0 bundle, which works, carried the standard four that any HotSpot JVM needs under the hardened runtime:

    2.2.0 (works) 2.2.1 ARM64 2.2.1 Intel64
    Hardened runtime ✅ ✅ ✅
    com.apple.security.cs.allow-jit ✅ ❌ ❌
    com.apple.security.cs.allow-unsigned-executable-memory ✅ ❌ ❌
    com.apple.security.cs.disable-library-validation ✅ ❌ ❌
    com.apple.security.cs.allow-dyld-environment-variables ✅ ❌ ❌
    Bundled runtime Java 25.0.4 Java 25.0.5, identical module list Java 25.0.5, identical module list

    Without allow-jit, macOS kills the JVM as soon as it tries to set up its code cache. That happens inside JNI_CreateJavaVM, before a single line of CertWizard runs, which is why it dies on first launch, every launch, before any window appears. Every crash report shows the same thing:

    Exception: EXC_BREAKPOINT (SIGTRAP)  — "Trace/BPT trap: 5", exit code 133
    0  libsystem_pthread.dylib  pthread_jit_write_protect_np
    1  libjvm.dylib             Threads::create_vm(JavaVMInitArgs*, bool*)
    2  libjvm.dylib             JNI_CreateJavaVM
    3  libjli.dylib             JavaMain
    4  libjli.dylib             ThreadJavaMain
    

    The Java changes between 2.2.0 and 2.2.1 (the PPPK alias fix and the Locale.UK date formatter) are fine and are not involved.

    How to see it yourself
    # 2.2.1: no entitlements at all
    codesign -dvv --entitlements - CertWizard.app 2>&1 | grep -E 'flags|Key\]'
    #   CodeDirectory v=20500 size=1629 flags=0x10000(runtime) ...
    #   (no [Key] lines)
    
    # 2.2.0: the four JVM entitlements are present
    codesign -dvv --entitlements - CertWizard-2.2.0-Mac-ARM64-Signed.app 2>&1 | grep -E 'flags|Key\]'
    #   ... flags=0x10000(runtime) ...
    #   [Key] com.apple.security.cs.allow-dyld-environment-variables
    #   [Key] com.apple.security.cs.allow-jit
    #   [Key] com.apple.security.cs.allow-unsigned-executable-memory
    #   [Key] com.apple.security.cs.disable-library-validation

    The release assets also show the Mac zips were signed and uploaded by hand on 2026-10-30, seven weeks after the release was published on 2026-09-10. They weren't produced by the package.yml workflow, which builds an unsigned app and never launches the signed bundle.

    The fix Claude applied, which confirms the cause

    I took the unmodified 2.2.1 ARM64 bundle and re-signed only the launcher with the four entitlements 2.2.0 had:

    cat > entitlements.plist <<'EOF'
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0"><dict>
      <key>com.apple.security.cs.allow-jit</key><true/>
      <key>com.apple.security.cs.allow-unsigned-executable-memory</key><true/>
      <key>com.apple.security.cs.disable-library-validation</key><true/>
      <key>com.apple.security.cs.allow-dyld-environment-variables</key><true/>
    </dict></plist>
    EOF
    
    codesign --force --options runtime --entitlements entitlements.plist -s - \
      CertWizard.app/Contents/MacOS/CertWizard

    Result: the JVM starts, SysProperty initialises, and CertWizard reaches the data-directory dialog as normal. Nothing else was changed: no rebuild, and the same runtime and jar.

    ⚠️ That's an ad-hoc signature, so it removes the STFC Developer ID and notarization. It's fine as a local workaround and as proof of the cause, but it's not something to redistribute. The real fix has to be done with the project's signing identity.

    Recommended fix for maintainers

    1. Short term: re-sign 2.2.1 (or cut 2.2.2) with entitlements, then notarize, staple and re-upload.
    Commit the plist above to the repo (e.g. src/main/packaging/macos/CertWizard.entitlements) so it can't be forgotten again, and sign with it:

    codesign --force --timestamp --options runtime \
      --entitlements src/main/packaging/macos/CertWizard.entitlements \
      --sign "Developer ID Application: The Science and Technology Facilities Council (F6C2P3VQP7)" \
      CertWizard.app/Contents/MacOS/CertWizard

    If you're signing with rcodesign (the pom comments suggest so), pass the same plist through its entitlements option for the main executable. Check rcodesign sign --help for the exact flag name in your version.

    2. Better: let jpackage sign it, in CI.
    jpackage already knows how to sign a Java app correctly, and its default entitlements include allow-jit. Add these to the existing jpackage-mac-app-image execution:

    --mac-sign
    --mac-signing-key-user-name "The Science and Technology Facilities Council (F6C2P3VQP7)"
    --mac-entitlements src/main/packaging/macos/CertWizard.entitlements
    

    Then import the Developer ID cert into a temporary keychain from repository secrets, and notarize with xcrun notarytool submit --wait plus xcrun stapler staple, all inside package.yml. That way the published assets are the artifacts CI actually built, not hand-signed zips swapped onto a release weeks later.

    3. Add a release gate that would have caught this. Run it on both the macos-latest (ARM64) and macos-26-intel jobs, after signing, against the exact bundle that gets uploaded:

    - name: Verify signed bundle has JVM entitlements
      run: |
        codesign -d --entitlements - --xml target/CertWizard.app/Contents/MacOS/CertWizard \
          | grep -q com.apple.security.cs.allow-jit \
          || { echo "::error::CertWizard launcher is missing com.apple.security.cs.allow-jit"; exit 1; }
    
    - name: Smoke-test launch of the signed bundle
      run: |
        mkdir -p "$RUNNER_TEMP/cw-data"
        target/CertWizard.app/Contents/MacOS/CertWizard "$RUNNER_TEMP/cw-data" &
        pid=$!
        sleep 15
        if ! kill -0 "$pid" 2>/dev/null; then
          wait "$pid"; echo "::error::CertWizard exited on launch (code $?)"; exit 1
        fi
        kill "$pid"

    I ran the entitlement check against the real downloads. It fails both 2.2.1 Mac zips and passes 2.2.0 and the re-signed 2.2.1, so it separates good builds from bad ones exactly. The launch test needs no app changes, because the bad build dies within a second in JNI_CreateJavaVM. A --self-test flag that starts up and exits 0 would make it cleaner.

    4. Small release-hygiene items spotted along the way:

    • Publish SHA-256 checksums alongside the assets.
    • Don't silently replace assets on an already-published release.
    • The tag is 2.2.1 while all earlier tags are vX.Y.Z.
    • package.yml's version_tag default still says v2.2.0.

    Until a fixed build is out, Mac users can stay on 2.2.0. Bear in mind that 2.2.0 still has the PPPK renewal bug fixed in #66, which matters if your keystore holds the same certificate under two aliases, as can happen after migrating between machines.

  2. changed the title [-]CertWizard 2.2.1 crashes on first launch MacOS 27.2 (26B123) A4[/-] [+]CertWizard 2.2.1 crashes on first launch MacOS 27.2 (26B123) A64[/+] on Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions