Skip to content

add notarization directly to CI and cleanup - #8486

Merged
jpfeuffer merged 2 commits into
OpenMS:developfrom
jpfeuffer:fix/notarization
Dec 13, 2025
Merged

jpfeuffer merged 2 commits into
OpenMS:developfrom
jpfeuffer:fix/notarization

Conversation

@jpfeuffer

@jpfeuffer jpfeuffer commented Dec 12, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Improved macOS signing and automated notarization for packaged releases, including verification and stapling to ensure installable, trusted apps.
  • Documentation

    • Added a detailed macOS code signing and notarization guide with prerequisites, setup steps, testing commands, and troubleshooting.
  • Chores

    • CI/build packaging updated to use the new signing/notarization flow and to expose relevant configuration for macOS releases.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Dec 12, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

Switches macOS signing to Developer ID certificates, adds notarytool-based notarization scripts and CI notarization steps, updates CMake packaging logic and env var caching, and adds macOS signing/notarization documentation.

Changes

Cohort / File(s) Change Summary
CI Workflow
\.github/workflows/openms_ci_matrix_full.yml
Replace Apple Development certs with Developer ID certs, import Developer ID certificates into keychain, update secret names/passphrases, and add a Notarize macOS Package step that locates .pkg, runs notarize script, and verifies notarization.
Notarization tooling
cmake/MacOSX/notarize.sh, cmake/MacOSX/notarize_app.sh
Add notarize.sh (notarytool-based submission/stapling/logging/cleanup). Remove the old notarize_app.sh (altool-based). Update callers to use notarize.sh.
CMake packaging logic
CMakeLists.txt, cmake/package_dragndrop_dmg.cmake, cmake/package_mac_productbuild.cmake, src/openms_gui/add_mac_bundle.cmake
Simplify signing guard to require only SIGNING_IDENTITY; add conditional notarization path when SIGNING_EMAIL present; switch packaging to use notarize.sh; enable CPACK productbuild background options; remove finalized_dist target.
CI env & packaging config
tools/ci/capture-env.sh, tools/ci/cipackage.cmake
Add SIGNING_EMAIL and CPACK_PRODUCTBUILD_IDENTITY_NAME to captured env vars and load CPACK_PRODUCTBUILD_IDENTITY_NAME into CMake configuration. (Note: tools/ci/cipackage.cmake edit removed an endif().)
Documentation
cmake/MacOSX/README.md
Add detailed macOS Code Signing and Notarization section covering prerequisites, secrets, exporting certificates, identity discovery, app-specific passwords, testing, troubleshooting, and related files.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    actor CI as CI Workflow
    participant GH as GitHub Actions
    participant Build as CMake Build
    participant Pack as CPACK (dmg/pkg)
    participant Sign as Codesign / Keychain
    participant Notary as Apple Notary (notarytool)

    GH->>CI: run matrix job
    CI->>Sign: import Developer ID certs into keychain
    CI->>Build: configure with SIGNING_IDENTITY (+ optional SIGNING_EMAIL)
    Build->>Pack: produce .dmg / .pkg
    Pack->>Sign: codesign artifacts using Developer ID Application
    alt SIGNING_EMAIL set (notarization path)
        Sign->>Notary: notarize.sh submits artifact via notarytool (--wait)
        Notary-->>Sign: notarization result
        Sign->>Pack: staple ticket to artifact (if applicable)
    else no SIGNING_EMAIL (sign-only)
        Sign-->>Pack: signed artifact (no notarization)
    end
    Pack-->>GH: upload artifacts
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

  • Files needing extra attention:
    • tools/ci/cipackage.cmake — missing endif() likely introduces CMake syntax error.
    • cmake/MacOSX/notarize.sh — verify argument handling, temp-file cleanup, stapling and log capture.
    • CI workflow changes — keychain import, secret names, and notarization step in GitHub Actions context.
    • Packaging conditionals — ensure SIGNING_IDENTITY / SIGNING_EMAIL propagation across dmg/pkg/app paths.

Possibly related PRs

Suggested reviewers

  • poshul
  • timosachsenberg

Poem

🐰 I hopped into keys and certs so bright,
Swapped Apple Dev for Developer ID tonight.
I signed, I stapled, logs I did keep,
CI hummed, macOS dreams didn't sleep.
A tiny rabbit cheers — builds leap! ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'add notarization directly to CI and cleanup' accurately summarizes the main changes: it introduces notarization into the CI/CD workflow and removes/refactors obsolete components like the old notarize_app.sh script.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jpfeuffer

Copy link
Copy Markdown
Contributor Author

@poshul Can you please add the correct certificates and names and passwords and emails?
Most of them are probably the same as to before but I think the wrong certificate was used (Apple Developer instead of the correct Developer Application ID).
Additionally we need Developer Installer ID now.

@jpfeuffer
jpfeuffer requested a review from poshul December 12, 2025 17:44

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tools/ci/cipackage.cmake (1)

14-20: Quote/escape env-derived CMake -D values (SIGNING_IDENTITY / CPACK_PRODUCTBUILD_IDENTITY_NAME commonly contain spaces).
As written, identities like Developer ID Application: OpenMS Inc. (C64UCGJ5PL) are likely to be split into multiple arguments during ctest_configure, causing misconfiguration.

 set(CONFIGURE_OPTIONS)
 set(VARS_TO_LOAD PACKAGE_TYPE SEARCH_ENGINES_DIRECTORY SIGNING_IDENTITY SIGNING_EMAIL CPACK_PRODUCTBUILD_IDENTITY_NAME)
 foreach(VAR ${VARS_TO_LOAD})
-  if(DEFINED ENV{${VAR}})
-    list(APPEND CONFIGURE_OPTIONS "-D${VAR}=$ENV{${VAR}}")
+  if(DEFINED ENV{${VAR}} AND NOT "$ENV{${VAR}}" STREQUAL "")
+    set(_val "$ENV{${VAR}}")
+    string(REPLACE "\\" "\\\\" _val "${_val}")
+    string(REPLACE "\"" "\\\"" _val "${_val}")
+    list(APPEND CONFIGURE_OPTIONS "-D${VAR}:STRING=${_val}")
   endif()
 endforeach()
@@
-ctest_configure(OPTIONS "${CONFIGURE_OPTIONS}" RETURN_VALUE _reconfig_package_ret_val)
+ctest_configure(OPTIONS "${CONFIGURE_OPTIONS}" RETURN_VALUE _reconfig_package_ret_val)

If this still breaks in your runner (depends on how ctest_configure tokenizes OPTIONS), the fallback is to build a single options string and wrap values in quotes: -DVAR:STRING=\"...\".

Also applies to: 38-38

🧹 Nitpick comments (2)
cmake/MacOSX/notarize.sh (2)

22-26: Make temp artifact cleanup and logging more robust (trap + per-run log filename + validate .app input).
This avoids leaving ${BUNDLE_PKG}.zip behind on unexpected exits and prevents concurrent runs from clobbering notarize.log. Also check the .app directory exists before ditto.

-NOTARIZE_LOG="$LOG_FOLDER/notarize.log"
+RUN_ID="$(date +%Y%m%d-%H%M%S)"
+NOTARIZE_LOG="$LOG_FOLDER/notarize-${RUN_ID}.log"
@@
-REMOVE_PKG=false
+REMOVE_PKG=false
+cleanup() {
+  if [ "$REMOVE_PKG" = true ]; then
+    rm -f "$BUNDLE_PKG"
+  fi
+}
+trap cleanup EXIT
@@
 elif [[ $BUNDLE_PKG == *.app ]]; then
     # Apps need to be zipped for upload, then unzipped for stapling
     BUNDLE_FILE=$BUNDLE_PKG
+    if [[ ! -d "$BUNDLE_FILE" ]]; then
+        echo "Error: App bundle not found (expected directory): $BUNDLE_FILE"
+        exit 1
+    fi
     BUNDLE_PKG="${BUNDLE_PKG}.zip"

Also applies to: 60-67, 122-126, 150-154, 161-165


83-90: Prefer notarytool JSON output for parsing submission id (grep on human output is brittle).
If Apple adjusts the CLI output, grep -o 'id: ...' may stop working. Consider --output-format json and extracting id reliably.

Also applies to: 134-147

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7b3b692 and 33cc19d.

📒 Files selected for processing (9)
  • .github/workflows/openms_ci_matrix_full.yml (3 hunks)
  • CMakeLists.txt (1 hunks)
  • cmake/MacOSX/README.md (1 hunks)
  • cmake/MacOSX/notarize.sh (1 hunks)
  • cmake/MacOSX/notarize_app.sh (1 hunks)
  • cmake/package_dragndrop_dmg.cmake (1 hunks)
  • cmake/package_mac_productbuild.cmake (1 hunks)
  • tools/ci/capture-env.sh (1 hunks)
  • tools/ci/cipackage.cmake (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.9)
.github/workflows/openms_ci_matrix_full.yml

575-575: shellcheck reported issue in this script: SC2012:info:5:12: Use find instead of ls to better handle non-alphanumeric filenames

(shellcheck)


575-575: shellcheck reported issue in this script: SC2035:info:5:18: Use ./glob or -- glob so names with dashes won't become options

(shellcheck)


575-575: shellcheck reported issue in this script: SC2086:info:15:1: Double quote to prevent globbing and word splitting

(shellcheck)


575-575: shellcheck reported issue in this script: SC2086:info:2:4: Double quote to prevent globbing and word splitting

(shellcheck)

🪛 markdownlint-cli2 (0.18.1)
cmake/MacOSX/README.md

13-13: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


17-17: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


19-19: Bare URL used

(MD034, no-bare-urls)


25-25: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


46-46: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


55-55: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


64-64: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


73-73: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


77-77: Bare URL used

(MD034, no-bare-urls)


81-81: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


100-100: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


102-102: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


106-106: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


110-110: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


114-114: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)

🔇 Additional comments (3)
cmake/package_mac_productbuild.cmake (1)

19-22: Ensure CMake/CPack version support + background asset availability for productbuild options.
Please confirm the CI CMake version used for macOS packaging honors CPACK_PRODUCTBUILD_BACKGROUND*, and that ${OPENMS_LOGOSMALL_NAME} resolves to an existing file under CPACK_PRODUCTBUILD_RESOURCES_DIR.

CMakeLists.txt (1)

309-332: LGTM: clearer separation of “signing required” vs “notarization optional”.
The SIGNING_IDENTITY handling (including treating "-" as unset) and the explicit SIGNING_EMAIL not set => notarization skipped messaging reads consistent for dmg/pkg packaging.

.github/workflows/openms_ci_matrix_full.yml (1)

511-537: Certificate import looks reasonable; please confirm keychain partition list covers productsign on all runners.

The dual-cert import and -T /usr/bin/productsign addition are good; the remaining fragility is whether security set-key-partition-list ... is sufficient for both codesign and productsign in this environment (runner image / Xcode version variability).

Comment on lines +568 to +603
# Notarize macOS packages for Gatekeeper approval
# This step submits the signed package to Apple for notarization and staples the ticket
- name: Notarize macOS Package
if: steps.set-vars.outputs.pkg_type == 'pkg' && startsWith(matrix.os, 'macos')
shell: bash
env:
CODESIGNPW: ${{ secrets.APPLE_NOTARIZATION_PASSWORD }}
run: |
echo "=== Starting macOS package notarization ==="
cd $GITHUB_WORKSPACE/OpenMS/bld/

# Find the generated .pkg file
PKG_FILE=$(ls -1 *.pkg 2>/dev/null | head -1)
if [[ -z "$PKG_FILE" ]]; then
echo "Error: No .pkg file found in build directory"
ls -la
exit 1
fi

echo "Found package: $PKG_FILE"

# Run notarization script
$GITHUB_WORKSPACE/OpenMS/cmake/MacOSX/notarize.sh \
"$PKG_FILE" \
"de.openms" \
"[email protected]" \
"CODESIGNPW" \
"$GITHUB_WORKSPACE/OpenMS/bld/"

echo "=== Notarization complete ==="

# Verify the notarization
echo "=== Verifying package signing and notarization ==="
pkgutil --check-signature "$PKG_FILE" || echo "Warning: pkgutil verification returned non-zero"
spctl -a -vvv -t install "$PKG_FILE" || echo "Warning: spctl assessment returned non-zero"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# First, retrieve the workflow file content at the specified lines
cat -n .github/workflows/openms_ci_matrix_full.yml | sed -n '560,610p'

Repository: OpenMS/OpenMS

Length of output: 2840


🏁 Script executed:

# Check if notarize.sh exists and its implementation
find . -name "notarize.sh" -type f

Repository: OpenMS/OpenMS

Length of output: 83


🏁 Script executed:

# Check for branch/event conditionals in the workflow to understand PR vs nightly logic
grep -n "on:\|if:\|push:\|schedule:\|github.event" .github/workflows/openms_ci_matrix_full.yml | head -30

Repository: OpenMS/OpenMS

Length of output: 2521


🏁 Script executed:

# Examine the notarize.sh script to ensure it handles quoted paths correctly
head -50 ./cmake/MacOSX/notarize.sh

Repository: OpenMS/OpenMS

Length of output: 1667


Fix shell script robustness in macOS notarization step: quote variables, use find for file discovery, and treat verification failures as fatal.

Lines 577, 580, 590, 601–602 have issues that can mask notarization failures:

  • Line 577: cd $GITHUB_WORKSPACE/OpenMS/bld/ → quote variable
  • Line 580: ls -1 *.pkg is fragile; use find . -maxdepth 1 -type f -name '*.pkg' instead
  • Line 590: quote the script path: "$GITHUB_WORKSPACE/OpenMS/cmake/MacOSX/notarize.sh"
  • Lines 601–602: remove || echo "Warning" — verification commands should fail the build on errors, not just log warnings

Additionally, consider adding branch-specific logic to enforce fatal verification only for nightly and release builds, while allowing non-fatal checks on PRs (currently all branches treat verification failures as warnings).

🧰 Tools
🪛 actionlint (1.7.9)

575-575: shellcheck reported issue in this script: SC2012:info:5:12: Use find instead of ls to better handle non-alphanumeric filenames

(shellcheck)


575-575: shellcheck reported issue in this script: SC2035:info:5:18: Use ./glob or -- glob so names with dashes won't become options

(shellcheck)


575-575: shellcheck reported issue in this script: SC2086:info:15:1: Double quote to prevent globbing and word splitting

(shellcheck)


575-575: shellcheck reported issue in this script: SC2086:info:2:4: Double quote to prevent globbing and word splitting

(shellcheck)

🤖 Prompt for AI Agents
.github/workflows/openms_ci_matrix_full.yml around lines 568 to 603: the macOS
notarization step is fragile and masks failures; update the script to (1) quote
$GITHUB_WORKSPACE in the cd command, (2) discover the .pkg using a robust find
command (e.g. find . -maxdepth 1 -type f -name '*.pkg' and pick the first
result) instead of ls, (3) quote the path to the notarize.sh script when
invoking it, and (4) make pkgutil and spctl failures fatal by removing the "||
echo 'Warning...'" fallbacks (optionally gate fatal vs non-fatal behavior by
branch/type so PRs can remain non-blocking while nightly/release runs enforce
fatal verification).

Comment thread cmake/MacOSX/notarize_app.sh Outdated
Comment on lines 15 to 23
set -e

BUNDLE_PKG="$1"
BUNDLE_ID="$2"
ASC_USERNAME="$3"
## currently only supports providing PW through an env. variable
ASC_PASSWORD_ENVVAR="$4"
TEAM_ID="$5"
LOG_FOLDER="${6:-.}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

find . -name "notarize_app.sh" -type f

Repository: OpenMS/OpenMS

Length of output: 87


🏁 Script executed:

cat -n ./cmake/MacOSX/notarize_app.sh

Repository: OpenMS/OpenMS

Length of output: 7046


🏁 Script executed:

# Test the string manipulation for ZIP files
python3 << 'EOF'
# Simulate the bash behavior
BUNDLE_PKG = "myfile.zip"
BUNDLE_FILE = BUNDLE_PKG.rsplit('.', 1)[0]  # ${BUNDLE_PKG%.*}
print(f"Input: {BUNDLE_PKG}")
print(f"BUNDLE_FILE after removal: {BUNDLE_FILE}")
print(f"Does BUNDLE_FILE end with .zip? {BUNDLE_FILE.endswith('.zip')}")

# Now test the condition
if BUNDLE_FILE.endswith(".zip"):
    print("Condition is TRUE - will show 'cannot staple' warning")
else:
    print("Condition is FALSE - will attempt to staple non-existent file")
EOF

Repository: OpenMS/OpenMS

Length of output: 208


🏁 Script executed:

# Verify the actual pipeline behavior with set -e but no pipefail
# Create a test to show the issue
bash << 'EOF'
set -e

# Simulate the notarytool + tee scenario
echo "Testing pipeline without pipefail:"
(
  set -e
  # This will fail but tee will succeed
  false | tee /tmp/test.log
  echo "This should not print if pipefail was set"
) && echo "Pipeline succeeded despite false command" || echo "Pipeline failed"

echo ""
echo "Testing pipeline WITH pipefail:"
(
  set -e
  set -o pipefail
  false | tee /tmp/test.log
  echo "This should not print"
) && echo "Pipeline succeeded" || echo "Pipeline failed (as expected)"
EOF

Repository: OpenMS/OpenMS

Length of output: 340


Critical: add set -o pipefail to prevent masking notarytool failures.

Without it, the pipeline xcrun notarytool submit ... | tee will report success even if notarytool fails, because the exit status is determined by tee (which almost always succeeds). The script will then proceed to check logs instead of exiting with an error. Add set -o pipefail at line 16 to ensure pipeline failures propagate.

set -e
+set -o pipefail

Also critical: fix ZIP handling logic at lines 59–61 and 108.

When the input is a .zip file, line 61 strips the extension: BUNDLE_FILE=${BUNDLE_PKG%.*} makes file.zip become file. The condition at line 108 then checks if [[ "$BUNDLE_FILE" == *.zip ]], which is always false for actual zip inputs. This causes the script to attempt stapling a non-existent file instead of warning that zips cannot be stapled. Preserve the .zip extension in BUNDLE_FILE or fix the condition to check the original filename.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
set -e
BUNDLE_PKG="$1"
BUNDLE_ID="$2"
ASC_USERNAME="$3"
## currently only supports providing PW through an env. variable
ASC_PASSWORD_ENVVAR="$4"
TEAM_ID="$5"
LOG_FOLDER="${6:-.}"
set -e
set -o pipefail
BUNDLE_PKG="$1"
BUNDLE_ID="$2"
ASC_USERNAME="$3"
ASC_PASSWORD_ENVVAR="$4"
TEAM_ID="$5"
LOG_FOLDER="${6:-.}"
🤖 Prompt for AI Agents
In cmake/MacOSX/notarize_app.sh around lines 15 to 23, add set -o pipefail (at
line 16) alongside set -e so pipeline failures (like xcrun notarytool ... | tee)
propagate and cause the script to exit; and in the ZIP handling around lines
59–61 and the stapling check at line 108, stop stripping the .zip extension from
the original filename (or retain the original input variable) so BUNDLE_FILE
preserves the .zip suffix, or alternatively change the stapling condition to
test the original input variable (BUNDLE_PKG) for *.zip; ensure the logic
warns/avoids stapling when the package is a zip and only attempts stapling for
an actual .app/.pkg bundle.

Comment thread cmake/MacOSX/notarize_app.sh Outdated
Comment on lines 59 to 75
elif [[ $BUNDLE_PKG == *.zip ]]; then
# For zip files, we need to unzip to staple, then re-zip
BUNDLE_FILE=${BUNDLE_PKG%.*}
echo "Notarizing ZIP: $BUNDLE_PKG (will staple contents)"
elif [[ $BUNDLE_PKG == *.app ]]; then
# Apps need to be zipped for upload, then unzipped for stapling
BUNDLE_FILE=$BUNDLE_PKG
BUNDLE_PKG="${BUNDLE_PKG}.zip"
echo "Zipping app bundle for notarization..."
ditto -c -k --rsrc --keepParent "$BUNDLE_FILE" "$BUNDLE_PKG"
REMOVE_PKG=true
echo "Notarizing APP (via ZIP): $BUNDLE_PKG"
else
echo "Unsupported filetype for notarization. $BUNDLE_PKG"
exit 1
echo "Error: Unsupported filetype for notarization: $BUNDLE_PKG"
echo "Supported types: .dmg, .pkg, .zip, .app"
exit 1
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

find . -name "notarize_app.sh" -type f

Repository: OpenMS/OpenMS

Length of output: 87


🏁 Script executed:

fd "notarize_app.sh"

Repository: OpenMS/OpenMS

Length of output: 85


🏁 Script executed:

find . -path "*cmake/MacOSX*" -type f 2>/dev/null | head -20

Repository: OpenMS/OpenMS

Length of output: 633


🏁 Script executed:

git ls-files | grep -i notarize

Repository: OpenMS/OpenMS

Length of output: 110


🏁 Script executed:

git ls-files | grep cmake | head -30

Repository: OpenMS/OpenMS

Length of output: 989


🏁 Script executed:

git ls-files | head -50

Repository: OpenMS/OpenMS

Length of output: 1304


🏁 Script executed:

ls -la cmake/ 2>/dev/null || echo "cmake/ not found at root"

Repository: OpenMS/OpenMS

Length of output: 2560


🏁 Script executed:

find . -type d -name cmake 2>/dev/null

Repository: OpenMS/OpenMS

Length of output: 187


🏁 Script executed:

find . -type f -name "*.sh" 2>/dev/null | head -20

Repository: OpenMS/OpenMS

Length of output: 782


🏁 Script executed:

git ls-tree -r HEAD | grep -i "\.sh$" | head -20

Repository: OpenMS/OpenMS

Length of output: 1802


🏁 Script executed:

ls -la

Repository: OpenMS/OpenMS

Length of output: 2488


🏁 Script executed:

cat > /tmp/test_logic.sh << 'EOF'
#!/bin/bash

# Test the logic mentioned in the review
BUNDLE_PKG="test.zip"

# What the code does:
BUNDLE_FILE=${BUNDLE_PKG%.*}
echo "BUNDLE_PKG=$BUNDLE_PKG"
echo "BUNDLE_FILE=$BUNDLE_FILE (after ${BUNDLE_PKG%.*})"

# Check if BUNDLE_FILE would match *.zip condition
if [[ "$BUNDLE_FILE" == *.zip ]]; then
    echo "BUNDLE_FILE matches *.zip pattern: YES"
else
    echo "BUNDLE_FILE matches *.zip pattern: NO"
fi

# This demonstrates the issue - BUNDLE_FILE will be "test" not "test.zip"
echo ""
echo "The issue: BUNDLE_FILE becomes 'test', not 'test.zip', so the condition fails"
EOF
bash /tmp/test_logic.sh

Repository: OpenMS/OpenMS

Length of output: 223


🏁 Script executed:

rg "notarize" --type sh 2>/dev/null | head -20

Repository: OpenMS/OpenMS

Length of output: 806


🏁 Script executed:

rg "notarize" 2>/dev/null | head -20

Repository: OpenMS/OpenMS

Length of output: 2215


🏁 Script executed:

git status

Repository: OpenMS/OpenMS

Length of output: 280


🏁 Script executed:

bash << 'EOF'
# Verify the core issue: parameter expansion ${BUNDLE_PKG%.*} removes the extension

echo "=== Test Case 1: ZIP file ==="
BUNDLE_PKG="app.zip"
BUNDLE_FILE=${BUNDLE_PKG%.*}
echo "Input: $BUNDLE_PKG"
echo "After ${BUNDLE_PKG%.*}: $BUNDLE_FILE"
echo "Does BUNDLE_FILE match *.zip? "
[[ "$BUNDLE_FILE" == *.zip ]] && echo "YES" || echo "NO (this is the bug!)"

echo ""
echo "=== Test Case 2: DMG file ==="
BUNDLE_PKG="app.dmg"
BUNDLE_FILE=${BUNDLE_PKG%.*}
echo "Input: $BUNDLE_PKG"
echo "After ${BUNDLE_PKG%.*}: $BUNDLE_FILE"
[[ "$BUNDLE_FILE" == *.dmg ]] && echo "Would match *.dmg? YES" || echo "Would match *.dmg? NO"

echo ""
echo "=== Test Case 3: APP directory (no extension) ==="
BUNDLE_PKG="MyApp.app"
BUNDLE_FILE=${BUNDLE_PKG%.*}
echo "Input: $BUNDLE_PKG"
echo "After ${BUNDLE_PKG%.*}: $BUNDLE_FILE"
[[ "$BUNDLE_FILE" == *.app ]] && echo "Would match *.app? YES" || echo "Would match *.app? NO"
EOF

Repository: OpenMS/OpenMS

Length of output: 361


🏁 Script executed:

git branch -a

Repository: OpenMS/OpenMS

Length of output: 181


🏁 Script executed:

git stash list

Repository: OpenMS/OpenMS

Length of output: 39


🏁 Script executed:

wc -l cmake/MacOSX/notarize_app.sh

Repository: OpenMS/OpenMS

Length of output: 89


🏁 Script executed:

cat -n cmake/MacOSX/notarize_app.sh

Repository: OpenMS/OpenMS

Length of output: 7046


🏁 Script executed:

sed -n '59,75p' cmake/MacOSX/notarize_app.sh

Repository: OpenMS/OpenMS

Length of output: 742


🏁 Script executed:

sed -n '106,123p' cmake/MacOSX/notarize_app.sh

Repository: OpenMS/OpenMS

Length of output: 964


🏁 Script executed:

sed -n '50,130p' cmake/MacOSX/notarize_app.sh | cat -n

Repository: OpenMS/OpenMS

Length of output: 3494


🏁 Script executed:

sed -n '40,150p' cmake/MacOSX/notarize_app.sh | cat -n

Repository: OpenMS/OpenMS

Length of output: 4981


🏁 Script executed:

cat cmake/MacOSX/notarize_app.sh

Repository: OpenMS/OpenMS

Length of output: 5849


🏁 Script executed:

python3 << 'EOF'
with open('cmake/MacOSX/notarize_app.sh', 'r') as f:
    lines = f.readlines()
    
# Show lines 59-75
print("=== Lines 59-75 ===")
for i in range(58, min(75, len(lines))):
    print(f"{i+1:3d}: {lines[i]}", end='')

print("\n=== Lines 100-130 ===")
for i in range(99, min(130, len(lines))):
    print(f"{i+1:3d}: {lines[i]}", end='')

# Check for stapling logic
print("\n\n=== Searching for stapling logic ===")
for i, line in enumerate(lines):
    if 'staple' in line.lower():
        print(f"{i+1:3d}: {line}", end='')
EOF

Repository: OpenMS/OpenMS

Length of output: 2820


🏁 Script executed:

head -200 cmake/MacOSX/notarize_app.sh | tail -150

Repository: OpenMS/OpenMS

Length of output: 5076


🏁 Script executed:

grep -n "BUNDLE_FILE\|BUNDLE_PKG\|\.zip\|staple" cmake/MacOSX/notarize_app.sh | head -50

Repository: OpenMS/OpenMS

Length of output: 1735


🏁 Script executed:

python3 << 'EOF'
import sys
with open('cmake/MacOSX/notarize_app.sh', 'r') as f:
    content = f.read()
    lines = content.split('\n')
    total = len(lines)
    print(f"Total lines: {total}\n")
    
    # Show specific sections
    print("="*60)
    print("LINES 55-80 (ZIP handling section)")
    print("="*60)
    for i in range(54, min(80, total)):
        print(f"{i+1:3d}: {lines[i]}")
    
    print("\n" + "="*60)
    print("LINES 100-130 (Stapling/validation section)")
    print("="*60)
    for i in range(99, min(130, total)):
        print(f"{i+1:3d}: {lines[i]}")
EOF

Repository: OpenMS/OpenMS

Length of output: 2857


ZIP handling broken: parameter expansion prevents the stapling guard from working.

Line 61 uses BUNDLE_FILE=${BUNDLE_PKG%.*}, which removes the file extension. For a .zip input, this produces the basename without extension (e.g., "myapp" from "myapp.zip"). This makes the condition at line 108 [[ "$BUNDLE_FILE" == *.zip ]] unreachable for .zip files, since BUNDLE_FILE will never contain the .zip extension.

Additionally, the comment at line 60 states the script will "unzip to staple, then re-zip," but no unzip/re-zip logic exists in the code.

Fix: Set BUNDLE_FILE=$BUNDLE_PKG for zip files (preserve the full filename), and update the comment to clarify that .zip files cannot be stapled locally.

Comment thread cmake/MacOSX/notarize_app.sh Outdated
Comment on lines +63 to +70
elif [[ $BUNDLE_PKG == *.app ]]; then
# Apps need to be zipped for upload, then unzipped for stapling
BUNDLE_FILE=$BUNDLE_PKG
BUNDLE_PKG="${BUNDLE_PKG}.zip"
echo "Zipping app bundle for notarization..."
ditto -c -k --rsrc --keepParent "$BUNDLE_FILE" "$BUNDLE_PKG"
REMOVE_PKG=true
echo "Notarizing APP (via ZIP): $BUNDLE_PKG"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Check .app existence before zipping (better error than ditto failure).

@@
 elif [[ $BUNDLE_PKG == *.app ]]; then
     # Apps need to be zipped for upload, then unzipped for stapling
     BUNDLE_FILE=$BUNDLE_PKG
+    if [[ ! -d "$BUNDLE_FILE" ]]; then
+        echo "Error: App bundle not found: $BUNDLE_FILE"
+        exit 1
+    fi
     BUNDLE_PKG="${BUNDLE_PKG}.zip"
     echo "Zipping app bundle for notarization..."
     ditto -c -k --rsrc --keepParent "$BUNDLE_FILE" "$BUNDLE_PKG"

Also applies to: 77-81

🤖 Prompt for AI Agents
In cmake/MacOSX/notarize_app.sh around lines 63 to 70 (and apply the same
pattern to the similar block at 77-81), the script calls ditto to zip a .app
without verifying the .app exists; add an existence check before zipping that
verifies the BUNDLE_FILE path is a directory and readable, and if not, print a
clear error to stderr and exit with a non-zero status; if it exists, proceed to
zip as before and keep REMOVE_PKG logic unchanged; mirror the same existence
check and error handling for the other .app-handling block at lines 77-81.

Comment thread cmake/MacOSX/notarize.sh
Comment on lines +14 to +20
set -e

BUNDLE_PKG="$1"
BUNDLE_ID="$2"
ASC_USERNAME="$3"
ASC_PASSWORD_ENVVAR="$4"
LOG_FOLDER="${5:-.}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# First, locate and read the notarize.sh file
find . -name "notarize.sh" -type f

Repository: OpenMS/OpenMS

Length of output: 83


🏁 Script executed:

cat -n ./cmake/MacOSX/notarize.sh

Repository: OpenMS/OpenMS

Length of output: 6876


🏁 Script executed:

cat > /tmp/test_pipe.sh << 'EOF'
#!/bin/bash

# Test 1: set -e without pipefail
echo "Test 1: set -e without pipefail"
set -e
(
  set -e
  if false | true; then
    echo "  Inside if block (should not reach if false fails)"
  else
    echo "  In else block"
  fi
  echo "  After if block (should not reach if false truly failed)"
) || echo "  Exited with error"

echo ""

# Test 2: set -e with pipefail
echo "Test 2: set -e with pipefail"
(
  set -e
  set -o pipefail
  if false | true; then
    echo "  Inside if block"
  else
    echo "  In else block"
  fi
  echo "  After if block"
) || echo "  Exited with error"
EOF

bash /tmp/test_pipe.sh

Repository: OpenMS/OpenMS

Length of output: 261


Add set -o pipefail to catch notarytool submission failures. Without it, xcrun notarytool submit | tee will enter the success branch even if notarytool fails, since only tee's exit status affects the if condition. The code currently relies on grepping the log for "status: Accepted" to detect failures, which is fragile and error-prone.

 set -e
+set -o pipefail

Also applies to: lines 86-91

🤖 Prompt for AI Agents
In cmake/MacOSX/notarize.sh around lines 14 to 20 (and also apply same change
around lines 86 to 91), the script uses pipelines like `xcrun notarytool submit
| tee` without pipefail, so a failing notarytool can be masked by a succeeding
tee; enable pipefail by adding `set -o pipefail` alongside the existing `set -e`
at the top of the script (and ensure any subshells/sections that re-enter piping
logic also have pipefail set) so the script exits on any command failure in a
pipeline, allowing the subsequent conditional logic to correctly detect
notarytool failures.

Comment thread cmake/MacOSX/notarize.sh
Comment on lines +56 to +60
elif [[ $BUNDLE_PKG == *.zip ]]; then
# For zip files, we need to unzip to staple, then re-zip
BUNDLE_FILE=${BUNDLE_PKG%.*}
echo "Notarizing ZIP: $BUNDLE_PKG (will staple contents)"
elif [[ $BUNDLE_PKG == *.app ]]; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

ZIP notarization path is broken (will try to staple a non-existent file; condition can never match).
For .zip, BUNDLE_FILE=${BUNDLE_PKG%.*} drops the extension, then the code (a) won’t take the “cannot staple zip” branch (Line 105), and (b) will attempt stapler staple "$BUNDLE_FILE" on a path that doesn’t exist. Decide whether ZIPs should be “submit-only” (no stapling) or implement unzip/staple/rezip.

 REMOVE_PKG=false
+IS_ZIP=false
@@
 elif [[ $BUNDLE_PKG == *.zip ]]; then
-    # For zip files, we need to unzip to staple, then re-zip
-    BUNDLE_FILE=${BUNDLE_PKG%.*}
-    echo "Notarizing ZIP: $BUNDLE_PKG (will staple contents)"
+    BUNDLE_FILE="$BUNDLE_PKG"
+    IS_ZIP=true
+    echo "Notarizing ZIP: $BUNDLE_PKG"
@@
-        if [[ "$BUNDLE_FILE" == *.zip ]]; then
+        if [[ "$IS_ZIP" = true ]]; then
             echo "Warning: Cannot staple a .zip file. The notarization is stored with Apple."
             echo "Users will need to be online for Gatekeeper to verify the notarization."
         else

Also applies to: 99-120

🤖 Prompt for AI Agents
In cmake/MacOSX/notarize.sh around lines 56-60 (and also review lines ~99-120),
the ZIP handling is broken because BUNDLE_FILE=${BUNDLE_PKG%.*} removes the .zip
extension which leads to attempting to staple a non-existent path and never
triggers the “cannot staple zip” branch; decide whether ZIPs should be
submit-only or be unzipped/stapled/re-zipped, then implement accordingly: for
submit-only, do not set BUNDLE_FILE (keep BUNDLE_PKG) and ensure the code calls
only xcrun altool/notarytool submit and skips stapler calls and the “cannot
staple zip” branch; for full stapling, add logic to create a temp dir, unzip
BUNDLE_PKG into it, identify the .app or bundle to staple, run stapler on that
path, re-zip the directory to a new output file, and clean up temp files,
updating subsequent conditionals/paths (including the checks around lines
99-120) to use the correct file names and not rely on the stripped extension.

Comment thread cmake/MacOSX/README.md
Comment on lines +11 to +118
---

## macOS Code Signing and Notarization

OpenMS packages for macOS are code signed and notarized to ensure users can run them without security warnings from Gatekeeper.

### Prerequisites

1. **Apple Developer Account** ($99/year) - https://developer.apple.com
2. **Xcode** installed with developer tools (`xcode-select --install`)
3. **Certificates** exported from Xcode:
- **Developer ID Application** - for signing binaries
- **Developer ID Installer** - for signing .pkg installers

### Required GitHub Secrets

For CI/CD, the following secrets must be configured in your GitHub repository.

**Note:** Only certificates and passwords need to be secrets. Identity strings and email addresses are public information.

| Secret | Description |
|--------|-------------|
| `APPLE_DEVELOPER_CERT_64` | Base64-encoded Developer ID Application .p12 certificate |
| `APPLE_DEVELOPMENT_PW` | Password for the Application certificate |
| `APPLE_INSTALLER_CERT_64` | Base64-encoded Developer ID Installer .p12 certificate |
| `APPLE_INSTALLER_PW` | Password for the Installer certificate |
| `APPLE_NOTARIZATION_PASSWORD` | App-specific password for notarization |
| `KEYCHAIN_PASSWORD` | Password for the temporary CI keychain |

The following are configured directly in the workflow (not secrets):
- **Signing Identity**: `Developer ID Application: OpenMS Inc. (C64UCGJ5PL)`
- **Installer Identity**: `Developer ID Installer: OpenMS Inc. (C64UCGJ5PL)`
- **Email**: `[email protected]`
- **Team ID**: `C64UCGJ5PL` (extracted from the identity string)

### Exporting Certificates

1. Open **Xcode → Settings → Accounts**
2. Select your Team and click **Manage Certificates**
3. Create or select **Developer ID Application** certificate
4. Right-click → **Export Certificate** → save as `.p12` with a password
5. Base64 encode for CI: `base64 -i certificate.p12 | pbcopy`
6. Repeat for **Developer ID Installer** certificate

### Finding Your Identity Strings and Team ID

Run this command to see your available signing identities:

```shell
security find-identity -v -p codesigning
```

Output example:
```
1) ABC123XYZ... "Developer ID Application: OpenMS Inc. (C64UCGJ5PL)"
2) DEF456ABC... "Developer ID Installer: OpenMS Inc. (C64UCGJ5PL)"
2 valid identities found
```

- The full quoted string is your identity (e.g., `Developer ID Application: OpenMS Inc. (C64UCGJ5PL)`)
- The 10-character code in parentheses is your Team ID (e.g., `C64UCGJ5PL`)

### Creating an App-Specific Password

For notarization, create an app-specific password:

1. Go to https://appleid.apple.com
2. Sign in → Security → App-Specific Passwords → Generate
3. Use this password for `APPLE_NOTARIZATION_PASSWORD`

### Local Testing

To test code signing locally:

```shell
# Sign a binary
codesign --force --options runtime --timestamp -s "Developer ID Application: Your Name (TEAMID)" /path/to/binary

# Verify signature
codesign -dv --verbose=4 /path/to/binary

# Notarize a package (requires CODESIGNPW environment variable)
export CODESIGNPW="your-app-specific-password"
./cmake/MacOSX/notarize.sh package.pkg de.openms [email protected] CODESIGNPW .

# Verify notarization
spctl -a -vvv -t install package.pkg
```

### Troubleshooting

**"The specified item could not be found in the keychain"**
- Ensure the certificate is imported in the keychain
- Verify the identity string matches exactly (run `security find-identity -v`)

**Notarization fails with "Invalid"**
- Check if all binaries inside the package are signed with hardened runtime
- Get detailed log: `xcrun notarytool log <submission-id> --apple-id EMAIL --password PW --team-id TEAM log.json`

**"Developer cannot be verified" warning for users**
- The package was not notarized or stapling failed
- Users can override: System Settings → Privacy & Security → Allow

### Files in this Directory

- `notarize.sh` - Script for notarizing packages (.pkg, .dmg, .zip) using notarytool
- `sign_bins_and_libs.rb` - Ruby script to sign all binaries in a directory
- `fix_dependencies.rb` - Script to fix library paths for distribution

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Align docs with script env-var naming + fix markdownlint findings (bare URLs / missing fence language / emphasis-as-heading).
Right now CI uses APPLE_NOTARIZATION_PASSWORD (secret) but the local example uses CODESIGNPW as the env var name; since notarize.sh takes the env var name as an argument, consider standardizing the docs on one name (or explicitly show both patterns). Also, markdownlint flags (MD034/MD040/MD036/MD003) are all in the added section and should be quick cleanups.

🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

13-13: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


17-17: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


19-19: Bare URL used

(MD034, no-bare-urls)


25-25: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


46-46: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


55-55: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


64-64: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


73-73: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


77-77: Bare URL used

(MD034, no-bare-urls)


81-81: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


100-100: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


102-102: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


106-106: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


110-110: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


114-114: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)

🤖 Prompt for AI Agents
In cmake/MacOSX/README.md around lines 11–118, the docs use inconsistent env-var
names (CODESIGNPW vs APPLE_NOTARIZATION_PASSWORD) and contain markdownlint
issues (MD034, MD040, MD036, MD003); update the examples to consistently show
the CI secret name APPLE_NOTARIZATION_PASSWORD (or explicitly show both patterns
and explain that notarize.sh accepts an env-var-name argument), change the code
fences to include the language (```shell), convert bare URLs to inline links or
angle-bracketed URLs, replace any bold/italic text that was used as a
pseudo-heading with proper Markdown headings, and ensure list/heading styles are
consistent to satisfy the listed markdownlint rules.

Comment on lines +116 to 134
## Sign the DMG image. CPACK_BUNDLE_APPLE_CERT_APP needs to be unique and found in one of the
## keychains in the search list (which needs to be unlocked).
if (DEFINED CPACK_BUNDLE_APPLE_CERT_APP)
## Note: The executables/bundles inside should already be signed with hardened runtime and timestamp.
## For notarization, SIGNING_EMAIL must also be set.
if (DEFINED CPACK_BUNDLE_APPLE_CERT_APP AND DEFINED SIGNING_EMAIL)
add_custom_target(signed_dist
COMMAND codesign --deep --force --sign ${CPACK_BUNDLE_APPLE_CERT_APP} ${CPACK_PACKAGE_FILE_NAME}.dmg
COMMAND ${OPENMS_HOST_DIRECTORY}/cmake/MacOSX/notarize_app.sh ${CPACK_PACKAGE_FILE_NAME}.dmg de.openms ${SIGNING_EMAIL} CODESIGNPW ${OPENMS_HOST_BINARY_DIRECTORY}
COMMAND ${OPENMS_HOST_DIRECTORY}/cmake/MacOSX/notarize.sh ${CPACK_PACKAGE_FILE_NAME}.dmg de.openms ${SIGNING_EMAIL} CODESIGNPW ${OPENMS_HOST_BINARY_DIRECTORY}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
COMMENT "Signing and notarizing ${CPACK_PACKAGE_FILE_NAME}.dmg as ${CPACK_BUNDLE_APPLE_CERT_APP}"
DEPENDS dist)
elseif(DEFINED CPACK_BUNDLE_APPLE_CERT_APP)
message(STATUS "SIGNING_EMAIL not set. DMG will be signed but not notarized.")
add_custom_target(signed_dist
COMMAND codesign --deep --force --sign ${CPACK_BUNDLE_APPLE_CERT_APP} ${CPACK_PACKAGE_FILE_NAME}.dmg
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
COMMENT "Signing ${CPACK_PACKAGE_FILE_NAME}.dmg as ${CPACK_BUNDLE_APPLE_CERT_APP} (not notarized)"
DEPENDS dist)
endif()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

find . -name "notarize.sh" -type f

Repository: OpenMS/OpenMS

Length of output: 83


🏁 Script executed:

find . -path "*cmake/MacOSX*" -type f | head -20

Repository: OpenMS/OpenMS

Length of output: 633


🏁 Script executed:

cat -n ./cmake/MacOSX/notarize.sh

Repository: OpenMS/OpenMS

Length of output: 6876


🏁 Script executed:

rg "codesign" cmake/package_dragndrop_dmg.cmake -B 2 -A 2

Repository: OpenMS/OpenMS

Length of output: 951


🌐 Web query:

Apple codesigning DMG timestamp flag --timestamp Developer ID macOS requirements

💡 Result:

Short answer:

  • Sign disk images with your Developer ID Application identity and include a secure timestamp by using --timestamp (recommended). This ensures Gatekeeper validation and ties the signature to the signing time (important for certificate expiry/notarization). [1][2][3]

Example:

  • codesign --sign "Developer ID Application: Your Name (TEAMID)" --timestamp MyImage.dmg
  • Verify: spctl -a -t open --context context:primary-signature -v MyImage.dmg. [1][2]

Notes / requirements:

  • Disk images should be signed with the Developer ID Application identity (Installer packages use Developer ID Installer). [1][3]
  • Notarization and modern Gatekeeper expectations require secure timestamps for many workflows; explicitly using --timestamp avoids relying on system defaults. [2][3]
  • You can disable timestamping with --timestamp=none, but that may make signatures less resilient to certificate expiry and notarization rules. [4]

Sources:
[1] Apple Technical Note TN2206 "macOS Code Signing In Depth" (Signing disk images).
[2] macOS codesign man page (--timestamp option).
[3] Apple docs on signing/notarizing macOS software (Developer ID / installer signing and notarization).


Add --timestamp to DMG codesign commands.

For Developer ID distribution, disk image signatures must include a secure timestamp. This is required by modern Gatekeeper validation and notarization workflows to tie the signature to the signing time. Add --timestamp to both codesign invocations:

  add_custom_target(signed_dist
                    COMMAND codesign --deep --force --sign ${CPACK_BUNDLE_APPLE_CERT_APP} ${CPACK_PACKAGE_FILE_NAME}.dmg
+                              --timestamp

Apply the same change to both the notarization branch (line 122) and the sign-only branch (line 130). The notarize.sh argument contract is correct as-is.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In cmake/package_dragndrop_dmg.cmake around lines 116 to 134, both codesign
invocations need the --timestamp flag added so disk image signatures include a
secure timestamp; update the codesign command in the notarization branch (line
~122) and the sign-only branch (line ~130) to include --timestamp alongside the
existing --deep and --force flags and the --sign argument, leaving the
notarize.sh invocation unchanged.

Comment thread tools/ci/capture-env.sh
Comment on lines 33 to 36
"SIGNING_IDENTITY"
"SIGNING_EMAIL"
"CPACK_PRODUCTBUILD_IDENTITY_NAME"
"PACKAGE_TYPE"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Consider sanitizing cached values (newline/CR) + avoid printing raw values in verbose logs.

SIGNING_EMAIL is PII and verbose mode currently prints the full value; also any cached value containing \n/\r will corrupt the generated CMakeCache line.

@@
-      if [ "$option_verbose" -eq 1 ]; then
-        echo "Found $var with value $val"
-      fi
+      # Avoid leaking values (esp. emails) into CI logs; values also may contain chars that break logs.
+      if [ "$option_verbose" -eq 1 ]; then
+        echo "Found $var (non-empty)"
+      fi
+
+      # Prevent cache corruption if a value contains newlines/CRs.
+      val="${val//$'\r'/}"
+      val="${val//$'\n'/}"

Also applies to: 77-91

🤖 Prompt for AI Agents
In tools/ci/capture-env.sh around lines 33-36 (and similarly 77-91), cached
environment values are written and printed raw which can include newline/CR
characters that break CMakeCache lines and expose PII like SIGNING_EMAIL in
verbose logs; sanitize each captured value by trimming CR/LF characters and any
trailing whitespace before writing to the cache, and when logging in verbose
mode redact sensitive variables (e.g., print only a hashed/obscured or masked
version such as first/last char with asterisks) instead of the raw value;
implement this sanitation and masking consistently for the listed variables and
other cache writes in the later block (77-91).

@poshul

poshul commented Dec 12, 2025

Copy link
Copy Markdown
Collaborator

@poshul Can you please add the correct certificates and names and passwords and emails? Most of them are probably the same as to before but I think the wrong certificate was used (Apple Developer instead of the correct Developer Application ID). Additionally we need Developer Installer ID now.

Developer ID Application and Developer ID Installer perhaps? They make this as clear as mud, and I say that as someone who runs their own X.509 chain.

@jpfeuffer

Copy link
Copy Markdown
Contributor Author

Yes those two. Looks like Dev Installer existed already. But the Apple Developer was wrong.
You can llook them up and export already. But I will change their names to make it clear which ones need to be pasted in the GHA secrets.

@poshul

poshul commented Dec 12, 2025

Copy link
Copy Markdown
Collaborator

Yes those two. Looks like Dev Installer existed already. But the Apple Developer was wrong. You can llook them up and export already. But I will change their names to make it clear which ones need to be pasted in the GHA secrets.

I've refreshed the developer cert, as it was set to expire in two weeks, and uploaded the application to APPLE_APPLICATION_CERT_64.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
.github/workflows/openms_ci_matrix_full.yml (1)

511-537: Quote variables and use printf to avoid trailing newlines in base64 decoding

Using echo $APPLE_CERTIFICATE | base64 --decode (lines 526–527) appends a trailing newline by default, which can corrupt the decoded certificate data. Replace with printf '%s' and quote the variable:

-        echo $APPLE_CERTIFICATE | base64 --decode > certificate.p12
-        echo $INSTALLER_CERTIFICATE | base64 --decode > installer_certificate.p12
+        printf '%s' "$APPLE_CERTIFICATE" | base64 --decode > certificate.p12
+        printf '%s' "$INSTALLER_CERTIFICATE" | base64 --decode > installer_certificate.p12
src/openms_gui/add_mac_bundle.cmake (1)

128-154: Guard DMG notarization on SIGNING_EMAIL to prevent hard failures

At line 146, notarization runs unconditionally when CPACK_BUNDLE_APPLE_CERT_APP is set, but there's no check that SIGNING_EMAIL is defined or non-empty. This differs from the graceful handling in CMakeLists.txt (line 329–330) and package_dragndrop_dmg.cmake (line 120), both of which guard notarization with DEFINED SIGNING_EMAIL. The notarize.sh script explicitly validates and fails if SIGNING_EMAIL is empty, causing unexpected hard failures in CI or local builds where this variable is unset.

Add guard condition to line 144:

-				if("${PACKAGE_TYPE}" STREQUAL "dmg")
+				if("${PACKAGE_TYPE}" STREQUAL "dmg" AND DEFINED SIGNING_EMAIL AND NOT "${SIGNING_EMAIL}" STREQUAL "")

Also consider adding --timestamp to the codesign call at line 137 for Developer ID signing consistency (Apple best practice to ensure signatures remain valid after certificate expiration).

♻️ Duplicate comments (3)
cmake/MacOSX/README.md (1)

11-118: Fix env-var naming + markdownlint issues in notarization docs

Docs currently mix APPLE_APP_SPECIFIC_NOTARIZATION_PASSWORD, APPLE_NOTARIZATION_PASSWORD (Line 79), and CODESIGNPW (Line 92-95). Also, bare URLs + unlabeled fence (Line 64-68) + pseudo-headings trip markdownlint.

Suggested patch (illustrative, minimal):

-1. **Apple Developer Account** ($99/year) - https://developer.apple.com
+1. **Apple Developer Account** ($99/year) - <https://developer.apple.com>

-1. Go to https://appleid.apple.com
+1. Go to <https://appleid.apple.com>
 ...
-3. Use this password for `APPLE_NOTARIZATION_PASSWORD`
+3. Store this password in `APPLE_APP_SPECIFIC_NOTARIZATION_PASSWORD`

-Output example:
-```
+Output example:
+```text
 1) ABC123XYZ... "Developer ID Application: OpenMS Inc. (C64UCGJ5PL)"
 ...
-# Notarize a package (requires CODESIGNPW environment variable)
-export CODESIGNPW="your-app-specific-password"
-./cmake/MacOSX/notarize.sh package.pkg de.openms [email protected] CODESIGNPW .
+# Notarize a package (script expects the *env var name* as argument)
+export APPLE_APP_SPECIFIC_NOTARIZATION_PASSWORD="your-app-specific-password"
+./cmake/MacOSX/notarize.sh package.pkg de.openms [email protected] APPLE_APP_SPECIFIC_NOTARIZATION_PASSWORD .
cmake/package_dragndrop_dmg.cmake (1)

116-134: Add --timestamp to DMG codesign commands

Both DMG signing commands (Line 122, Line 130) should include a secure timestamp for Developer ID distribution.

-  COMMAND codesign --deep --force --sign ${CPACK_BUNDLE_APPLE_CERT_APP} ${CPACK_PACKAGE_FILE_NAME}.dmg
+  COMMAND codesign --deep --force --timestamp --sign ${CPACK_BUNDLE_APPLE_CERT_APP} ${CPACK_PACKAGE_FILE_NAME}.dmg
...
-  COMMAND codesign --deep --force --sign ${CPACK_BUNDLE_APPLE_CERT_APP} ${CPACK_PACKAGE_FILE_NAME}.dmg
+  COMMAND codesign --deep --force --timestamp --sign ${CPACK_BUNDLE_APPLE_CERT_APP} ${CPACK_PACKAGE_FILE_NAME}.dmg
.github/workflows/openms_ci_matrix_full.yml (1)

568-603: Make notarization step robust + make verification failures fatal

Line 577-602: unquoted cd, fragile .pkg discovery via ls, and masked verification failures. Suggested rewrite:

-        cd $GITHUB_WORKSPACE/OpenMS/bld/
+        cd "$GITHUB_WORKSPACE/OpenMS/bld/"

-        PKG_FILE=$(ls -1 *.pkg 2>/dev/null | head -1)
+        PKG_FILE="$(find . -maxdepth 1 -type f -name '*.pkg' -print -quit | sed 's|^\./||')"

 ...
-        $GITHUB_WORKSPACE/OpenMS/cmake/MacOSX/notarize.sh \
+        "$GITHUB_WORKSPACE/OpenMS/cmake/MacOSX/notarize.sh" \
           "$PKG_FILE" \
           "de.openms" \
           "[email protected]" \
           "APPLE_APP_SPECIFIC_NOTARIZATION_PASSWORD" \
           "$GITHUB_WORKSPACE/OpenMS/bld/"

 ...
-        pkgutil --check-signature "$PKG_FILE" || echo "Warning: pkgutil verification returned non-zero"
-        spctl -a -vvv -t install "$PKG_FILE" || echo "Warning: spctl assessment returned non-zero"
+        pkgutil --check-signature "$PKG_FILE"
+        spctl -a -vvv -t install "$PKG_FILE"
🧹 Nitpick comments (1)
CMakeLists.txt (1)

309-332: Nice: treat SIGNING_EMAIL as optional; consider warning if .pkg installer identity is missing

The updated signing gate (Line 317-331) looks good and matches “sign-only when notarization creds missing”.

Recommended follow-up: when PACKAGE_TYPE is pkg, warn if CPACK_PRODUCTBUILD_IDENTITY_NAME is unset/empty (since it’s documented as required at Line 314), e.g.:

 if("${PACKAGE_TYPE}" STREQUAL "dmg" OR "${PACKAGE_TYPE}" STREQUAL "pkg")
   ...
+  if ("${PACKAGE_TYPE}" STREQUAL "pkg" AND (NOT DEFINED CPACK_PRODUCTBUILD_IDENTITY_NAME OR "${CPACK_PRODUCTBUILD_IDENTITY_NAME}" STREQUAL ""))
+    message(STATUS "CPACK_PRODUCTBUILD_IDENTITY_NAME not set. .pkg installer signing may be skipped/fail.")
+  endif()
   if (NOT DEFINED SIGNING_EMAIL OR "${SIGNING_EMAIL}" STREQUAL "")
     message(STATUS "SIGNING_EMAIL not set. Notarization will be skipped.")
   endif()
 endif()
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 33cc19d and 52a9752.

📒 Files selected for processing (6)
  • .github/workflows/openms_ci_matrix_full.yml (3 hunks)
  • CMakeLists.txt (1 hunks)
  • cmake/MacOSX/README.md (1 hunks)
  • cmake/MacOSX/notarize_app.sh (0 hunks)
  • cmake/package_dragndrop_dmg.cmake (1 hunks)
  • src/openms_gui/add_mac_bundle.cmake (1 hunks)
💤 Files with no reviewable changes (1)
  • cmake/MacOSX/notarize_app.sh
🧰 Additional context used
🪛 markdownlint-cli2 (0.18.1)
cmake/MacOSX/README.md

13-13: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


17-17: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


19-19: Bare URL used

(MD034, no-bare-urls)


25-25: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


46-46: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


55-55: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


64-64: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


73-73: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


77-77: Bare URL used

(MD034, no-bare-urls)


81-81: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


100-100: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)


102-102: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


106-106: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


110-110: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


114-114: Heading style
Expected: atx_closed; Actual: atx

(MD003, heading-style)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: build-lnx
  • GitHub Check: build-win
  • GitHub Check: build-lnx-arm
  • GitHub Check: build-and-test (ubuntu-22.04-arm, g++, 11)
  • GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
  • GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
  • GitHub Check: build-and-test (windows-2022, cl.exe, 14.36)

@jpfeuffer

jpfeuffer commented Dec 12, 2025 •

Copy link
Copy Markdown
Contributor Author

@poshul I have made the secret names much clearer. Can you reupload to the new names and delete the old ones?

@poshul

poshul commented Dec 12, 2025

Copy link
Copy Markdown
Collaborator

@poshul I have made the secret names much clearer. Can you reupload to the new names and delete the old ones?

Yup. I will do that tomorrow morning.

@poshul

poshul commented Dec 13, 2025

Copy link
Copy Markdown
Collaborator

@poshul I have made the secret names much clearer. Can you reupload to the new names and delete the old ones?

Done.

@jpfeuffer

Copy link
Copy Markdown
Contributor Author

@poshul Can I merge to test or are there still installer builds/tests ongoing from dev.

@poshul

poshul commented Dec 13, 2025

Copy link
Copy Markdown
Collaborator

You can merge.

@jpfeuffer
jpfeuffer merged commit 8ee8489 into OpenMS:develop Dec 13, 2025
poshul added a commit that referenced this pull request Dec 14, 2025
poshul added a commit that referenced this pull request Dec 17, 2025
* address coderabbot issues from #8486

* Add build.keychain to security list-keychains

Add build.keychain to the list of keychains for code signing.

* Change ctest verbosity level in CI workflow (#8497)

* Add productsign to key-partition-list in CI workflow

* Update notarize.sh to include ASC_TEAMID parameter

TEAM_ID is now required even with only one team.

* Add teamID to notarize fix producbuild key permissions

* Add team ID to notarization log fetching

* Initial plan

* Add macOS code signing for thirdparty components for notarization

Co-authored-by: jpfeuffer <[email protected]>

* Add check for THIRDPARTY directory existence before signing

Co-authored-by: jpfeuffer <[email protected]>

* Sign each thirdparty component individually for macOS notarization

Co-authored-by: jpfeuffer <[email protected]>

---------

Co-authored-by: Julianus Pfeuffer <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
timosachsenberg pushed a commit that referenced this pull request Sep 26, 2026
…23 requirement

The macOS line cited #8486, #8494 and #8527, which are notarization PRs;
the references came along from a neighbouring bullet when the changelog
was condensed. The minimum came from #8450 (14, with the Intel builds
dropped), #9037 (15, together with C++23 and the macos-15 runners) and
#10202 (15 for the wheels).

The 3.6.0 changelog never said that OpenMS now needs C++23 (#9037). It
now names the minimum compilers from cmake/min_compiler_versions.cmake.

The dataframe page shows default_missing_values=None, the actual default
of PeptideIdentificationList.to_df(), and what None stands for.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YC1T2K9HQEUk2kQMZqC8h7
timosachsenberg added a commit that referenced this pull request Sep 26, 2026
…5 minimum (#10285)

* [DOC,PYOPENMS] Update the user guide to the 3.6 API; macOS 15 minimum

The user-guide examples still used the 3.5.0 API. Replayed against a
3.6 wheel built from develop (with the plot_spectrum fix of #10280),
20 of the 46 pages failed, 14 of which had passed on 3.5.0. Now 36
pass. Three still fail, two on bindings that are missing in 3.6 and
one on #10260 item 4. Two need optional packages (datashader, massql).

- Output arguments are return values: pickExperiment, getAllNames,
  digest, align, getDecompositions, getTag, ProtXMLFile.load,
  applyVariableModifications, getSpectrumAlignment,
  MassTraceDetection.run, ElutionPeakDetection.detectPeaks and
  filterByPeakWidth, and SimpleSearchEngineAlgorithm.search.
- Strings are str: no .decode(), str keys and arguments instead of
  b"...", and element compositions print with str keys. char arguments
  such as PeptideEvidence.setAABefore take "R" and reject b"R".
- Removed API: pyopenms.String, DPosition1 and the LogConfigHandler
  constructor.
- Deprecated API: get_df() is now to_df(), and
  peptide_identifications_to_df() is now PeptideIdentificationList.to_df().
  The dataframe page documents the to_df() signatures and the columns
  3.6 returns. The merge example is left for #10260 item 4.
- Examples that could not run anywhere: the FAQ snippet used an
  undefined exp, and memory_management and the detailed peptide search
  read files that exist only in a source checkout. They download their
  input now, like the other pages.
- The stand-alone mass decomposition script imports pyopenms again,
  which also makes the prose's "line 8 and 9" right. The SpectrumLookup
  regex in ms_data is a raw string, which removes the invalid escape
  sequence warning.

CHANGELOG: the minimum macOS version is 15, not 14. The wheels are
built with MACOSX_DEPLOYMENT_TARGET 15.0. In the 2026-09-24 installer,
libOpenMS links a bundled libzstd whose minimum OS is 15.0, so every
TOPP tool needs macOS 15, not only the GUI, whose Qt dependencies are
built for 15 as well.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YC1T2K9HQEUk2kQMZqC8h7

* [DOC] CHANGELOG: cite the PRs behind the macOS minimum; state the C++23 requirement

The macOS line cited #8486, #8494 and #8527, which are notarization PRs;
the references came along from a neighbouring bullet when the changelog
was condensed. The minimum came from #8450 (14, with the Intel builds
dropped), #9037 (15, together with C++23 and the macos-15 runners) and
#10202 (15 for the wheels).

The 3.6.0 changelog never said that OpenMS now needs C++23 (#9037). It
now names the minimum compilers from cmake/min_compiler_versions.cmake.

The dataframe page shows default_missing_values=None, the actual default
of PeptideIdentificationList.to_df(), and what None stands for.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YC1T2K9HQEUk2kQMZqC8h7

* [DOC] peptide_search: call removeDanglingProteinReferences, not its 3.5 name

updateProteinReferences is the pyOpenMS 3.5 name. The bindings PR brings
it back only as a deprecated alias, and the page replay reports an
example that teaches a deprecated call.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YC1T2K9HQEUk2kQMZqC8h7

---------

Co-authored-by: Claude <[email protected]>
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