Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit
Swift apple-silicond3dmetaldxmtdxvkgame-porting-toolkitgptkmac-gamingmacosmetalfxrosetta-2steamsteam-playwinewinecx
feat(signing): sign releases with a Developer ID and notarize them
raymondchins08bb9fc7b443
diff --git a/AGENTS.md b/AGENTS.mdindex 90a83a8..1bbe4d6 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -97,8 +97,9 @@ the dylib into `Steam.app` and installs the signatures, fonts and helpers into- **Wine patches:** a patch change is not finished until the binary it produces isrebuilt with the recipe in [docs/WINECX.md](docs/WINECX.md) or the patch folder'sREADME. Then update its sha256 pins (in `docs/WINECX.md` and- `app/Sources/BridgeplayApp/Model/FreeEngineWinecx.swift`) and its entry in- [NOTICE](NOTICE). Don't commit a binary without its patch.+ `app/Sources/BridgeplayApp/Model/FreeEngineWinecx.swift`, plus+ `app/Sources/BridgeplayApp/Support/SignedPin.swift` for a `.so` or `.dylib`) and its+ entry in [NOTICE](NOTICE). Don't commit a binary without its patch.- **Legacy names stay:** existing installs depend on `notproton.dylib`, the `NOTPROTON_*`variables, `com.notproton.*` identifiers and the fallback to the old `notproton` supportfolders. Don't rename them. User-facing names are Bridgeplay's (`BRIDGEPLAY_*`).diff --git a/Makefile b/Makefileindex 46613f5..045b8f0 100644--- a/Makefile+++ b/Makefile@@ -719,9 +719,12 @@ APP_BUILD := $(shell sed -n 's/^\#define BRIDGEPLAY_BUILD \([0-9][0-9]*\)$$/\APP_UPSTREAM := $(shell sed -n 's/^\#define NOTPROTON_VERSION "\(.*\)"/\1/p' dylib/version.h)# The app's code signing identity. Ad hoc (-) by default, so any checkout builds; a release-# uses a stable self-signed identity (BRIDGEPLAY_SIGN_IDENTITY, see docs/RELEASING.md) so the+# uses the maintainer's Developer ID (BRIDGEPLAY_SIGN_IDENTITY, see docs/RELEASING.md) so the# designated requirement, and the macOS permissions keyed to it, survive updates.APP_SIGN_ID ?= $(or $(BRIDGEPLAY_SIGN_IDENTITY),-)+# Notarization needs the hardened runtime and a secure timestamp. Only a Developer ID gets+# them: library validation needs a Team ID, which ad hoc and self-signed identities lack.+APP_SIGN_FLAGS := $(if $(findstring Developer ID Application:,$(APP_SIGN_ID)),--options runtime --timestamp)# Every Mach-O file in the bundled payload, path:identifier. `make app` signs them with# APP_SIGN_ID under these identifiers before the app's own signature, so a release gives@@ -822,7 +825,7 @@ app: stamp-check app-payload $(ICON_CAR)@echo "==> Payload complete in the bundle"@payload="$(APP_BUNDLE_PAYLOAD)"; \for spec in $(PAYLOAD_SIGN_IDS); do \- codesign -f -s "$(APP_SIGN_ID)" -i "$${spec##*:}" "$$payload/$${spec%%:*}" || exit 1; \+ codesign -f -s "$(APP_SIGN_ID)" $(APP_SIGN_FLAGS) -i "$${spec##*:}" "$$payload/$${spec%%:*}" || exit 1; \done; \unlisted=$$(find "$$payload" -type f | while read -r f; do \case "$$(file -b "$$f")" in (Mach-O*) ;; (*) continue ;; esac; \@@ -833,15 +836,22 @@ app: stamp-check app-payload $(ICON_CAR)echo "$$unlisted" | sed 's/^/ /' >&2; \exit 1; \fi- @# Inside out, so Sparkle's helpers carry the same identity as the app. No hardened- @# runtime: library validation needs a Team ID, which a self-signed identity has none of.+ @# The Wine binaries and libSDL2 Bridgeplay lays into its engines are committed ad hoc+ @# and pinned. Apple notarizes only Developer ID code, so a release re-signs them under+ @# their own identifiers; SignedPin.swift matches them either way.+ @[ -z "$(APP_SIGN_FLAGS)" ] || find "$(APP_BUNDLE)/Contents/Resources" -path "$(APP_BUNDLE_PAYLOAD)" -prune \+ -o -type f -print | while read -r f; do \+ case "$$(file -b "$$f")" in (Mach-O*) ;; (*) continue ;; esac; \+ codesign -f -s "$(APP_SIGN_ID)" $(APP_SIGN_FLAGS) --preserve-metadata=identifier "$$f" || exit 1; \+ done+ @# Inside out, so Sparkle's helpers carry the same identity as the app.@sparkle="$(APP_BUNDLE)/Contents/Frameworks/Sparkle.framework/Versions/B"; \- codesign -f -s "$(APP_SIGN_ID)" -i org.sparkle-project.Sparkle.Autoupdate "$$sparkle/Autoupdate" || exit 1; \+ codesign -f -s "$(APP_SIGN_ID)" $(APP_SIGN_FLAGS) -i org.sparkle-project.Sparkle.Autoupdate "$$sparkle/Autoupdate" || exit 1; \for code in "$$sparkle"/XPCServices/*.xpc "$$sparkle/Updater.app" \"$(APP_BUNDLE)/Contents/Frameworks/Sparkle.framework"; do \- codesign -f -s "$(APP_SIGN_ID)" --preserve-metadata=entitlements "$$code" || exit 1; \+ codesign -f -s "$(APP_SIGN_ID)" $(APP_SIGN_FLAGS) --preserve-metadata=entitlements "$$code" || exit 1; \done- codesign -f -s "$(APP_SIGN_ID)" "$(APP_BUNDLE)"+ codesign -f -s "$(APP_SIGN_ID)" $(APP_SIGN_FLAGS) "$(APP_BUNDLE)"codesign --verify --strict --deep "$(APP_BUNDLE)"@codesign -d -r- "$(APP_BUNDLE)" 2>&1 | sed -n 's/^#* *designated => /==> Designated requirement: /p'@plist="$(APP_BUNDLE)/Contents/Info.plist"; \diff --git a/NOTICE b/NOTICEindex 9a667de..f1625c4 100644--- a/NOTICE+++ b/NOTICE@@ -167,8 +167,7 @@ https://github.com/sparkle-project/Sparkle/blob/2.10.0/LICENSEThe app's interface uses the Geist and Unbounded typefaces, bundled inapp/Sources/BridgeplayUI/Resources/Fonts/ under the SIL Open Font License 1.1-(OFL-Geist.txt, OFL-Unbounded.txt there). The native installer's READ ME FIRST.html-embeds the same Geist font. Game covers shown in the app are read+(OFL-Geist.txt, OFL-Unbounded.txt there). Game covers shown in the app are readfrom the user's own Steam library cache or Steam's CDN at run time; none shipwith Bridgeplay.diff --git a/README.md b/README.mdindex 949ebe5..46b9611 100644--- a/README.md+++ b/README.md@@ -67,7 +67,7 @@ To add yours: after you play, Bridgeplay asks once per game *How did it run?* On## Install1. **Download the installer** from [bridgeplay.dev](https://bridgeplay.dev): `Bridgeplay-Setup.zip`, under 1 MB. It fetches Bridgeplay, Apple's graphics, the engine and Steam (from Valve, if missing) as it installs, and checks every download against Bridgeplay's signature.-2. **Open Bridgeplay Installer.** macOS blocks it the first time: `READ ME FIRST.html` in the download shows the three clicks, Done, then **Open Anyway** in **System Settings > Privacy & Security**, then confirm with your password or Touch ID. It needs an admin account.+2. **Open Bridgeplay Installer.** It's notarized by Apple, so macOS only asks once whether to open an app downloaded from the internet: click **Open**. It needs an admin account.3. **Follow the Setup Assistant**: Rosetta, graphics, Steam sign-in, App Management and a couple of other standard macOS prompts. Setup modifies your Steam app; see [What Bridgeplay changes in Steam](#what-bridgeplay-changes-in-steam).4. **Press Play** on any Windows game in Steam. The first time you use a controller, allow Steam's Input Monitoring request.diff --git a/SECURITY.md b/SECURITY.mdindex 26a021c..bc6363a 100644--- a/SECURITY.md+++ b/SECURITY.md@@ -25,8 +25,8 @@ user is a hardening request, not a vulnerability, but it is still welcome as an## Known trade-offs-- Releases are signed with a self-signed certificate (no Apple Developer ID) and not notarized, and the- installer removes the download's quarantine flag. Download only from https://bridgeplay.dev or GitHub.+- Releases are signed with the maintainer's Apple Developer ID (Team AF38EA29BA) and notarized by Apple.+ The installer still removes the quarantine flag from the folders it sets up. Download only from https://bridgeplay.dev or GitHub.- Steam is re-signed to load Bridgeplay, with a local "NotProton Local Signing" keychain identity or ad hoc,and loses Valve's hardened runtime.- `notproton.dylib` loads for every macOS user of a shared `/Applications/Steam.app`.diff --git a/app/Sources/BridgeplayApp/Model/FreeEngine.swift b/app/Sources/BridgeplayApp/Model/FreeEngine.swiftindex 24d85cf..26ba451 100644--- a/app/Sources/BridgeplayApp/Model/FreeEngine.swift+++ b/app/Sources/BridgeplayApp/Model/FreeEngine.swift@@ -181,7 +181,7 @@ enum FreeEngine {// Files that are absent or differ from the pinned hash.static func layoutProblems(root: URL, release: FreeEngineRelease = current) -> [String] {expectedFiles(release).filter { path, hash in- Digest.sha256IfPresent(root.appending(path: path)) != hash+ !SignedPin.matches(root.appending(path: path), sha256: hash)}.keys.sorted()}@@ -208,7 +208,7 @@ enum FreeEngine {// Puts the bundled winemac-<build>.so, checked against its pin, over the engine's own.static func installMacDriver(root: URL, build: String, sha256: String, step: String) throws {guard let source = Bundle.module.url(forResource: "winemac-\(build)", withExtension: "so"),- Digest.sha256IfPresent(source) == sha256+ SignedPin.matches(source, sha256: sha256)else {throw StepFailure(step: step, detail: "Bridgeplay is missing its winemac.so for \(build).")}diff --git a/app/Sources/BridgeplayApp/Model/FreeEngineWinecx.swift b/app/Sources/BridgeplayApp/Model/FreeEngineWinecx.swiftindex 5a3947b..e1a8a3e 100644--- a/app/Sources/BridgeplayApp/Model/FreeEngineWinecx.swift+++ b/app/Sources/BridgeplayApp/Model/FreeEngineWinecx.swift@@ -423,7 +423,7 @@ enum FreeEngineWinecx {// layout that is neither stock nor a complete D3DMetal link.static func layoutProblems(root: URL, release: WinecxRelease = current) -> [String] {var problems = expectedFiles(release).filter { path, hash in- Digest.sha256IfPresent(root.appending(path: path)) != hash+ !SignedPin.matches(root.appending(path: path), sha256: hash)}.keys.sorted()if !FileManager.default.fileExists(atPath: msyncMarker(in: root).path(percentEncoded: false)) {problems.append(msyncMarkerPath)@@ -585,7 +585,7 @@ enum FreeEngineWinecx {AppLog.note("bundled file: \(name) at \(path) can't be read: \(error.localizedDescription)")throw StepFailure(step: step, detail: "Bridgeplay can't read its \(name). Reinstall Bridgeplay.")}- guard actual == file.sha256 else {+ guard actual == file.sha256 || SignedPin.matches(source, sha256: file.sha256) else {AppLog.note("bundled file: \(name) at \(path) has sha256 \(actual), expected \(file.sha256)")throw StepFailure(step: step, detail: "Bridgeplay's \(name) doesn't match its pinned checksum. Reinstall Bridgeplay.")}diff --git a/app/Sources/BridgeplayApp/Support/SignedPin.swift b/app/Sources/BridgeplayApp/Support/SignedPin.swiftnew file mode 100644index 0000000..ad10814--- /dev/null+++ b/app/Sources/BridgeplayApp/Support/SignedPin.swift@@ -0,0 +1,49 @@+// Pins for the Mach-O files Bridgeplay ships in its bundle and lays into Wine++import Foundation++// Each one is committed signed ad hoc and pinned by that file's sha256. A release re-signs it+// with the Developer ID so Apple notarizes the app (Makefile, `app`), which changes the bytes+// but not the code. So it also matches by its hash without the signature+// (MachOBuild.hashesIgnoringSignature), and an engine laid out by either build stays current.+enum SignedPin {+ // sha256 as committed -> hash without the signature. SignedPinTests checks every entry+ // against the file in Resources, so a rebuilt binary needs its line updated here.+ static let content: [String: String] = [+ // libSDL2-2.0.0.dylib+ "aeeec088bf51f9eac0dbd8e26ae994c7b8568fb42fc676835d6dc2109fc559d1":+ "2e2a0912e0b1831986684a26e68e2b195e8e7d3ae2a0e7dce7084bd23827065c",+ // win32u-winecx-11.17.so+ "b012382d09b2ff1b3c0750d93867f72dd04a7c902bc4179be406b6c558ab162d":+ "656c033cb8aa1c8b55117d68047e0d4c39aa0be90db60f366d54a1059abb2988",+ // winebus-winecx-11.15.so+ "1bc53184f5d026ab84a26cf6ef721348fc3b028c019ff969e69eb6cf9b9d1af9":+ "e57838d1adb71daf921748f2f9591cdcd2d25631a02b84cb9dddd9a110d81b27",+ // winebus-winecx-11.17.so+ "6223c035c824c90708abbc3e733f8d1d6ed6b8b4e9a3e1a5c813493ceba50473":+ "b86ea933eead8dd6ed52863c47a07fa5f79a1ec575e5d55980a1dad0e3f76615",+ // winecoreaudio-winecx-11.17.so+ "680b267e8cf41af0868de4adf7f6760615a434a4be06b4ab0cfeece2d9240faa":+ "8a4888b841096cd321d0127a4831605125b38c6e634bdd0418db7b02dbe58c3a",+ // winemac-winecx-11.15.so+ "76d8f93839386f37e8badf0c82bb31b5ead22ac580f17896f9d2a729af0fc147":+ "bb78304668d8e4098602285e7c0e4061aec627a8ab687aa576092fd2d82765bd",+ // winemac-winecx-11.17.so+ "aa192f846ad15d56de200fc92752eaf2d455700846ae2cf1ccc7b27b535f1c00":+ "2961137b297518ab99ca11f65d00388d3521bd1e9f7a118219f7617523dc841b",+ // winemac-winehq-11.15.so+ "d95fe40b6321ba8a34933a6b394af6d75547220a7168896c357af3a32377b08f":+ "fe3188214322d862ca54761fd9ab70b95afe5b670684a99284dd0b0b5101c383",+ ]++ // The committed bytes, or the same code under any valid signature.+ static func matches(_ file: URL, sha256 pin: String) -> Bool {+ guard let actual = Digest.sha256IfPresent(file) else { return false }+ if actual == pin { return true }+ guard let expected = content[pin],+ (try? Shell.run("/usr/bin/codesign", ["--verify", "--strict", file.path(percentEncoded: false)]))?.succeeded == true,+ let hashes = try? MachOBuild.hashesIgnoringSignature(of: file)+ else { return false }+ return hashes.joined(separator: ",") == expected+ }+}diff --git a/app/Tests/BridgeplayAppTests/SignedPinTests.swift b/app/Tests/BridgeplayAppTests/SignedPinTests.swiftnew file mode 100644index 0000000..c64b2fc--- /dev/null+++ b/app/Tests/BridgeplayAppTests/SignedPinTests.swift@@ -0,0 +1,54 @@+import Foundation+import Testing++@testable import BridgeplayApp++@Suite("Signed pins")+struct SignedPinTests {++ private var machOResources: [URL] {+ ["so", "dylib"].flatMap { Bundle.module.urls(forResourcesWithExtension: $0, subdirectory: nil) ?? [] }+ }++ // A rebuilt Wine binary with a new sha256 pin but a stale content line would pass in a+ // checkout and fail every engine install from a release.+ @Test("Every bundled Mach-O file has a content pin that matches it")+ func everyResourcePinned() throws {+ let files = machOResources+ #expect(files.count == SignedPin.content.count)+ for file in files {+ let sha = try Digest.sha256(of: file)+ let expected = try #require(SignedPin.content[sha], "\(file.lastPathComponent) has no SignedPin entry")+ let hashes = try #require(try MachOBuild.hashesIgnoringSignature(of: file))+ #expect(hashes.joined(separator: ",") == expected, "\(file.lastPathComponent)")+ }+ }++ // What a release does to the file (another signature over the same code) still matches;+ // a changed byte of code does not.+ @Test("A re-signed copy matches its pin, a modified copy does not")+ func resignedAndModified() throws {+ let original = try #require(Bundle.module.url(forResource: "winemac-winehq-11.15", withExtension: "so"))+ let pin = try Digest.sha256(of: original)+ let dir = FileManager.default.temporaryDirectory.appending(path: "np-signedpin-\(UUID().uuidString)")+ try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)+ defer { try? FileManager.default.removeItem(at: dir) }++ let resigned = dir.appending(path: "resigned.so")+ try FileManager.default.copyItem(at: original, to: resigned)+ let sign = try Shell.run("/usr/bin/codesign", ["-f", "-s", "-", "-i", "com.bridgeplay.signedpin-test",+ resigned.path(percentEncoded: false)])+ #expect(sign.succeeded)+ #expect(try Digest.sha256(of: resigned) != pin)+ #expect(SignedPin.matches(resigned, sha256: pin))++ let modified = dir.appending(path: "modified.so")+ var bytes = try Data(contentsOf: original)+ bytes[0x2000] ^= 0xff+ try bytes.write(to: modified)+ // Validly signed again, so only the code differs.+ #expect(try Shell.run("/usr/bin/codesign", ["-f", "-s", "-", modified.path(percentEncoded: false)]).succeeded)+ #expect(!SignedPin.matches(modified, sha256: pin))+ #expect(!SignedPin.matches(dir.appending(path: "missing.so"), sha256: pin))+ }+}diff --git a/docs/NATIVE-INSTALLER.md b/docs/NATIVE-INSTALLER.mdindex 9bcef43..b51d8ac 100644--- a/docs/NATIVE-INSTALLER.md+++ b/docs/NATIVE-INSTALLER.md@@ -18,11 +18,10 @@ make native-installerThis builds the `BridgeplayInstaller` SwiftPM product for arm64, copies its two resourcebundles, compiles installer translations, renders the Bridgeplay mark as the icon, signs the-app and packages `out/Bridgeplay-Setup.zip`: the app, `READ ME FIRST.html` (Gatekeeper steps,-with the Geist font inline), `LICENSE`, `NOTICE` and `OFL-Geist.txt`. A ZIP, not a DMG,-because a downloaded DMG makes Gatekeeper ask twice. The default is an ad hoc local build;-`BRIDGEPLAY_SIGN_IDENTITY` selects the maintainer's signing identity. Packaging fails above-5 MiB unless `BRIDGEPLAY_INSTALLER_MAX_BYTES` raises the budget for a deliberate size review.+app and packages `out/Bridgeplay-Setup.zip`: the app, `LICENSE` and `NOTICE`. The default is+an ad hoc local build; `BRIDGEPLAY_SIGN_IDENTITY` selects the maintainer's signing identity.+A Developer ID build also gets the hardened runtime and is notarized and stapled+(`scripts/notarize.sh`), so macOS opens the download after a single click on Open. Packaging fails above 5 MiB unless `BRIDGEPLAY_INSTALLER_MAX_BYTES` raises the budget for a deliberate size review.CI packages the ZIP as a build artifact and runs `native-installercheck`.`scripts/release-local.sh` attaches it to each app release after generating the appcast, sodiff --git a/docs/RELEASING.md b/docs/RELEASING.mdindex b7fded8..d4bed97 100644--- a/docs/RELEASING.md+++ b/docs/RELEASING.md@@ -1,8 +1,8 @@# Releasing BridgeplayEvery release is a GitHub release of `raymondchins/Bridgeplay` carrying `Bridgeplay.zip`,-`appcast.xml` and the small native installer, `Bridgeplay-Setup.zip` (a ZIP, not a DMG, so-Gatekeeper asks for Open Anyway once instead of twice). The native installer also downloads the `installer`+`appcast.xml` and the small native installer, `Bridgeplay-Setup.zip` (notarized, so macOS+only asks once whether to open it). The native installer also downloads the `installer`release's `Bridgeplay-Installer.zip` for GPTK, the engine and the configs, checked againstthe `Bridgeplay-Installer.zip.sig` that `release-local.sh` signs and uploads beside it. The one-click `Bridgeplay-Installer.zip` lives on its own prerelease, tag`installer` (bridgeplay.dev/download redirects to@@ -108,10 +108,10 @@ its version check stops it. `make versioncheck` covers the stamp, the bump and tthe keychain.4. Release: `scripts/release-local.sh` (notes default to the commit subjects since theprevious `vX.Y.Z` release; pass a string to override). It builds with- `scripts/build-local.sh --checks`, signs the app with the `Bridgeplay Release` identity- (see Signing), signs the zip with the EdDSA key in the login keychain, writes an appcast with `minimumSystemVersion` 26.0, packages the installer from the+ `scripts/build-local.sh --checks`, signs the app with the maintainer's Developer ID and+ notarizes it (see Signing), signs the zip with the EdDSA key in the login keychain, writes an appcast with `minimumSystemVersion` 26.0, packages the installer from thesame app (`scripts/package-installer.sh`). It also builds the native installer ZIP with the same- release identity and attaches it beside the product ZIP and appcast on `vX.Y.Z` Latest.+ Developer ID, notarized, and attaches it beside the product ZIP and appcast on `vX.Y.Z` Latest.The existing bundled installer ZIP remains on the separate `installer` tag.Any other release in the repository (a DXMT build, say) must be created with@@ -139,24 +139,38 @@ Two signatures, for different things:designated requirement is what macOS keys permissions to (App Management, which letsBridgeplay patch Steam.app). An ad hoc signature's requirement is the cdhash, which is newwith every build, so macOS treats each update as a different app: the toggle in System- Settings still looks on, but no longer applies. Releases are therefore signed with a- stable self-signed identity, and the requirement becomes- `identifier "com.bridgeplay.Bridgeplay" and certificate leaf = H"<sha1>"`, the same for- every build signed with that certificate.+ Settings still looks on, but no longer applies. Releases are therefore signed with the+ maintainer's Developer ID (Team `AF38EA29BA`), and the requirement becomes+ `identifier "com.bridgeplay.Bridgeplay" and anchor apple generic and … certificate+ leaf[subject.OU] = AF38EA29BA`, the same for every build and every renewed certificate of+ that team.+- **Notarization** lets Gatekeeper open a downloaded copy without Open Anyway. Apple scans+ the signed app; `scripts/notarize.sh` submits it with `notarytool`, staples the ticket and+ checks that `spctl` reports `Notarized Developer ID`. It needs the hardened runtime and a+ secure timestamp on every Mach-O file, which only a Developer ID gets.`make app` signs with `APP_SIGN_ID`, which defaults to `$BRIDGEPLAY_SIGN_IDENTITY` andthen to ad hoc (`-`), so any checkout still builds. Everything inside is signed with thesame identity first, inside out: Sparkle's helpers (`Autoupdate`, `Updater.app`, its XPCservices) and every Mach-O file in the payload, each under the explicit identifier`PAYLOAD_SIGN_IDS` in the Makefile gives it. `make app` stops if the payload holds a Mach-O-file that list does not name, so a new helper needs an entry there. There is no hardened-runtime: library validation needs a Team ID, which a self-signed certificate does not have. `scripts/release-local.sh` uses `BRIDGEPLAY_SIGN_IDENTITY` (default-`Bridgeplay Release`), refuses ad hoc, stops if the identity is not in the keychain, prints-the designated requirement and stops unless it is the certificate form signed by that-identity. Changing the identity or its certificate, or marking it trusted (which can turn-`certificate leaf` into `certificate root`), changes the requirement, and every user has to-grant App Management once more. The first release signed this way does that once as well,-coming from ad hoc.+file that list does not name, so a new helper needs an entry there. With a Developer ID+(`APP_SIGN_FLAGS` in the Makefile) every signature gets `--options runtime --timestamp`;+ad hoc and self-signed builds get neither, since library validation needs a Team ID. A+Developer ID build also re-signs the Wine binaries and libSDL2 in `Resources/`, which are+committed ad hoc and pinned; `SignedPin.swift` keeps their pins valid (see+[WINECX.md](WINECX.md), Shipped binaries). `release-local.sh` stops before notarizing if any+Mach-O file in the app lacks the Developer ID or a timestamp. The app+needs no entitlements: it sends no Apple Events (the Rosetta prompt's `do shell script` runs+inside `osascript`) and loads only its own and Apple's code. `scripts/release-local.sh` uses+`BRIDGEPLAY_SIGN_IDENTITY` (default `Developer ID Application: Raymond Chin (AF38EA29BA)`)+and the notarytool profile `BRIDGEPLAY_NOTARY_PROFILE` (default `bridgeplay-notary`), stops+before building if either is missing, checks the designated requirement, the hardened runtime+and the timestamp, then notarizes and staples the app before zipping it. Sparkle accepts the+change of certificate because the EdDSA key stays the same (`SUUpdateValidator`). Changing+the team changes the requirement, and every user has to grant App Management once more; the+first Developer ID release, coming from `Bridgeplay Release`, does that once as well.+`installer/Install.command` accepts either signer, so an older installer zip keeps working.### The payload helpers@@ -172,9 +186,9 @@ process: macOS charges Bluetooth, Input Monitoring and the other privacy checksprocess that started the chain, which is Steam (signed on each Mac with `NotProton LocalSigning`, `LocalSigning.swift`) or Bridgeplay itself. Signing them with the release identitykeeps their requirement stable all the same, should one of them ever hold a permission of-its own. Signing does not change what loads where: a self-signed library, like an ad hoc-one, has no Team ID, so a process with library validation refuses both and one without it-takes both. The committed Wine and SDL binaries in `Resources/` keep their own signatures,+its own. Signing does not change what loads where: the processes these load into (Steam,+re-signed locally, and the Wine loaders) have no library validation, so they take a library+from any signer. The committed Wine and SDL binaries in `Resources/` keep their own signatures,since their sha256 is pinned (`FreeEngineWinecx.swift`). `np-native` and`libnp_gamepad.dylib` are not in the app and stay ad hoc.@@ -185,18 +199,28 @@ p=out/Bridgeplay.app/Contents/Resources/BridgeplayApp_BridgeplayApp.bundle/Contefor f in $(find "$p" -type f); do file -b "$f" | grep -q ^Mach-O && codesign -d -r- "$f" 2>&1 | grep designated; done```-Each line should read `identifier "<id>" and certificate leaf = H"<sha1>"`, the same hash as-the app's. `scripts/release-local.sh` stops if any of them is not signed by the identity. The+Each line should end in `certificate leaf[subject.OU] = AF38EA29BA`, the app's team. `scripts/release-local.sh` stops if any of them is not signed by the identity. Thefirst release with signed helpers moves them from ad hoc to the certificate once; if a userever granted one of them a permission directly, they grant it once more after that update.-### Creating the release identity (once)+### Setting up the Developer ID (once per Mac)-```sh-scripts/make-release-cert.sh-```+1. In https://developer.apple.com/account/resources/certificates/add create a **Developer ID+ Application** certificate (G2 Sub-CA) from a CSR, download it and import it with its+ private key into the login keychain. `security find-identity -v -p codesigning` lists it.+2. Back it up: Keychain Access, My Certificates, Export as `.p12` with a password. Keep the+ `.p12` and the password apart (cloud drive and password manager). On a new Mac,+ double-click the `.p12`.+3. Create an app-specific password at https://account.apple.com/account/manage, then+ `xcrun notarytool store-credentials bridgeplay-notary --apple-id <id> --team-id AF38EA29BA`.++Renew the certificate before its expiry date (Keychain Access shows it). A renewed certificate of the+same team keeps the designated requirement.++### The old self-signed identity-It creates the self-signed `Bridgeplay Release` code signing identity (RSA 3072, 20 years)+Releases up to the switch were signed with `Bridgeplay Release`. `scripts/make-release-cert.sh`+still creates the self-signed `Bridgeplay Release` code signing identity (RSA 3072, 20 years)in the login keychain, asks for a backup password (12 characters or more) and writes`~/Desktop/Bridgeplay-Release.p12`. Move the `.p12` and its password into a passwordmanager and delete the file from the Desktop; on a new Mac, double-click the `.p12` todiff --git a/docs/WINECX.md b/docs/WINECX.mdindex 9cd9feb..b7d0849 100644--- a/docs/WINECX.md+++ b/docs/WINECX.md@@ -416,6 +416,12 @@ Every binary in `app/Sources/BridgeplayApp/Resources/` built from a patch or sourepository, with the sha256 of the committed file, which must equal the Swift pin in the lastcolumn. Build recipes are in the sections above and in each patch folder's README.+The Mach-O files (`.so`, `.dylib`) are committed signed ad hoc. A release re-signs them with+the Developer ID so Apple notarizes the app (see [RELEASING.md](RELEASING.md), Signing), which+changes their bytes but not their code. `SignedPin.swift` maps each sha256 below to the hash+of the file without its signature, so both copies, and engines laid out by either, pass. A+rebuilt Mach-O file needs its line there updated too; `SignedPinTests` fails until it is.+| File | Built from | sha256 | Pinned in ||---|---|---|---|| `crypt32-winecx-11.17.dll` | `ngx-signer-patch/` | `27b485cc2a6bf651d8d72173e5d40dbc914666d3f8e8f6a4031a91c5ff22ebbf` | `FreeEngineWinecx.v1117.nvidia` |diff --git a/installer/Install.command b/installer/Install.commandindex 26389b8..afa4c27 100755--- a/installer/Install.command+++ b/installer/Install.command@@ -50,9 +50,9 @@ steam_tmp=""steam_mnt=""# The installer carries no app, so it never goes stale: it installs the Latest release.app_url="https://github.com/raymondchins/Bridgeplay/releases/latest/download/Bridgeplay.zip"-# Release builds are signed with the self-signed "Bridgeplay Release" identity; pin its leaf-# so an ad-hoc or other-signed zip on the release fails.-app_requirement='=identifier "com.bridgeplay.Bridgeplay" and certificate leaf = H"63cd686b8e4c1123ef885e90e1127fefd5bd42b1"'+# Release builds are signed with the maintainer's Developer ID (Team AF38EA29BA); releases+# before it carry the self-signed "Bridgeplay Release" leaf. An ad-hoc or other-signed zip fails.+app_requirement='=identifier "com.bridgeplay.Bridgeplay" and (anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] and certificate leaf[field.1.2.840.113635.100.6.1.13] and certificate leaf[subject.OU] = "AF38EA29BA" or certificate leaf = H"63cd686b8e4c1123ef885e90e1127fefd5bd42b1")'app_tmp=""# shellcheck disable=SC2329 # runs from the EXIT trapcleanup() {diff --git a/installer/native/READ ME FIRST.html b/installer/native/READ ME FIRST.htmldeleted file mode 100644index a55acee..0000000--- a/installer/native/READ ME FIRST.html+++ /dev/null@@ -1,147 +0,0 @@-<!doctype html>-<html lang="en">-<head>-<meta charset="utf-8">-<meta name="viewport" content="width=device-width, initial-scale=1">-<title>Open Bridgeplay Installer</title>-<style>- @font-face { font-family: "Geist"; src: url("{{font:geist}}") format("woff2"); font-weight: 100 900; }- :root {- color-scheme: dark;- --bg: #000; --raise: #0b0b0d; --fg: #f5f5f7; --fg-2: #a1a1a6; --fg-3: #86868b;- --line: rgb(255 255 255 / 0.1); --line-strong: rgb(255 255 255 / 0.18);- --iri-violet: #8b7bff; --iri-blue: #4fb3ff; --iri-pink: #ff7ac6;- --sans: "Geist", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;- }- * { box-sizing: border-box; }- html { background: var(--bg); }- body {- margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans);- font-size: 17px; line-height: 1.47; letter-spacing: -0.012em;- -webkit-font-smoothing: antialiased; font-feature-settings: "ss01";- }- ::selection { background: var(--iri-violet); color: #fff; }- main { width: min(760px, 100% - 40px); margin: 0 auto; padding: 36px 0 72px; }- .wordmark { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 17px; letter-spacing: -0.03em; }- .mark { width: 24px; height: 24px; }- h1 { margin: 56px 0 0; font-size: clamp(34px, 5vw, 48px); line-height: 1.06; letter-spacing: -0.035em; font-weight: 700; text-wrap: balance; }- .iri { background: linear-gradient(100deg, var(--iri-violet), var(--iri-blue) 50%, var(--iri-pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }- .lede { margin: 14px 0 0; max-width: 34em; color: var(--fg-2); text-wrap: pretty; }- ol { list-style: none; margin: 44px 0 0; padding: 0; position: relative; }- ol::before { content: ""; position: absolute; left: 21px; top: 22px; bottom: 22px; width: 1px; background: linear-gradient(var(--line), var(--line-strong), var(--line)); }- li { display: grid; grid-template-columns: 44px 1fr; gap: 20px; padding: 0 0 40px; }- li:last-child { padding-bottom: 0; }- .num {- position: relative; z-index: 1; width: 44px; height: 44px; border-radius: 8px; display: grid; place-items: center;- background: #161618; border: 1px solid var(--line); box-shadow: 0 0 0 6px var(--bg); font-weight: 600; font-size: 16px;- }- li:last-child .num { color: #000; border-color: transparent; background: linear-gradient(135deg, var(--iri-violet), var(--iri-blue) 55%, var(--iri-pink)); }- h2 { margin: 9px 0 6px; font-size: 20px; letter-spacing: -0.02em; font-weight: 650; }- li p { margin: 0 0 16px; font-size: 15px; line-height: 1.5; color: var(--fg-2); max-width: 36em; }- li p b { color: var(--fg); font-weight: 600; }- /* Drawn copies of macOS's own dialogs and Settings rows; the button to click is ringed. */- .mac { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif; letter-spacing: 0; color: #f5f5f7; }- .dialog {- position: relative; width: min(300px, 100%); padding: 22px 18px 18px; border-radius: 28px;- background: #2c2c2e; border: 1px solid rgb(255 255 255 / 0.12);- box-shadow: 0 30px 60px -20px rgb(0 0 0 / 0.8), inset 0 1px 0 rgb(255 255 255 / 0.06);- }- .dialog .help { position: absolute; right: 16px; top: 16px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: rgb(255 255 255 / 0.1); color: #c7c7cc; font-size: 14px; font-weight: 600; }- .dialog .icon { width: 64px; height: 64px; margin: 0 0 16px 4px; display: block; }- .dialog h3 { margin: 0 4px 8px; font-size: 15px; line-height: 1.3; font-weight: 700; }- .dialog .body { margin: 0 4px 18px; font-size: 13px; line-height: 1.4; color: #d1d1d6; }- .dialog .btn { display: block; width: 100%; margin-top: 8px; padding: 7px 0; border-radius: 999px; text-align: center; font-size: 13px; font-weight: 500; background: rgb(255 255 255 / 0.12); }- .dialog .btn.blue { background: #0a84ff; color: #fff; }- .target { position: relative; box-shadow: 0 0 0 2px #000, 0 0 0 4px var(--iri-blue), 0 0 18px 4px rgb(79 179 255 / 0.45); }- .settings { width: min(560px, 100%); padding: 18px 16px 4px; border-radius: 16px; background: #1e1e20; border: 1px solid rgb(255 255 255 / 0.1); }- .settings h4 { margin: 0 4px 10px; font-size: 14px; font-weight: 700; }- .group { border-radius: 12px; background: #2a2a2d; margin-bottom: 12px; }- .row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; font-size: 13px; }- .row + .row { border-top: 1px solid rgb(255 255 255 / 0.07); }- .row .grow { flex: 1; }- .row .value { color: #d1d1d6; display: inline-flex; align-items: center; gap: 8px; }- .row .stepper { width: 20px; height: 20px; border-radius: 6px; background: rgb(255 255 255 / 0.12); display: grid; place-items: center; font-size: 10px; }- .row .small { font-size: 12px; color: #a1a1a6; line-height: 1.4; }- .row .mbtn { padding: 4px 12px; border-radius: 7px; background: rgb(255 255 255 / 0.14); white-space: nowrap; }- .faded { opacity: 0.4; }- .pill {- display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 22px 0 18px; margin: 2px 0 18px;- border-radius: 999px; background: #f5f5f7; color: #000; text-decoration: none;- font-weight: 600; font-size: 16px; letter-spacing: -0.015em; box-shadow: 0 10px 24px -12px rgb(0 0 0 / 0.9);- transition: background 0.25s cubic-bezier(0.16, 1, 0.3, 1);- }- .pill:hover { background: #fff; }- .pill svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }- .foot { margin: 56px 0 0; padding-top: 22px; border-top: 1px solid var(--line); font-size: 13px; color: var(--fg-3); }-</style>-</head>-<body>-<main>- <span class="wordmark">- <svg class="mark" viewBox="0 0 24 24" aria-hidden="true"><path d="M2 14h20" stroke="#f5f5f7" stroke-width="1.8" stroke-linecap="round"/><path d="M6.5 4.6v9.4M17.5 4.6v9.4" stroke="#f5f5f7" stroke-width="1.8" stroke-linecap="round"/><path d="M2 7c2.5 0 3.5-3 4.5-3S9.5 11 12 11s4.5-7 5.5-7 2 3 4.5 3" fill="none" stroke="#f5f5f7" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"/><path d="M6.5 16.5v2.9M17.5 16.5v2.9M2 21C3.5 21 5 19.955 6.5 19.4C8.33 18.72 10.17 17.3 12 17.3C13.83 17.3 15.67 18.72 17.5 19.4C19 19.955 20.5 21 22 21" fill="none" stroke="#f5f5f7" stroke-width="1.2" stroke-linecap="round" opacity=".35"/></svg>- Bridgeplay- </span>-- <h1>Three clicks to <span class="iri">open the installer</span>.</h1>- <p class="lede">macOS asks once before it opens an app from outside the App Store. Allow it here, and the installer downloads Bridgeplay, Steam and everything else for you.</p>-- <ol>- <li>- <span class="num">1</span>- <div>- <h2>Open the installer, then click Done</h2>- <p>The Finder window is right behind this page. Double-click <b>Bridgeplay Installer</b> there. macOS says it can't check the app: click <b>Done</b>, not Move to Trash.</p>- <div class="mac dialog" role="img" aria-label="macOS dialog: Bridgeplay Installer Not Opened, with Move to Trash and Done buttons">- <span class="help">?</span><svg class="icon" viewBox="0 0 64 64" aria-hidden="true"><defs><linearGradient id="sv" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#f2f2f4"/><stop offset="1" stop-color="#a9a9ae"/></linearGradient><radialGradient id="dl" cx=".5" cy=".45" r=".6"><stop offset="0" stop-color="#9a9aa0"/><stop offset="1" stop-color="#5d5d63"/></radialGradient></defs><rect x="4" y="4" width="50" height="50" rx="12" fill="url(#sv)"/><circle cx="29" cy="29" r="16" fill="#e6e6ea" stroke="#8e8e93" stroke-width="1.5"/><circle cx="29" cy="29" r="12" fill="url(#dl)"/><path d="M29 15v5M29 38v5M15 29h5M38 29h5" stroke="#6e6e73" stroke-width="2" stroke-linecap="round"/><path d="M45 36 58 59H32Z" fill="#ffcc00" stroke="#c99a00" stroke-width="1.5" stroke-linejoin="round"/><path d="M45 44v7" stroke="#3a3000" stroke-width="2.6" stroke-linecap="round"/><circle cx="45" cy="55" r="1.6" fill="#3a3000"/></svg>- <h3>“Bridgeplay Installer”<br>Not Opened</h3>- <p class="body">Apple could not verify “Bridgeplay Installer” is free of malware that may harm your Mac or compromise your privacy.</p>- <span class="btn blue">Move to Trash</span>- <span class="btn target">Done</span>- </div>- </div>- </li>- <li>- <span class="num">2</span>- <div>- <h2>Allow it in Privacy & Security</h2>- <a class="pill" href="x-apple.systempreferences:com.apple.settings.PrivacySecurity.extension">- <svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3l7 3v5c0 4.5-3 8.3-7 10-4-1.7-7-5.5-7-10V6l7-3z"/><path d="M9 12l2 2 4-4"/></svg>- Open Privacy & Security- </a>- <p>Scroll down to <b>Security</b>. Next to “Bridgeplay Installer was blocked”, click <b>Open Anyway</b>.</p>- <div class="mac settings" role="img" aria-label="System Settings, Privacy and Security, Security section with the Open Anyway button">- <h4>Security</h4>- <div class="group">- <div class="row"><span class="grow">Allow applications from</span><span class="value">App Store & Known Developers <span class="stepper">⌃</span></span></div>- </div>- <div class="group">- <div class="row"><span class="grow">“Bridgeplay Installer” was blocked to protect your Mac.</span><span class="mbtn target">Open Anyway</span></div>- <div class="row"><span class="small">Apple could not verify “Bridgeplay Installer” is free of malware that may harm your Mac or compromise your privacy.</span></div>- </div>- <div class="group faded">- <div class="row"><span class="grow">FileVault</span><span class="value">On ›</span></div>- </div>- </div>- </div>- </li>- <li>- <span class="num">3</span>- <div>- <h2>Confirm, and you're done here</h2>- <p>Click <b>Open Anyway</b> once more and use Touch ID or your Mac password. The installer opens and takes it from there.</p>- <div class="mac dialog" role="img" aria-label="macOS dialog: Open Bridgeplay Installer?, with Move to Trash, Open Anyway and Done buttons">- <span class="help">?</span><svg class="icon" viewBox="0 0 64 64" aria-hidden="true"><defs><linearGradient id="sv" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#f2f2f4"/><stop offset="1" stop-color="#a9a9ae"/></linearGradient><radialGradient id="dl" cx=".5" cy=".45" r=".6"><stop offset="0" stop-color="#9a9aa0"/><stop offset="1" stop-color="#5d5d63"/></radialGradient></defs><rect x="4" y="4" width="50" height="50" rx="12" fill="url(#sv)"/><circle cx="29" cy="29" r="16" fill="#e6e6ea" stroke="#8e8e93" stroke-width="1.5"/><circle cx="29" cy="29" r="12" fill="url(#dl)"/><path d="M29 15v5M29 38v5M15 29h5M38 29h5" stroke="#6e6e73" stroke-width="2" stroke-linecap="round"/><path d="M45 36 58 59H32Z" fill="#ffcc00" stroke="#c99a00" stroke-width="1.5" stroke-linejoin="round"/><path d="M45 44v7" stroke="#3a3000" stroke-width="2.6" stroke-linecap="round"/><circle cx="45" cy="55" r="1.6" fill="#3a3000"/></svg>- <h3>Open “Bridgeplay Installer”?</h3>- <p class="body">Apple is not able to verify that it is free from malware that could harm your Mac or compromise your privacy. Don’t open this unless you are certain it is from a trustworthy source.</p>- <span class="btn blue">Move to Trash</span>- <span class="btn target">Open Anyway</span>- <span class="btn">Done</span>- </div>- </div>- </li>- </ol>-- <p class="foot">macOS asks because Bridgeplay is free and not notarized by Apple. It asks only this once. Updates keep your settings, game prefixes and saves.</p>-</main>-</body>-</html>diff --git a/scripts/notarize.sh b/scripts/notarize.shnew file mode 100755index 0000000..db44480--- /dev/null+++ b/scripts/notarize.sh@@ -0,0 +1,51 @@+#!/bin/sh+# Notarize a signed app bundle with Apple and staple the ticket to it, so Gatekeeper opens a+# downloaded copy without Open Anyway, offline too. See docs/RELEASING.md (Signing).+#+# scripts/notarize.sh <path/to/Some.app>+#+# Env: BRIDGEPLAY_NOTARY_PROFILE notarytool keychain profile (default "bridgeplay-notary"),+# created once with `xcrun notarytool store-credentials`.++set -eu++die() { echo "==> $*" >&2; exit 1; }++[ "$#" -eq 1 ] && [ -d "$1" ] || die "usage: $0 <path/to/Some.app>"+app=$1+profile=${BRIDGEPLAY_NOTARY_PROFILE:-bridgeplay-notary}++# Apple refuses anything without a Developer ID, the hardened runtime and a secure+# timestamp; checking here fails in seconds instead of after the upload.+codesign --verify --strict --deep "$app" || die "$app is not validly signed"+info=$(codesign -dvv "$app" 2>&1)+printf '%s\n' "$info" | grep -q '^Authority=Developer ID Application: ' \+ || die "$app is not signed with a Developer ID Application certificate"+printf '%s\n' "$info" | grep -q '^Timestamp=' || die "$app has no secure timestamp (codesign --timestamp)"+codesign -d --verbose=1 "$app" 2>&1 | grep -q 'flags=.*runtime' \+ || die "$app does not have the hardened runtime (codesign --options runtime)"++work=$(mktemp -d)+trap 'rm -rf "$work"' EXIT+zip="$work/$(basename "$app" .app).zip"+ditto -c -k --keepParent "$app" "$zip"++echo "==> notarizing $(basename "$app") (profile $profile), usually a few minutes"+result="$work/result.json"+xcrun notarytool submit "$zip" --keychain-profile "$profile" --wait --output-format json >"$result" \+ || { cat "$result" >&2; die "notarytool submit failed"; }+id=$(plutil -extract id raw -o - "$result" 2>/dev/null || true)+status=$(plutil -extract status raw -o - "$result" 2>/dev/null || true)+if [ "$status" != "Accepted" ]; then+ # The log names each file Apple rejected and why.+ [ -z "$id" ] || xcrun notarytool log "$id" --keychain-profile "$profile" >&2 || true+ die "notarization of $app: ${status:-no status} (submission ${id:-unknown})"+fi+echo "==> notarized (submission $id)"++xcrun stapler staple "$app" >/dev/null || die "could not staple the ticket to $app"+xcrun stapler validate "$app" >/dev/null || die "the stapled ticket on $app does not validate"+# What Gatekeeper decides for a downloaded copy.+spctl --assess --type execute -vv "$app" 2>&1 | grep -q 'source=Notarized Developer ID' \+ || die "Gatekeeper does not accept $app as Notarized Developer ID"+echo "==> stapled; Gatekeeper: Notarized Developer ID"diff --git a/scripts/package-native-installer.sh b/scripts/package-native-installer.shindex badc17d..67b1ae5 100755--- a/scripts/package-native-installer.sh+++ b/scripts/package-native-installer.sh@@ -1,9 +1,7 @@#!/bin/sh# Build the small native bootstrap without Wine, GPTK or the product payload, as a ZIP with-# the app, READ ME FIRST.html (how to get past Gatekeeper) and the licence files: LICENSE,-# NOTICE and OFL-Geist.txt for the Geist font the page embeds. A downloaded DMG is-# checked by Gatekeeper on its own, then the app in it again: two Open Anyway prompts. A ZIP-# is not, so the app is the only one.+# the app, LICENSE and NOTICE. A release build is notarized, so macOS only asks once whether+# to open an app downloaded from the internet; the app carries its own font licences.set -eurepo=$(cd "$(dirname "$0")/.." && pwd)cd "$repo"@@ -72,26 +70,26 @@ cat > "$bundle/Contents/Info.plist" <<'PLIST'</dict></plist>PLISTcp LICENSE "$bundle/Contents/Resources/LICENSE"-codesign --force --sign "$identity" "$bundle"-codesign --verify --strict --deep "$bundle"+# A Developer ID build gets the hardened runtime and a timestamp and is notarized, so the+# downloaded installer opens without Open Anyway. Ad hoc and other identities stay as they were.+case "$identity" in+ "Developer ID Application: "*)+ codesign --force --sign "$identity" --options runtime --timestamp "$bundle"+ codesign --verify --strict --deep "$bundle"+ "$repo/scripts/notarize.sh" "$bundle"+ ;;+ *)+ codesign --force --sign "$identity" "$bundle"+ codesign --verify --strict --deep "$bundle"+ ;;+esac# Only replace previous local packaging outputs after a complete bundle is available.rm -rf "$app"ditto "$bundle" "$app"-# READ ME FIRST.html carries its Geist font inline, so it is one file.package="$stage/package"mkdir -p "$package"ditto "$app" "$package/Bridgeplay Installer.app"-python3 - "$repo/installer/native/READ ME FIRST.html" "$repo/app/Sources/BridgeplayUI/Resources/Fonts" "$package/READ ME FIRST.html" <<'PYTHON'-import base64-import pathlib-import re-import sys-page, fonts, out = pathlib.Path(sys.argv[1]), pathlib.Path(sys.argv[2]), pathlib.Path(sys.argv[3])-def font(match):- return "data:font/woff2;base64," + base64.b64encode((fonts / (match.group(1) + ".woff2")).read_bytes()).decode()-out.write_text(re.sub(r"\{\{font:(\w+)\}\}", font, page.read_text()))-PYTHON-cp LICENSE NOTICE app/Sources/BridgeplayUI/Resources/Fonts/OFL-Geist.txt "$package/"+cp LICENSE NOTICE "$package/"rm -f "$zip"(cd "$package" && ditto -c -k --norsrc --noextattr . "$zip")size=$(stat -f '%z' "$zip")diff --git a/scripts/release-local.sh b/scripts/release-local.shindex 2182c43..6b853ab 100755--- a/scripts/release-local.sh+++ b/scripts/release-local.sh@@ -14,8 +14,9 @@## The update is signed with the EdDSA key in this Mac's login keychain, created once with# app/.build/artifacts/sparkle/Sparkle/bin/generate_keys; app/Info.plist's SUPublicEDKey-# must be its public half. The app is code signed with BRIDGEPLAY_SIGN_IDENTITY (default-# "Bridgeplay Release", a self-signed identity in the login keychain). The version comes+# must be its public half. The app is code signed with BRIDGEPLAY_SIGN_IDENTITY (default the+# maintainer's Developer ID in the login keychain) and notarized with the notarytool profile+# BRIDGEPLAY_NOTARY_PROFILE (default "bridgeplay-notary"). The version comes# from dylib/version.h (scripts/bump-version.sh) and must not have been released yet.# HEAD must already be pushed to the Bridgeplay repository's main.@@ -119,16 +120,30 @@ sparkle=app/.build/artifacts/sparkle/Sparkle/bin[ -x "$sparkle/generate_appcast" ] || swift build --package-path app >/dev/null[ -x "$sparkle/generate_appcast" ] || die "no Sparkle tools at $sparkle"-# The app is signed with a stable self-signed identity, so its designated requirement (and-# the macOS permissions keyed to it, such as App Management) stays the same across updates.-# An ad hoc signature is the cdhash, new with every build. See docs/RELEASING.md (Signing).-sign_identity=${BRIDGEPLAY_SIGN_IDENTITY:-Bridgeplay Release}-[ "$sign_identity" != "-" ] || check "BRIDGEPLAY_SIGN_IDENTITY is ad hoc (-); a release needs the stable identity"-if [ "$dry_run" -eq 0 ] && ! security find-identity -p codesigning | grep -Fq "\"$sign_identity\""; then- die "no code signing identity \"$sign_identity\" in the keychain; create it once (docs/RELEASING.md, Signing)"+# The app is signed with the maintainer's Developer ID, so its designated requirement (and+# the macOS permissions keyed to it, such as App Management) stays the same across updates,+# and notarized, so Gatekeeper opens a downloaded copy without Open Anyway. An ad hoc+# signature is the cdhash, new with every build. See docs/RELEASING.md (Signing).+team_id=AF38EA29BA+sign_identity=${BRIDGEPLAY_SIGN_IDENTITY:-Developer ID Application: Raymond Chin ($team_id)}+case "$sign_identity" in+ "Developer ID Application: "*"($team_id)") ;;+ *) check "BRIDGEPLAY_SIGN_IDENTITY \"$sign_identity\" is not the Developer ID of team $team_id; Apple notarizes only that" ;;+esac+if [ "$dry_run" -eq 0 ] && ! security find-identity -v -p codesigning | grep -Fq "\"$sign_identity\""; then+ die "no valid code signing identity \"$sign_identity\" in the keychain; install it once (docs/RELEASING.md, Signing)"fiBRIDGEPLAY_SIGN_IDENTITY=$sign_identityexport BRIDGEPLAY_SIGN_IDENTITY+notary_profile=${BRIDGEPLAY_NOTARY_PROFILE:-bridgeplay-notary}+BRIDGEPLAY_NOTARY_PROFILE=$notary_profile+export BRIDGEPLAY_NOTARY_PROFILE+if [ "$dry_run" -eq 0 ]; then+ # history makes one authenticated call, so a missing or revoked profile stops here, not+ # after the build.+ xcrun notarytool history --keychain-profile "$notary_profile" >/dev/null 2>&1 \+ || die "notarytool profile \"$notary_profile\" missing or rejected; xcrun notarytool store-credentials $notary_profile --apple-id <id> --team-id $team_id"+fiif [ "$dry_run" -eq 1 ]; thenout=out/release@@ -182,9 +197,11 @@ codesign --verify --strict --deep "$app" || die "$app is not validly signed; Sparequirement=$(codesign -d -r- "$app" 2>&1 | sed -n 's/^#* *designated => //p')echo "==> designated requirement: $requirement"case "$requirement" in- 'identifier "com.bridgeplay.Bridgeplay" and certificate '*' = H"'*'"') ;;- *) check "$app is not signed with a certificate (ad hoc?), so macOS would forget its permissions on update" ;;+ 'identifier "com.bridgeplay.Bridgeplay" and anchor apple generic and '*"certificate leaf[subject.OU] = $team_id") ;;+ *) check "$app is not signed with the Developer ID of team $team_id, so macOS would forget its permissions on update" ;;esac+codesign -d --verbose=1 "$app" 2>&1 | grep -q 'flags=.*runtime' || check "$app does not have the hardened runtime"+codesign -dvv "$app" 2>&1 | grep -q '^Timestamp=' || check "$app has no secure timestamp"codesign -dvv "$app" 2>&1 | grep -Fqx "Authority=$sign_identity" \|| check "$app is not signed by \"$sign_identity\""# The helpers in the payload (Makefile PAYLOAD_SIGN_IDS) carry the same identity.@@ -199,6 +216,20 @@ done <"$machos"echo "==> payload: checked $(wc -l <"$machos" | tr -d ' ') helpers for \"$sign_identity\""rm -f "$machos"+# Apple rejects the whole app for one Mach-O file without the Developer ID or a timestamp.+unsigned=$(find "$app" -type f -exec sh -c 'file -b "$1" | grep -q "^Mach-O" || exit 0+ info=$(codesign -dvv "$1" 2>&1)+ printf "%s\n" "$info" | grep -Fqx "Authority=$2" && printf "%s\n" "$info" | grep -q "^Timestamp=" || echo "$1"' \+ sh {} "$sign_identity" \;)+[ -z "$unsigned" ] || check "not signed with \"$sign_identity\" and a timestamp, so notarization would fail: $(printf '%s\n' "$unsigned" | sed "s#^$app/##" | tr '\n' ' ')"++# Notarize before the archives are made, so the stapled ticket is inside every zip.+if [ "$dry_run" -eq 1 ]; then+ echo "==> dry run: would notarize and staple $app (profile $notary_profile)"+else+ scripts/notarize.sh "$app"+fi+# One archive and one appcast per feed. The appcast attached to the latest release is the# feed, so each only needs the newest item; its enclosure points at this tag's zip.# $1 directory, $2 archive name, $3 app name inside it, $4 repository