Skip to content

Add cross-platform macOS code signing with rcodesign fallback#446

Merged
shannah merged 7 commits intomasterfrom
claude/add-rcodesign-fallback-ZK6Xq
Mar 26, 2026
Merged

Add cross-platform macOS code signing with rcodesign fallback#446
shannah merged 7 commits intomasterfrom
claude/add-rcodesign-fallback-ZK6Xq

Conversation

@shannah
Copy link
Copy Markdown
Owner

@shannah shannah commented Mar 22, 2026

Summary

This PR adds support for cross-platform macOS code signing using rcodesign as a fallback to Apple's native codesign tool. This enables code signing on non-macOS platforms (Linux, Windows) and provides a testing mechanism for the macOS signing workflow.

Key Changes

Core Implementation

  • RcodesignConfig.java (new) - Configuration and availability detection for rcodesign, with environment variable support for P12 certificates and API credentials
  • RcodesignSigner.java (new) - Signs macOS app bundles using rcodesign with support for entitlements and runtime flags
  • RcodesignNotaryTool.java (new) - Notarizes macOS apps using rcodesign as a cross-platform alternative to xcrun notarytool

MacBundler Updates

  • Modified MacBundler.java to support dual signing paths:
    • Native codesign on macOS (preferred when available)
    • rcodesign fallback on non-macOS platforms or when forced via JDEPLOY_FORCE_RCODESIGN
  • Moved JRE bundling and JCEF framework copying outside platform-specific blocks to work cross-platform
  • Refactored code signing logic to use abstracted signer interface

File Handling

  • Updated MacOSFileHandler.copyOrExtract() to work on all platforms (not just macOS), enabling JRE and framework bundling on Linux/Windows for macOS app creation

Testing & Documentation

  • Added comprehensive test skill documentation:
    • test-mac-codesigning/skill.md - Dedicated macOS code signing tests with self-signed certificates
    • test-full-publishing/skill.md - Full publishing workflow combining Windows Authenticode and macOS signing
  • Added RcodesignConfigTest.java for environment variable validation

Environment Variables

New environment variables for rcodesign configuration:

  • JDEPLOY_RCODESIGN_P12_FILE - Path to PKCS#12 certificate
  • JDEPLOY_RCODESIGN_P12_PASSWORD - P12 password
  • JDEPLOY_RCODESIGN_API_KEY_PATH - App Store Connect API key JSON
  • JDEPLOY_RCODESIGN_API_ISSUER / JDEPLOY_RCODESIGN_API_KEY - API credentials
  • JDEPLOY_FORCE_RCODESIGN - Force rcodesign even on macOS (for testing)

Implementation Details

  • Signing path selection is automatic: native codesign on macOS (if available), rcodesign fallback otherwise
  • Both signers support entitlements files and runtime code signature flags
  • Cross-platform file operations use cp -a / unzip on non-macOS instead of ditto
  • Self-signed certificates are supported for testing; production use requires valid Apple Developer certificates

https://claude.ai/code/session_01TV1XGgx68MVH2Z9KboWurV

claude and others added 7 commits March 18, 2026 00:48
When not running on macOS, the Mac bundler now falls back to rcodesign
for code signing and notarization if the tool is installed and
credentials are configured via environment variables:

- JDEPLOY_RCODESIGN_P12_FILE: path to PKCS#12 certificate file
- JDEPLOY_RCODESIGN_P12_PASSWORD: password for the P12 file
- JDEPLOY_RCODESIGN_API_KEY_PATH: App Store Connect API key JSON file
- JDEPLOY_RCODESIGN_API_ISSUER + JDEPLOY_RCODESIGN_API_KEY: inline API credentials

https://claude.ai/code/session_01TV1XGgx68MVH2Z9KboWurV
- MacOSFileHandler: remove macOS-only restriction, use `cp -a` and
  `unzip` as fallbacks for `ditto` on non-Mac platforms
- MacBundler: move JRE bundling and JCEF framework copying out of the
  isMac() gate so they run on all platforms; xattr removal remains
  macOS-only
- copyJcefFrameworks: use `cp -a` instead of `ditto` on non-Mac

https://claude.ai/code/session_01TV1XGgx68MVH2Z9KboWurV
Adds a skill that tests both the native codesign path (macOS) and the
rcodesign fallback path (cross-platform) using self-signed certificates.
Supports local testing and CI via GitHub Actions.

https://claude.ai/code/session_01TV1XGgx68MVH2Z9KboWurV
The loadAppInfo() method was missing the code signing settings transfer
from package.json to AppInfo, causing bundles built via github-prepare-release
to skip code signing even when codesign: true was set.

This aligns with PackageService which already handles these settings.
Adds a new environment variable JDEPLOY_FORCE_RCODESIGN that when set to
"true" forces the use of rcodesign for code signing even on macOS. This
makes it easier to test the rcodesign code path without needing Linux.

Also fixes rcodesign signing to only sign the .app bundle, not individual
non-Mach-O files like app.xml (which rcodesign doesn't support).
Black-box reference covering both native codesign and rcodesign paths,
credential configuration, entitlements, notarization flow, CI examples,
and the decision logic for backend selection.

https://claude.ai/code/session_01TV1XGgx68MVH2Z9KboWurV
@shannah shannah merged commit aa50110 into master Mar 26, 2026
17 checks passed
@shannah shannah deleted the claude/add-rcodesign-fallback-ZK6Xq branch March 26, 2026 13:33
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.

2 participants