From c7235b3736e8b564d3c165456d3dece1ba61ab5a Mon Sep 17 00:00:00 2001 From: Warrick Bayman Date: Sun, 15 Nov 2026 16:53:36 +0200 Subject: [PATCH] Sign releases with a Developer ID and notarize them, so WrangURL opens without a Gatekeeper warning. Co-Authored-By: Claude Opus 5.5 --- .claude/rules/project-and-release.md | 2 +- .github/workflows/release.yml | 94 +++++++++++----------------- AGENTS.md | 4 +- CLAUDE.md | 4 +- PLAN.md | 6 +- README.md | 14 +++-- SECURITY.md | 1 - docs/index.html | 78 +++-------------------- docs/site.js | 45 +------------ docs/style.css | 88 +------------------------- project.yml | 2 +- scripts/release.sh | 65 +++++++++++++++---- scripts/resign.sh | 35 ----------- 13 files changed, 119 insertions(+), 319 deletions(-) delete mode 100755 scripts/resign.sh diff --git a/.claude/rules/project-and-release.md b/.claude/rules/project-and-release.md index 1fb3ad2..9149508 100644 --- a/.claude/rules/project-and-release.md +++ b/.claude/rules/project-and-release.md @@ -12,7 +12,7 @@ paths: - `project.yml` is the source of truth for build settings, `Info.plist` and entitlements. Never edit `WrangURL/Info.plist`, `WrangURL/WrangURL.entitlements` or `WrangURL.xcodeproj` directly. Run `xcodegen generate` after changing it or adding/removing files. - Each entitlement and unusual build setting in `project.yml` has a comment explaining why it's there. Keep that up for new ones. Keep entitlements minimal: the app is sandboxed, and any new exception needs a concrete reason. -- Don't change `SUFeedURL`, `SUPublicEDKey`, the Sparkle mach-lookup exceptions, `CODE_SIGN_INJECT_BASE_ENTITLEMENTS` or the signing flow in `scripts/resign.sh`/`scripts/release.sh` unless asked. Mistakes there break auto-updates for existing users, and a release can't fix that. +- Don't change `SUFeedURL`, `SUPublicEDKey`, the Sparkle mach-lookup exceptions, `CODE_SIGN_INJECT_BASE_ENTITLEMENTS` or the signing flow in `scripts/release.sh`/`.github/workflows/release.yml` unless asked. Mistakes there break auto-updates for existing users, and a release can't fix that. - `CHANGELOG.md` sections are added by `.github/workflows/changelog.yml` on release. Don't add release sections by hand. Only reword existing entries when asked. - CI runs on `macos-26` (the `NSGlassEffectView` SDK). Workflows keep `xcodebuild`'s exit status when piping through `grep`. - `docs/` is a static GitHub Pages site (plain HTML/CSS/JS, no build step). Keep it dependency-free. Screenshots in `docs/images/` come in light and dark variants, captured with the demo data in `docs/demo/` using the steps in its README. diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c1f54ee..1d03927 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,14 +1,17 @@ -# Builds WrangURL.app when a release is published, signs it with the self-signed "WrangURL Self-Signed" -# certificate and attaches it to the release, along with a Sparkle appcast.xml that installed copies -# check for updates. The app is not notarized, so Gatekeeper blocks it on first launch; use -# scripts/release.sh locally for a Developer ID signed, notarized DMG. The tests (tests.yml) run first -# and must pass. +# Builds WrangURL.app when a release is published, signs it with the Developer ID certificate, notarizes +# and staples it (scripts/release.sh), and attaches a zip, a DMG and a Sparkle appcast.xml, which +# installed copies check for updates, to the release. The tests (tests.yml) run first and must pass. # # Requires these secrets: -# SPARKLE_PRIVATE_KEY the EdDSA key whose public half is SUPublicEDKey in project.yml. -# Export it with `generate_keys --account wrangurl -x ` (Sparkle's bin/). -# SIGNING_CERTIFICATE_P12 the base64-encoded .p12 of the "WrangURL Self-Signed" identity. -# SIGNING_CERTIFICATE_PASSWORD that .p12's password. +# SPARKLE_PRIVATE_KEY the EdDSA key whose public half is SUPublicEDKey in project.yml. +# Export it with `generate_keys --account wrangurl -x ` (Sparkle's bin/). +# DEVELOPER_ID_CERTIFICATE_P12 the base64-encoded .p12 of the "Developer ID Application" identity +# (certificate and private key) for team 3A6RMA5S3D. +# DEVELOPER_ID_CERTIFICATE_PASSWORD that .p12's password. +# NOTARY_API_KEY the base64-encoded .p8 of an App Store Connect API key +# (Users and Access → Integrations → Team Keys, "Developer" role). +# NOTARY_API_KEY_ID that key's ID. +# NOTARY_API_ISSUER_ID the team's issuer ID, shown above the keys. name: Release on: @@ -35,37 +38,16 @@ jobs: - name: Install XcodeGen run: brew install xcodegen - - name: Generate Xcode project - run: xcodegen generate - - - name: Build + - name: Install the Developer ID certificate env: - TAG: ${{ github.event.release.tag_name }} - run: | - # Tags like v1.2.3 become MARKETING_VERSION 1.2.3; the run number becomes the build number. - xcodebuild build -quiet \ - -project WrangURL.xcodeproj \ - -scheme WrangURL \ - -configuration Release \ - -destination 'generic/platform=macOS' \ - -derivedDataPath build/DerivedData \ - -skipPackagePluginValidation \ - MARKETING_VERSION="${TAG#v}" \ - CURRENT_PROJECT_VERSION="${{ github.run_number }}" \ - CODE_SIGN_IDENTITY=- \ - CODE_SIGN_STYLE=Manual - - - name: Sign with the self-signed certificate - env: - CERTIFICATE_P12: ${{ secrets.SIGNING_CERTIFICATE_P12 }} - CERTIFICATE_PASSWORD: ${{ secrets.SIGNING_CERTIFICATE_PASSWORD }} + CERTIFICATE_P12: ${{ secrets.DEVELOPER_ID_CERTIFICATE_P12 }} + CERTIFICATE_PASSWORD: ${{ secrets.DEVELOPER_ID_CERTIFICATE_PASSWORD }} run: | if [ -z "$CERTIFICATE_P12" ] || [ -z "$CERTIFICATE_PASSWORD" ]; then - echo "::error::the SIGNING_CERTIFICATE_P12 and SIGNING_CERTIFICATE_PASSWORD secrets are not set" + echo "::error::the DEVELOPER_ID_CERTIFICATE_P12 and DEVELOPER_ID_CERTIFICATE_PASSWORD secrets are not set" exit 1 fi - # Xcode refuses an untrusted identity, so the ad-hoc build is re-signed. - # codesign only finds identities in keychains on the search list. + # xcodebuild and codesign only find identities in keychains on the search list. KEYCHAIN="$RUNNER_TEMP/signing.keychain-db" KEYCHAIN_PASSWORD=$(openssl rand -base64 24) echo "$CERTIFICATE_P12" | base64 --decode > "$RUNNER_TEMP/signing.p12" @@ -77,29 +59,22 @@ jobs: security list-keychains -d user -s "$KEYCHAIN" $(security list-keychains -d user | tr -d '"') rm "$RUNNER_TEMP/signing.p12" - scripts/resign.sh build/DerivedData/Build/Products/Release/WrangURL.app "WrangURL Self-Signed" - - - name: Verify signature - run: | - APP=build/DerivedData/Build/Products/Release/WrangURL.app - codesign --verify --deep --strict --verbose=2 "$APP" - # An ad-hoc designated requirement is a hash of this build, so updates would look like a different app. - if ! codesign -d -r- "$APP" 2>&1 | grep -q "certificate root"; then - echo "::error::release build isn't signed with the self-signed certificate" - exit 1 - fi - if codesign -d --entitlements - "$APP" 2>/dev/null | grep -q get-task-allow; then - echo "::error::release build has the get-task-allow entitlement" - exit 1 - fi - - - name: Package + - name: Build, sign and notarize env: TAG: ${{ github.event.release.tag_name }} + NOTARY_API_KEY: ${{ secrets.NOTARY_API_KEY }} + NOTARY_KEY_ID: ${{ secrets.NOTARY_API_KEY_ID }} + NOTARY_ISSUER: ${{ secrets.NOTARY_API_ISSUER_ID }} run: | - ditto -c -k --keepParent \ - build/DerivedData/Build/Products/Release/WrangURL.app \ - "WrangURL-${TAG#v}.zip" + if [ -z "$NOTARY_API_KEY" ] || [ -z "$NOTARY_KEY_ID" ] || [ -z "$NOTARY_ISSUER" ]; then + echo "::error::the NOTARY_API_KEY, NOTARY_API_KEY_ID and NOTARY_API_ISSUER_ID secrets are not set" + exit 1 + fi + export NOTARY_KEY_PATH="$RUNNER_TEMP/notary.p8" + echo "$NOTARY_API_KEY" | base64 --decode > "$NOTARY_KEY_PATH" + # Tags like v1.2.3 become MARKETING_VERSION 1.2.3; the run number becomes the build number. + VERSION="${TAG#v}" BUILD_NUMBER="${{ github.run_number }}" scripts/release.sh + rm "$NOTARY_KEY_PATH" - name: Generate appcast env: @@ -117,7 +92,7 @@ jobs: # The appcast lists only this release; Sparkle only needs the newest one. mkdir updates - cp "WrangURL-${TAG#v}.zip" updates/ + cp "build/release/WrangURL-${TAG#v}.zip" updates/ printf '%s\n' "$RELEASE_NOTES" > "updates/WrangURL-${TAG#v}.md" echo "$SPARKLE_PRIVATE_KEY" | sparkle/bin/generate_appcast \ --ed-key-file - \ @@ -131,4 +106,9 @@ jobs: env: GH_TOKEN: ${{ github.token }} TAG: ${{ github.event.release.tag_name }} - run: gh release upload "$TAG" "WrangURL-${TAG#v}.zip" updates/appcast.xml --clobber + run: | + gh release upload "$TAG" \ + "build/release/WrangURL-${TAG#v}.zip" \ + "build/release/WrangURL-${TAG#v}.dmg" \ + updates/appcast.xml \ + --clobber diff --git a/AGENTS.md b/AGENTS.md index a147c81..f90727f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -20,7 +20,7 @@ xcodebuild ... test "-only-testing:WrangURLTests/RoutePlannerTests/singleBrowser Test output includes harmless `com.apple.linkd.autoShortcut` connection errors from the test host; filter them out. -SwiftLint runs as a build tool plugin (`SimplyDanny/SwiftLintPlugins`) on both targets, so its warnings appear in every build; rules are in `.swiftlint.yml`. Command-line builds need `-skipPackagePluginValidation` because the plugin isn't trusted there; in Xcode, trust it once when prompted. Keep builds free of lint warnings. No formatter is configured. `scripts/release.sh` makes a Developer ID signed, notarized DMG (`SKIP_NOTARIZE=1` to only sign). `scripts/make-app-icon.swift` regenerates `Assets.xcassets/AppIcon.appiconset`. +SwiftLint runs as a build tool plugin (`SimplyDanny/SwiftLintPlugins`) on both targets, so its warnings appear in every build; rules are in `.swiftlint.yml`. Command-line builds need `-skipPackagePluginValidation` because the plugin isn't trusted there; in Xcode, trust it once when prompted. Keep builds free of lint warnings. No formatter is configured. `scripts/release.sh` makes a Developer ID signed, notarized zip and DMG (`SKIP_NOTARIZE=1` to only sign); the release workflow runs it too. `scripts/make-app-icon.swift` regenerates `Assets.xcassets/AppIcon.appiconset`. App logs use subsystem `com.thepublicgood.wrangurl`. In zsh, `log` is a shell builtin, so call `/usr/bin/log stream --level info --predicate 'subsystem == "com.thepublicgood.wrangurl"'`. @@ -66,7 +66,7 @@ They reach SwiftUI through `View.appEnvironment(_:)` in `WrangURLApp.swift`, so - When setting the default browser, confirming the `http` dialog also switches `https`. `makeDefault()` therefore skips schemes already handled and judges success by the final state. - Release builds set `CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO`, because notarization rejects `get-task-allow`. - Sparkle needs `SUEnableInstallerLauncherService`, the `-spks`/`-spki` mach-lookup exceptions and `network.client`. Its feed is `releases/latest/download/appcast.xml`, which the release workflow generates and signs with the `SPARKLE_PRIVATE_KEY` secret. Updates are accepted on the EdDSA signature. -- Release builds from CI are built ad-hoc, then re-signed by `scripts/resign.sh` with the self-signed "WrangURL Self-Signed" certificate. Xcode won't sign with an untrusted identity. An ad-hoc designated requirement is the build's hash, so without this each update would look like a different app to macOS. Builds without a Team ID need `disable-library-validation` to load Sparkle.framework. Debug builds only work without it because of `get-task-allow`. +- Releases are signed with the Developer ID of team `3A6RMA5S3D` by archiving and exporting (`scripts/release.sh`), which re-signs Sparkle's helpers too; the app and DMG are notarized and stapled. Releases up to 0.5.x were signed with a self-signed certificate. Sparkle accepts the change of code signing identity because the EdDSA key stayed the same, so never change both at once. Ad-hoc builds (local Release builds) have no Team ID and need `disable-library-validation` to load Sparkle.framework. Debug builds only work without it because of `get-task-allow`. ## Testing and manual UI checks diff --git a/CLAUDE.md b/CLAUDE.md index 8ef1c2f..64a501c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -20,7 +20,7 @@ xcodebuild ... test "-only-testing:WrangURLTests/RoutePlannerTests/singleBrowser Test output includes harmless `com.apple.linkd.autoShortcut` connection errors from the test host; filter them out. -SwiftLint runs as a build tool plugin (`SimplyDanny/SwiftLintPlugins`) on both targets, so its warnings appear in every build; rules are in `.swiftlint.yml`. Command-line builds need `-skipPackagePluginValidation` because the plugin isn't trusted there; in Xcode, trust it once when prompted. Keep builds free of lint warnings. No formatter is configured. `scripts/release.sh` makes a Developer ID signed, notarized DMG (`SKIP_NOTARIZE=1` to only sign). `scripts/make-app-icon.swift` regenerates `Assets.xcassets/AppIcon.appiconset`. +SwiftLint runs as a build tool plugin (`SimplyDanny/SwiftLintPlugins`) on both targets, so its warnings appear in every build; rules are in `.swiftlint.yml`. Command-line builds need `-skipPackagePluginValidation` because the plugin isn't trusted there; in Xcode, trust it once when prompted. Keep builds free of lint warnings. No formatter is configured. `scripts/release.sh` makes a Developer ID signed, notarized zip and DMG (`SKIP_NOTARIZE=1` to only sign); the release workflow runs it too. `scripts/make-app-icon.swift` regenerates `Assets.xcassets/AppIcon.appiconset`. App logs use subsystem `com.thepublicgood.wrangurl`. In zsh, `log` is a shell builtin, so call `/usr/bin/log stream --level info --predicate 'subsystem == "com.thepublicgood.wrangurl"'`. @@ -66,7 +66,7 @@ They reach SwiftUI through `View.appEnvironment(_:)` in `WrangURLApp.swift`, so - When setting the default browser, confirming the `http` dialog also switches `https`. `makeDefault()` therefore skips schemes already handled and judges success by the final state. - Release builds set `CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO`, because notarization rejects `get-task-allow`. - Sparkle needs `SUEnableInstallerLauncherService`, the `-spks`/`-spki` mach-lookup exceptions and `network.client`. Its feed is `releases/latest/download/appcast.xml`, which the release workflow generates and signs with the `SPARKLE_PRIVATE_KEY` secret. Updates are accepted on the EdDSA signature. -- Release builds from CI are built ad-hoc, then re-signed by `scripts/resign.sh` with the self-signed "WrangURL Self-Signed" certificate. Xcode won't sign with an untrusted identity. An ad-hoc designated requirement is the build's hash, so without this each update would look like a different app to macOS. Builds without a Team ID need `disable-library-validation` to load Sparkle.framework. Debug builds only work without it because of `get-task-allow`. +- Releases are signed with the Developer ID of team `3A6RMA5S3D` by archiving and exporting (`scripts/release.sh`), which re-signs Sparkle's helpers too; the app and DMG are notarized and stapled. Releases up to 0.5.x were signed with a self-signed certificate. Sparkle accepts the change of code signing identity because the EdDSA key stayed the same, so never change both at once. Ad-hoc builds (local Release builds) have no Team ID and need `disable-library-validation` to load Sparkle.framework. Debug builds only work without it because of `get-task-allow`. ## Testing and manual UI checks diff --git a/PLAN.md b/PLAN.md index 554686e..8351934 100644 --- a/PLAN.md +++ b/PLAN.md @@ -185,8 +185,10 @@ enum UnmatchedBehavior: String, Codable { - Setup is marked complete when its window closes by any means, so it doesn't reappear on every launch. Settings → General → Run Setup Again… reopens it. - There's no notification when the default browser changes, so WrangURL re-checks whenever the user switches apps. The menubar icon shows a warning while WrangURL isn't the default. - **Releasing:** `scripts/release.sh` archives with Developer ID signing, notarizes and staples the app, then builds, signs, notarizes and staples a DMG in `build/release/`. - - One-time setup: install a Developer ID Application certificate, then run `xcrun notarytool store-credentials WrangURL --apple-id --team-id RCZ39FHJ3H`. + - One-time setup: install a Developer ID Application certificate, then run `xcrun notarytool store-credentials WrangURL --apple-id --team-id 3A6RMA5S3D`. CI (`release.yml`) runs the same script, with the certificate in a temporary keychain and an App Store Connect API key for `notarytool`. - `SKIP_NOTARIZE=1` builds and signs only. + - Moving from the self-signed certificate (up to 0.5.x) to the Developer ID changes the designated requirement. Sparkle allows that because the update's EdDSA signature still verifies; changing the EdDSA key at the same time would break updates. + - Exporting re-signs Sparkle's nested helpers with the Developer ID and a secure timestamp, which notarization needs. `Downloader.xpc` ships without entitlements, and stays that way. - The Release configuration sets `CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO` so the `get-task-allow` entitlement isn't included. Notarization rejects it, and the script checks for it. - **App icon:** generated by `scripts/make-app-icon.swift` into `Assets.xcassets/AppIcon.appiconset`. The menubar icon stays the `arrow.triangle.branch` SF Symbol, which macOS already draws as a template. - **Import:** only accepts JSON with a `rules` or `settings` key, so an arbitrary file can't wipe the configuration. It offers Add Rules, which keeps your settings and gives duplicate IDs new ones, or Replace All, which keeps the "setup done" flag. @@ -215,7 +217,7 @@ enum UnmatchedBehavior: String, Codable { - Rules list with reordering. - Rule editor with the URL tester. 6. ✅ **Default browser & login item management,** plus onboarding. -7. 🟡 **Polish.** Import/export, app icon and menubar icon are done. The notarized build is scripted but blocked until there's a Developer ID Application certificate. +7. 🟡 **Polish.** Import/export, app icon and menubar icon are done. Releases are Developer ID signed and notarized. ## 12. Future ideas diff --git a/README.md b/README.md index 3e9f4be..f3900e9 100644 --- a/README.md +++ b/README.md @@ -121,19 +121,23 @@ When you set a development build as your default browser, macOS records the path ### Releasing -Publishing a GitHub release runs `.github/workflows/release.yml`. It builds the app, re-signs it with a self-signed certificate (`scripts/resign.sh`) so every release has the same code signing identity, and attaches it to the release as a zip, along with the Sparkle `appcast.xml` that installed copies check for updates. The release notes become the update notes. The workflow needs the `SPARKLE_PRIVATE_KEY` repository secret. That's the EdDSA private key whose public half is `SUPublicEDKey` in `project.yml`. Export it with Sparkle's `generate_keys --account wrangurl -x `. It also needs `SIGNING_CERTIFICATE_P12` (the base64-encoded "WrangURL Self-Signed" identity, exported from Keychain Access as a .p12) and `SIGNING_CERTIFICATE_PASSWORD`. The build number is the workflow run number, so each release is newer than the one before it. +`scripts/release.sh` builds a Developer ID signed, notarized and stapled app in `build/release/`, packaged as a zip (for Sparkle updates) and a DMG (for downloads). It needs: -`scripts/release.sh` builds a signed, notarized app and DMG in `build/release/`. It needs: - -- A **Developer ID Application** certificate in your keychain. +- A **Developer ID Application** certificate for team `3A6RMA5S3D` in your keychain. - Notarization credentials saved once with: ```sh - xcrun notarytool store-credentials WrangURL --apple-id --team-id + xcrun notarytool store-credentials WrangURL --apple-id --team-id 3A6RMA5S3D ``` Set `SKIP_NOTARIZE=1` to build and sign without notarizing. There are more details at the top of the script. +Publishing a GitHub release runs `.github/workflows/release.yml`, which runs `scripts/release.sh` and attaches the zip, the DMG and the Sparkle `appcast.xml` that installed copies check for updates to the release. The release notes become the update notes, and the build number is the workflow run number, so each release is newer than the one before it. The workflow needs these repository secrets: + +- `SPARKLE_PRIVATE_KEY`: the EdDSA private key whose public half is `SUPublicEDKey` in `project.yml`. Export it with Sparkle's `generate_keys --account wrangurl -x `. +- `DEVELOPER_ID_CERTIFICATE_P12` and `DEVELOPER_ID_CERTIFICATE_PASSWORD`: the Developer ID Application certificate and its private key, exported from Keychain Access as a .p12, base64-encoded (`base64 -i cert.p12 | pbcopy`), and the password you gave the .p12. +- `NOTARY_API_KEY`, `NOTARY_API_KEY_ID` and `NOTARY_API_ISSUER_ID`: an App Store Connect API key for notarization. Create one with the Developer role in App Store Connect under Users and Access → Integrations → Team Keys. `NOTARY_API_KEY` is the downloaded .p8, base64-encoded; the key ID and issuer ID are shown on that page. + ## Testing Run the tests from Xcode with **⌘U**, or from the command line: diff --git a/SECURITY.md b/SECURITY.md index a6badd4..ab7632d 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -33,4 +33,3 @@ Outside the scope of this policy: - vulnerabilities in the browsers WrangURL opens links in, which should be reported to their developers - vulnerabilities in [Sparkle](https://github.com/sparkle-project/Sparkle/security) itself, unless WrangURL's use of it is the problem - anything that needs an attacker to already control your user account, such as editing `config.json` directly -- releases being signed with a self-signed certificate instead of an Apple Developer ID. This is a known choice, and [the README](README.md) explains it. diff --git a/docs/index.html b/docs/index.html index 0298b0e..9494a14 100644 --- a/docs/index.html +++ b/docs/index.html @@ -106,85 +106,21 @@

Install WrangURL

  • Download the latest release

    - Get WrangURL-<version>.zip from the - latest GitHub release. - Safari unzips it for you. In other browsers, double-click the zip in Downloads. + Get WrangURL-<version>.dmg from the + latest GitHub release + and open it.

  • Move it to Applications

    - Drag WrangURL.app into your Applications folder before you open it. + Drag WrangURL onto the Applications folder in the window that opens, then open it from there. macOS remembers where your default browser lives, so moving the app later means setting it as the default again.

    -
  • -
  • -

    Allow it past Gatekeeper

    -

    - The first time you open WrangURL, macOS stops it with a message saying Apple could not verify - that “WrangURL” is free of malware. Click Done, not Move to Trash, then follow the steps for your macOS version. +

    + WrangURL is signed with an Apple Developer ID and notarized by Apple, so it opens without a security warning. + Updates from Check for Updates… are also checked against a signing key before they’re installed.

    - -
    -
    - - - -
    - -
    -

    macOS 15 Sequoia, macOS 26 Tahoe and later

    -
      -
    1. Open System Settings and choose Privacy & Security.
    2. -
    3. Scroll down to the Security section. You’ll see “WrangURL” was blocked to protect your Mac.
    4. -
    5. Click Open Anyway and enter your password or use Touch ID.
    6. -
    7. In the dialog that follows, click Open Anyway again.
    8. -
    - -

    If you don’t see the message, open WrangURL once more so macOS blocks it again, then come back to Privacy & Security.

    -
    - -
    -

    macOS 14 Sonoma

    -
      -
    1. In Finder, open your Applications folder.
    2. -
    3. Hold Control and click WrangURL, then choose Open from the menu.
    4. -
    5. In the dialog that follows, click Open.
    6. -
    -

    The Privacy & Security route described for macOS 15 works on Sonoma too.

    -
    - -
    -

    Using Terminal, on any version

    -

    Remove the quarantine flag macOS added when you downloaded the app:

    -
    -
    xattr -dr com.apple.quarantine /Applications/WrangURL.app
    - -
    -

    Then open WrangURL as usual. This only changes this one app.

    -
    -
    - -
    - Why does macOS block WrangURL? -

    - Apple only trusts apps without a warning when they’re signed with a paid Apple Developer ID and - sent to Apple for notarization. WrangURL releases are signed with a self-signed certificate instead, - so every release carries the same identity, but Apple can’t vouch for it. -

    -

    - You only need to allow it once. Updates from Check for Updates… are verified with a - signing key before they’re installed and open without a warning. If you’d rather not trust a - download, you can build WrangURL from source - with Xcode. -

    -
  • Run the setup assistant

    diff --git a/docs/site.js b/docs/site.js index 278910d..f666043 100644 --- a/docs/site.js +++ b/docs/site.js @@ -46,51 +46,12 @@ start(); })(); -// Gatekeeper instructions: turn the stacked panels into tabs. -document.querySelectorAll("[data-tabs]").forEach(root => { - const tabs = [...root.querySelectorAll('[role="tab"]')]; - const select = (tab, focus) => { - tabs.forEach(t => { - const on = t === tab; - t.setAttribute("aria-selected", on); - t.tabIndex = on ? 0 : -1; - document.getElementById(t.getAttribute("aria-controls")).hidden = !on; - }); - if (focus) tab.focus(); - }; - tabs.forEach((tab, n) => { - tab.addEventListener("click", () => select(tab)); - tab.addEventListener("keydown", e => { - const step = { ArrowRight: 1, ArrowLeft: -1 }[e.key]; - if (step) { e.preventDefault(); select(tabs[(n + step + tabs.length) % tabs.length], true); } - if (e.key === "Home") { e.preventDefault(); select(tabs[0], true); } - if (e.key === "End") { e.preventDefault(); select(tabs.at(-1), true); } - }); - }); - root.classList.add("js"); - select(tabs[0]); -}); - -// Copy buttons. -document.querySelectorAll("[data-copy]").forEach(button => { - button.addEventListener("click", async () => { - const text = document.getElementById(button.dataset.copy).textContent; - try { - await navigator.clipboard.writeText(text); - button.textContent = "Copied"; - } catch { - button.textContent = "Select and copy"; - } - setTimeout(() => (button.textContent = "Copy"), 2000); - }); -}); - -// Point the download button at the latest release's zip, and show its version. +// Point the download button at the latest release's DMG (older releases only have a zip), and show its version. fetch("https://api.github.com/repos/warrickbayman/WrangURL/releases/latest") .then(r => (r.ok ? r.json() : Promise.reject())) .then(release => { - const zip = release.assets.find(a => a.name.endsWith(".zip")); - if (zip) document.getElementById("download").href = zip.browser_download_url; + const asset = release.assets.find(a => a.name.endsWith(".dmg")) ?? release.assets.find(a => a.name.endsWith(".zip")); + if (asset) document.getElementById("download").href = asset.browser_download_url; const date = new Date(release.published_at).toLocaleDateString(undefined, { day: "numeric", month: "long", year: "numeric" }); document.getElementById("version").textContent = `Version ${release.tag_name.replace(/^v/, "")}, released ${date}`; }) diff --git a/docs/style.css b/docs/style.css index 2853563..25c5d68 100644 --- a/docs/style.css +++ b/docs/style.css @@ -197,7 +197,7 @@ main > section { max-width: var(--wide); margin: 0 auto; padding-inline: var(--g /* Long-form sections */ .doc { padding-block: clamp(3rem, 7vw, 5rem); border-top: 1px solid var(--line); } -.doc > :not(.pair, .wide, .shots-strip, .side, .gatekeeper) { max-width: var(--measure); } +.doc > :not(.pair, .wide, .shots-strip, .side) { max-width: var(--measure); } .section-title { font-size: clamp(2rem, 4.5vw, 3rem); font-weight: 800; @@ -240,94 +240,8 @@ main > section { max-width: var(--wide); margin: 0 auto; padding-inline: var(--g } .steps h3 { margin: 0 0 0.4rem; font-size: 1.3rem; } -/* Gatekeeper tabs */ - -.gatekeeper { - margin: 1.5rem 0 1rem; - background: var(--surface); - border: 1px solid var(--line); - border-radius: 14px; - overflow: hidden; -} -.tablist { - display: flex; flex-wrap: wrap; gap: 0.25rem; - padding: 0.4rem; - background: var(--sunken); -} -.tablist [role="tab"] { - flex: 1 0 auto; - font: 600 0.92rem var(--font); - color: var(--muted); - background: transparent; - border: 0; border-radius: 8px; - padding: 0.55rem 0.8rem; - cursor: pointer; -} -.tablist [role="tab"][aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); } -.tablist [role="tab"]:hover { color: var(--ink); } -.panel { padding: 1.25rem 1.4rem 0.4rem; } -.panel ol { padding-left: 1.3rem; margin: 0 0 1rem; } -.panel-title { margin: 0 0 0.75rem; font-size: 1rem; } -/* Without JavaScript every panel shows, each with its own title. */ -.gatekeeper:not(.js) .tablist { display: none; } -.gatekeeper:not(.js) .panel + .panel { border-top: 1px solid var(--line); } -.gatekeeper.js .panel-title { display: none; } -.gatekeeper.js .panel[hidden] { display: none; } - .note { font-size: 0.93rem; color: var(--muted); } -/* A sketch of the System Settings row, to show what to look for. */ -.mock { - border: 1px solid var(--line); - border-radius: 10px; - margin: 0 0 1rem; - font-size: 0.9rem; - background: var(--bg); -} -.mock-head { padding: 0.5rem 0.85rem; font-weight: 700; border-bottom: 1px solid var(--line); } -.mock-row { - display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; - padding: 0.7rem 0.85rem; -} -.mock-button { - padding: 0.2rem 0.75rem; - border-radius: 6px; - background: var(--surface); - border: 1px solid var(--line); - font-weight: 600; - outline: 2px solid var(--violet); - outline-offset: 2px; -} - -.code { position: relative; margin: 0 0 1rem; } -.code pre { - margin: 0; - background: var(--sunken); - border-radius: 10px; - padding: 0.9rem 5.5rem 0.9rem 1rem; - overflow-x: auto; -} -.code pre code { background: none; padding: 0; font-size: 0.9rem; overflow-wrap: normal; } -.copy { - position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%); - font: 600 0.85rem var(--font); - color: var(--ink); - background: var(--surface); - border: 1px solid var(--line); - border-radius: 7px; - padding: 0.35rem 0.7rem; - cursor: pointer; -} - -.why { - border-left: 3px solid var(--teal); - padding: 0.25rem 0 0.25rem 1rem; - margin: 1.25rem 0 0; -} -.why summary { cursor: pointer; font-weight: 600; } -.why[open] summary { margin-bottom: 0.6rem; } -.why p { color: var(--muted); } - /* Screenshots. The PNGs carry their own window shadow, so no frame is added. */ .shots-strip { diff --git a/project.yml b/project.yml index 350fdb2..f98fd3f 100644 --- a/project.yml +++ b/project.yml @@ -68,7 +68,7 @@ targets: # Read browsers installed per-user in ~/Applications (Developer ID only; not allowed on the App Store). com.apple.security.temporary-exception.files.home-relative-path.read-only: - /Applications/ - # Builds without an Apple Team ID (ad-hoc or self-signed; see scripts/resign.sh) can't load + # Builds without an Apple Team ID (ad-hoc, e.g. local Release builds) can't load # the embedded Sparkle.framework under the hardened runtime's library validation. com.apple.security.cs.disable-library-validation: true # Sparkle fetches the update feed and archive. diff --git a/scripts/release.sh b/scripts/release.sh index bd562a2..eb90fb3 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -1,19 +1,24 @@ #!/usr/bin/env bash -# Builds a Developer ID signed, notarized and stapled WrangURL.app and DMG in build/release. +# Builds a Developer ID signed, notarized and stapled WrangURL.app in build/release, packaged as a +# zip (for Sparkle updates) and a DMG (for first installs). .github/workflows/release.yml runs it too. # # One-time setup: # 1. Create a "Developer ID Application" certificate (Xcode → Settings → Accounts → # Manage Certificates, or developer.apple.com) and install it in your keychain. # 2. Store notarization credentials (use an app-specific password from account.apple.com): -# xcrun notarytool store-credentials WrangURL --apple-id --team-id RCZ39FHJ3H +# xcrun notarytool store-credentials WrangURL --apple-id --team-id 3A6RMA5S3D # # Usage: scripts/release.sh -# TEAM_ID Apple Developer team (default: RCZ39FHJ3H) +# TEAM_ID Apple Developer team (default: 3A6RMA5S3D) +# VERSION MARKETING_VERSION, e.g. 1.2.3 (default: the one in project.yml) +# BUILD_NUMBER CURRENT_PROJECT_VERSION (default: the one in project.yml) # NOTARY_PROFILE notarytool keychain profile (default: WrangURL) +# NOTARY_KEY_PATH, NOTARY_KEY_ID, NOTARY_ISSUER +# an App Store Connect API key (.p8) to notarize with instead of the profile (CI) # SKIP_NOTARIZE=1 build and sign only, e.g. to check signing before notarizing set -euo pipefail -TEAM_ID="${TEAM_ID:-RCZ39FHJ3H}" +TEAM_ID="${TEAM_ID:-3A6RMA5S3D}" NOTARY_PROFILE="${NOTARY_PROFILE:-WrangURL}" SIGNING_IDENTITY="Developer ID Application" @@ -24,8 +29,29 @@ APP="$OUT/export/WrangURL.app" step() { printf '\n==> %s\n' "$*"; } -if ! security find-identity -v -p codesigning | grep -q "$SIGNING_IDENTITY"; then - echo "error: no \"$SIGNING_IDENTITY\" certificate in the keychain (see setup at the top of this script)" >&2 +if [[ -n "${NOTARY_KEY_PATH:-}" ]]; then + NOTARY_AUTH=(--key "$NOTARY_KEY_PATH" --key-id "$NOTARY_KEY_ID" --issuer "$NOTARY_ISSUER") +else + NOTARY_AUTH=(--keychain-profile "$NOTARY_PROFILE") +fi +notarize() { + xcrun notarytool submit "$1" "${NOTARY_AUTH[@]}" --wait --output-format json > "$OUT/notarize.json" || true + cat "$OUT/notarize.json" + local id status + id=$(/usr/bin/plutil -extract id raw "$OUT/notarize.json" 2>/dev/null || true) + status=$(/usr/bin/plutil -extract status raw "$OUT/notarize.json" 2>/dev/null || true) + if [[ "$status" != Accepted ]]; then + [[ -n "$id" ]] && xcrun notarytool log "$id" "${NOTARY_AUTH[@]}" || true + echo "error: notarization of $1 failed (status: ${status:-unknown})" >&2 + exit 1 + fi +} + +# The certificate's SHA-1, for codesign, in case the keychain holds more than one Developer ID. +IDENTITY_HASH=$(security find-identity -v -p codesigning \ + | awk -v name="\"$SIGNING_IDENTITY: " -v team="($TEAM_ID)\"" 'index($0, name) && index($0, team) { print $2; exit }') +if [[ -z "$IDENTITY_HASH" ]]; then + echo "error: no \"$SIGNING_IDENTITY\" certificate for team $TEAM_ID in the keychain (see setup at the top of this script)" >&2 exit 1 fi @@ -35,19 +61,26 @@ mkdir -p "$OUT" step "Generating Xcode project" xcodegen generate --quiet +VERSION_SETTINGS=() +[[ -n "${VERSION:-}" ]] && VERSION_SETTINGS+=(MARKETING_VERSION="$VERSION") +[[ -n "${BUILD_NUMBER:-}" ]] && VERSION_SETTINGS+=(CURRENT_PROJECT_VERSION="$BUILD_NUMBER") + step "Archiving" xcodebuild archive -quiet \ -project WrangURL.xcodeproj \ -scheme WrangURL \ -configuration Release \ + -destination 'generic/platform=macOS' \ -archivePath "$ARCHIVE" \ -skipPackagePluginValidation \ DEVELOPMENT_TEAM="$TEAM_ID" \ CODE_SIGN_STYLE=Manual \ CODE_SIGN_IDENTITY="$SIGNING_IDENTITY" \ - OTHER_CODE_SIGN_FLAGS="--timestamp" + OTHER_CODE_SIGN_FLAGS="--timestamp" \ + ${VERSION_SETTINGS[@]+"${VERSION_SETTINGS[@]}"} step "Exporting" +# Exporting re-signs everything inside the app, Sparkle's helpers included, with the Developer ID. EXPORT_OPTIONS="$OUT/ExportOptions.plist" cp scripts/ExportOptions.plist "$EXPORT_OPTIONS" /usr/libexec/PlistBuddy -c "Add :teamID string $TEAM_ID" "$EXPORT_OPTIONS" @@ -57,10 +90,13 @@ xcodebuild -exportArchive -quiet \ -exportPath "$OUT/export" VERSION=$(/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" "$APP/Contents/Info.plist") +ZIP="$OUT/WrangURL-$VERSION.zip" DMG="$OUT/WrangURL-$VERSION.dmg" step "Verifying signature" codesign --verify --deep --strict --verbose=2 "$APP" +codesign -d -r- "$APP" 2>&1 | grep -q "certificate leaf\[subject.OU\] = \"$TEAM_ID\"" \ + || { echo "error: release build isn't signed by team $TEAM_ID" >&2; exit 1; } codesign -d --entitlements - "$APP" 2>/dev/null | grep -q get-task-allow \ && { echo "error: release build has the get-task-allow entitlement" >&2; exit 1; } @@ -70,10 +106,12 @@ if [[ "${SKIP_NOTARIZE:-}" == 1 ]]; then fi step "Notarizing app" -ditto -c -k --keepParent "$APP" "$OUT/WrangURL.zip" -xcrun notarytool submit "$OUT/WrangURL.zip" --keychain-profile "$NOTARY_PROFILE" --wait +ditto -c -k --keepParent "$APP" "$ZIP" +notarize "$ZIP" xcrun stapler staple "$APP" -rm "$OUT/WrangURL.zip" +# Zip the stapled app again, so the ticket travels with it. +rm "$ZIP" +ditto -c -k --keepParent "$APP" "$ZIP" step "Building DMG" STAGING="$OUT/dmg" @@ -82,14 +120,15 @@ cp -R "$APP" "$STAGING/" ln -s /Applications "$STAGING/Applications" hdiutil create -volname "WrangURL" -srcfolder "$STAGING" -ov -format UDZO "$DMG" rm -rf "$STAGING" -codesign --sign "$SIGNING_IDENTITY" --timestamp "$DMG" +codesign --sign "$IDENTITY_HASH" --timestamp "$DMG" step "Notarizing DMG" -xcrun notarytool submit "$DMG" --keychain-profile "$NOTARY_PROFILE" --wait +notarize "$DMG" xcrun stapler staple "$DMG" +rm -f "$OUT/notarize.json" step "Checking Gatekeeper" spctl --assess --type execute --verbose "$APP" spctl --assess --type open --context context:primary-signature --verbose "$DMG" -step "Done: $DMG" +step "Done: $ZIP and $DMG" diff --git a/scripts/resign.sh b/scripts/resign.sh deleted file mode 100755 index 169e019..0000000 --- a/scripts/resign.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash -# Re-signs a built WrangURL.app with a self-signed code-signing identity. -# -# Ad-hoc signatures change with every build, so macOS treats each release as a different -# app (for example when it guards the sandbox container). A self-signed certificate gives -# every release the same designated requirement. Xcode refuses untrusted identities, so -# the app is built ad-hoc and re-signed here, innermost code first (no --deep, per Sparkle). -# -# Usage: scripts/resign.sh -# identity certificate name or SHA-1 hash, e.g. "WrangURL Self-Signed". Its keychain must be -# in the search list; codesign's --keychain option alone doesn't find it. -set -euo pipefail - -APP="$1" -IDENTITY="$2" - -sign() { - codesign --force --sign "$IDENTITY" --options runtime --timestamp=none "$@" -} - -SPARKLE="$APP/Contents/Frameworks/Sparkle.framework" -if [[ -d "$SPARKLE" ]]; then - sign "$SPARKLE/Versions/B/XPCServices/Installer.xpc" - sign --preserve-metadata=entitlements "$SPARKLE/Versions/B/XPCServices/Downloader.xpc" - sign "$SPARKLE/Versions/B/Autoupdate" - sign "$SPARKLE/Versions/B/Updater.app" - sign "$SPARKLE" -fi - -# Keep the entitlements and flags Xcode signed with, but not the designated requirement, -# which for an ad-hoc build is tied to its hash. -sign --preserve-metadata=entitlements,flags "$APP" - -codesign --verify --deep --strict --verbose=2 "$APP" -codesign -d -r- "$APP" 2>&1 | grep designated