Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Release builds carry pointer authentication, the helper included

Țugui Dragoșfca34a4361b8
diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml
index e1b093f9..fddf3af6 100644
--- a/.github/workflows/checks.yml
+++ b/.github/workflows/checks.yml
@@ -49,17 +49,21 @@ jobs:
xcodebuild -project Peel.xcodeproj -scheme Peel -configuration Debug \
-derivedDataPath build/DerivedData CODE_SIGNING_ALLOWED=NO build
- # Release builds every binary for Apple silicon and Intel alike, with the optimizer a Debug build leaves off.
+ # Release builds every binary for Apple silicon, with pointer authentication (arm64e) and without, and for Intel,
+ # with the optimizer a Debug build leaves off. The setting is given here too, since only the command line reaches
+ # the Swift packages.
- name: Build the app for release
run: |
xcodebuild -project Peel.xcodeproj -scheme Peel -configuration Release \
- -derivedDataPath build/Release CODE_SIGNING_ALLOWED=NO build
+ -derivedDataPath build/Release CODE_SIGNING_ALLOWED=NO ENABLE_POINTER_AUTHENTICATION=YES build
for binary in MacOS/Peel MacOS/PeelHelper Helpers/peel PlugIns/PeelFinder.appex/Contents/MacOS/PeelFinder; do
archs=$(lipo -archs "build/Release/Build/Products/Release/Peel.app/Contents/$binary")
- case "$archs" in
- *x86_64*arm64*|*arm64*x86_64*) ;;
- *) echo "::error::$binary is built for $archs only."; exit 1 ;;
- esac
+ for arch in arm64e arm64 x86_64; do
+ case " $archs " in
+ *" $arch "*) ;;
+ *) echo "::error::$binary is built for $archs, without $arch."; exit 1 ;;
+ esac
+ done
done
# The accessibility audit drives the pointer, so it runs by hand before a release. Here it is only built.
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index 99fe430b..44f1aa84 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -230,5 +230,11 @@ checks the result with Gatekeeper, and prints the path and SHA-256 of `Peel-<ver
the album's paper with an arc from Peel to Applications, which `Scripts/make_dmg.sh` lays out with dmgbuild, run by
uv, so nothing drives Finder; the background carries no words, since Finder writes the names in each Mac's language.
It starts only from a committed tree whose package tests pass with warnings as errors, and it refuses a build in
-which any of the four programs can be debugged, in which a language is missing, or which `syspolicy_check
-distribution` says macOS would not open.
+which any of the four programs can be debugged or lacks the arm64e slice, in which a language is missing, or which
+`syspolicy_check distribution` says macOS would not open.
+
+A Release build of every program has pointer authentication (`ENABLE_POINTER_AUTHENTICATION`, an arm64e slice
+beside arm64 and x86_64), and the helper the rest of Enhanced Security too. Xcode gives the Swift packages only the
+settings of the command line, so a Release build passes that setting there as well: `release.sh` and the Checks
+workflow do, and Xcode's own Archive, which cannot, fails. A Debug build leaves it off, since it builds only the
+Mac's own architecture, which the programs would read as arm64e and the packages as arm64.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 70580ea8..d5b28b78 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -33,6 +33,9 @@ leaves upgrades to Terminal.
team named in `Support/com.tuguidragos.Peel.Helper.plist` (`SpawnConstraint`), so to install the helper you
build, put your team there as well, again outside your commits. The package's tests need no signing.
- Nothing else. The only dependency is Apple's swift-argument-parser, which Xcode fetches.
+- A Release build needs `ENABLE_POINTER_AUTHENTICATION=YES` on the `xcodebuild` command line, since only the
+ command line reaches the Swift packages and every program imports them for arm64e too. `Scripts/release.sh`
+ passes it; a Debug build needs nothing.
```bash
xcodebuild -project Peel.xcodeproj -scheme Peel -configuration Debug -derivedDataPath build/DerivedData DEVELOPMENT_TEAM=YOUR_TEAM_ID build
diff --git a/Peel.xcodeproj/project.pbxproj b/Peel.xcodeproj/project.pbxproj
index e8feedb3..a101d949 100644
--- a/Peel.xcodeproj/project.pbxproj
+++ b/Peel.xcodeproj/project.pbxproj
@@ -695,7 +695,6 @@
CURRENT_PROJECT_VERSION = 261001;
DEVELOPMENT_TEAM = 6R6J264YA2;
ENABLE_ENHANCED_SECURITY = YES;
- ENABLE_POINTER_AUTHENTICATION = NO;
ENABLE_HARDENED_RUNTIME = YES;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0.1;
@@ -811,6 +810,7 @@
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_POINTER_AUTHENTICATION = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
diff --git a/Scripts/release.sh b/Scripts/release.sh
index e66e4130..47c2f497 100755
--- a/Scripts/release.sh
+++ b/Scripts/release.sh
@@ -45,13 +45,16 @@ fi
grep -E "Test run with" "$build/test.log" || true
echo "== Archiving"
-# The output goes to a log, not through a pipe, so the `if` checks xcodebuild's own exit status.
+# The output goes to a log, not through a pipe, so the `if` checks xcodebuild's own exit status. Pointer
+# authentication is set here as well as in the project, since Xcode gives the Swift packages only the settings
+# of the command line, and every binary imports them.
if ! xcodebuild archive \
-project Peel.xcodeproj \
-scheme Peel \
-configuration Release \
-archivePath "$archive" \
-derivedDataPath "$build/DerivedData" \
+ ENABLE_POINTER_AUTHENTICATION=YES \
> "$build/archive.log" 2>&1
then
grep -E "error:" "$build/archive.log" || tail -20 "$build/archive.log"
@@ -111,6 +114,21 @@ do
fi
done
+echo "== Architectures"
+# arm64e is the slice with pointer authentication, which Apple silicon runs; arm64 and x86_64 are for the rest.
+for executable in \
+ "$app/Contents/MacOS/Peel" \
+ "$app/Contents/MacOS/PeelHelper" \
+ "$app/Contents/PlugIns/PeelFinder.appex/Contents/MacOS/PeelFinder" \
+ "$app/Contents/Helpers/peel"
+do
+ archs="$(lipo -archs "$executable")" || { echo "REFUSED: lipo cannot read $executable"; exit 1; }
+ for arch in arm64e arm64 x86_64; do
+ [[ " $archs " == *" $arch "* ]] || { echo "REFUSED: $executable is built for $archs, without $arch"; exit 1; }
+ done
+done
+echo "Every binary: arm64e, arm64, x86_64"
+
echo "== Languages"
# Every language in the project's `knownRegions` (besides `en` and `Base`) must ship in the app and in the Finder
# extension. Without this check, a language missing from the build would quietly fall back to English.