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
build(signing): sign the payload helpers with the release identity
raymondchins8e8906636218
diff --git a/Makefile b/Makefileindex f42c3a9..fb54baa 100644--- a/Makefile+++ b/Makefile@@ -727,6 +727,24 @@ APP_UPSTREAM := $(shell sed -n 's/^\#define NOTPROTON_VERSION "\(.*\)"/\1/p' dyl# designated requirement, and the macOS permissions keyed to it, survive updates.APP_SIGN_ID ?= $(or $(BRIDGEPLAY_SIGN_IDENTITY),-)+# 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+# each one a certificate-based designated requirement as well. The build rules above keep+# signing ad hoc for tests and `make deploy`. Existing com.notproton.* identifiers stay.+PAYLOAD_SIGN_IDS := \+ notproton.dylib:com.bridgeplay.notproton \+ overlay-shim.dylib:com.bridgeplay.overlay-shim \+ iconmaker:com.bridgeplay.iconmaker \+ appinfo:com.bridgeplay.appinfo \+ game-host.dylib:com.notproton.game-host \+ prepare-game-loader:com.notproton.game-metadata \+ controllers/dualsense/bridge.dylib:com.notproton.dualsense.bridge \+ controllers/dualsense/broker:com.notproton.dualsense.broker \+ controllers/dualsense/launch:com.notproton.dualsense.launch \+ controllers/steam-input/rumble.dylib:com.notproton.steam-input.rumble \+ bridge/x86_64-unix-lsteamclient.so:com.bridgeplay.lsteamclient \+ bridge/aarch64-unix-lsteamclient.so:com.bridgeplay.lsteamclient+# The icon name must match CFBundleIconFile/CFBundleIconName in app/Info.plist.ICON_NAME := BridgeplayICON_MARK := helpers/icon/bridgeplay-mark.svg@@ -796,6 +814,19 @@ app: app-payload $(ICON_CAR)exit 1; \fi@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; \+ done; \+ unlisted=$$(find "$$payload" -type f | while read -r f; do \+ case "$$(file -b "$$f")" in (Mach-O*) ;; (*) continue ;; esac; \+ case " $(PAYLOAD_SIGN_IDS) " in (*" $${f#"$$payload"/}:"*) ;; (*) echo "$${f#"$$payload"/}" ;; esac; \+ done); \+ if [ -n "$$unlisted" ]; then \+ echo "==> payload Mach-O files missing from PAYLOAD_SIGN_IDS in the Makefile:" >&2; \+ 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.@sparkle="$(APP_BUNDLE)/Contents/Frameworks/Sparkle.framework/Versions/B"; \diff --git a/SECURITY.md b/SECURITY.mdindex 65cc791..acb23ac 100644--- a/SECURITY.md+++ b/SECURITY.md@@ -25,7 +25,8 @@ user is a hardening request, not a vulnerability, but it is still welcome as an## Known trade-offs-- Bridgeplay is ad hoc signed and not notarized, and the installer removes the download's+- Bridgeplay releases are signed with a self-signed certificate (no Apple Developer ID)+ and not notarized, and the installer removes the download'squarantine flag. Download it only from https://bridgeplay.dev or the GitHub releases.- Steam is re-signed so it can load Bridgeplay, which removes Valve's hardened runtime.- Updates are verified with an EdDSA signature (`SUPublicEDKey`) before they are installed.diff --git a/docs/BUILD-LOCAL.md b/docs/BUILD-LOCAL.mdindex d8d10a9..c753e7b 100644--- a/docs/BUILD-LOCAL.md+++ b/docs/BUILD-LOCAL.md@@ -30,7 +30,7 @@ output to `build/logs/<phase>.log`.| Path | What ||---|---|-| `build/Bridgeplay.app` | ad-hoc signed app, passes `codesign --verify --strict` |+| `build/Bridgeplay.app` | app signed ad hoc (or with `BRIDGEPLAY_SIGN_IDENTITY` when set), passes `codesign --verify --strict` || `build/Bridgeplay.zip` | `ditto -c -k --keepParent` of the app, as CI packages it || `out/Bridgeplay.app` | the bundle `make app` writes; the script copies it to `build/` |diff --git a/docs/RELEASING.md b/docs/RELEASING.mdindex 8ac5053..7940841 100644--- a/docs/RELEASING.md+++ b/docs/RELEASING.md@@ -86,10 +86,12 @@ Two signatures, for different things:every build signed with that certificate.`make app` signs with `APP_SIGN_ID`, which defaults to `$BRIDGEPLAY_SIGN_IDENTITY` and-then to ad hoc (`-`), so any checkout still builds. Sparkle's helpers (`Autoupdate`,-`Updater.app`, its XPC services) are signed with the same identity, inside out. 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+then to ad hoc (`-`), so any checkout still builds. Everything inside is signed with the+same identity first, inside out: Sparkle's helpers (`Autoupdate`, `Updater.app`, its XPC+services) 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, printsthe designated requirement and stops unless it is the certificate form signed by thatidentity. Changing the identity or its certificate, or marking it trusted (which can turn@@ -97,6 +99,40 @@ identity. Changing the identity or its certificate, or marking it trusted (whichgrant App Management once more. The first release signed this way does that once as well,coming from ad hoc.+### The payload helpers++| Payload file | Identifier | Runs as |+|---|---|---|+| `notproton.dylib` | `com.bridgeplay.notproton` | inside Steam; the app re-signs Steam's copy with the local identity below |+| `overlay-shim.dylib`, `game-host.dylib` | `com.bridgeplay.overlay-shim`, `com.notproton.game-host` | inserted into the game's Wine loader |+| `controllers/dualsense/bridge.dylib`, `controllers/steam-input/rumble.dylib` | `com.notproton.dualsense.bridge`, `com.notproton.steam-input.rumble` | inserted into the game's Wine loader |+| `controllers/dualsense/launch`, `controllers/dualsense/broker` | `com.notproton.dualsense.launch`, `com.notproton.dualsense.broker` | child processes of the run script |+| `iconmaker`, `appinfo`, `prepare-game-loader` | `com.bridgeplay.iconmaker`, `com.bridgeplay.appinfo`, `com.notproton.game-metadata` | command-line tools the run script calls |+| `bridge/*-unix-lsteamclient.so` | `com.bridgeplay.lsteamclient` | loaded by Wine |++None of them is launched by launchd or LaunchServices, so none is its own responsible+process: macOS charges Bluetooth, Input Monitoring and the other privacy checks to the+process that started the chain, which is Steam (signed on each Mac with `NotProton Local+Signing`, `LocalSigning.swift`) or Bridgeplay itself. Signing them with the release identity+keeps 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,+since their sha256 is pinned (`FreeEngineWinecx.swift`). `np-native` and+`libnp_gamepad.dylib` are not in the app and stay ad hoc.++To check a build:++```sh+p=out/Bridgeplay.app/Contents/Resources/BridgeplayApp_BridgeplayApp.bundle/Contents/Resources/payload+for 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+first release with signed helpers moves them from ad hoc to the certificate once; if a user+ever granted one of them a permission directly, they grant it once more after that update.+### Creating the release identity (once)```shdiff --git a/scripts/release-local.sh b/scripts/release-local.shindex 13d9245..b6d5ef3 100755--- a/scripts/release-local.sh+++ b/scripts/release-local.sh@@ -187,6 +187,17 @@ case "$requirement" inesaccodesign -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.+payload=$app/Contents/Resources/BridgeplayApp_BridgeplayApp.bundle/Contents/Resources/payload+machos=$(mktemp)+find "$payload" -type f -exec sh -c 'file -b "$1" | grep -q "^Mach-O" && printf "%s\n" "$1"' sh {} \; >"$machos"+[ -s "$machos" ] || check "no Mach-O helpers in $payload"+while IFS= read -r helper; do+ codesign -dvv "$helper" 2>&1 | grep -Fqx "Authority=$sign_identity" \+ || check "${helper#"$payload"/} in the payload is not signed by \"$sign_identity\""+done <"$machos"+echo "==> payload: checked $(wc -l <"$machos" | tr -d ' ') helpers for \"$sign_identity\""+rm -f "$machos"# 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.