Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,31 @@ jobs:
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO

- name: Verify privileged helper packaging
run: |
set -euo pipefail
APP="build/Build/Products/Release/PureMac.app"
HELPER="${APP}/Contents/Library/LaunchServices/com.puremac.privileged-helper"
PLIST="${APP}/Contents/Library/LaunchDaemons/com.puremac.privileged-cleaning.plist"
test -x "${HELPER}"
test -f "${PLIST}"
plutil -lint "${PLIST}"
test "$(/usr/libexec/PlistBuddy -c 'Print :Label' "${PLIST}")" = "com.puremac.privileged-cleaning"
test "$(/usr/libexec/PlistBuddy -c 'Print :BundleProgram' "${PLIST}")" = "Contents/Library/LaunchServices/com.puremac.privileged-helper"
test "$(/usr/libexec/PlistBuddy -c 'Print :AssociatedBundleIdentifiers:0' "${PLIST}")" = "com.puremac.app"
test "$(/usr/libexec/PlistBuddy -c 'Print :MachServices:com.puremac.privileged-cleaning' "${PLIST}")" = "true"
lipo -archs "${HELPER}" | grep -q "arm64"
lipo -archs "${HELPER}" | grep -q "x86_64"

- name: Test
run: |
xcodebuild -project PureMac.xcodeproj \
-scheme PureMac \
-configuration Debug \
-destination 'platform=macOS' \
-derivedDataPath build-tests \
test \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO
23 changes: 23 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,35 @@ jobs:
run: |
set -euo pipefail
APP="build/export/PureMac.app"
HELPER="${APP}/Contents/Library/LaunchServices/com.puremac.privileged-helper"
DAEMON_PLIST="${APP}/Contents/Library/LaunchDaemons/com.puremac.privileged-cleaning.plist"
APP_REQUIREMENT='anchor apple generic and identifier "com.puremac.app" and certificate leaf[subject.OU] = "H3WXHVTP97"'
HELPER_REQUIREMENT='anchor apple generic and identifier "com.puremac.privileged-helper" and certificate leaf[subject.OU] = "H3WXHVTP97"'
test -x "${HELPER}"
test -f "${DAEMON_PLIST}"
plutil -lint "${DAEMON_PLIST}"
test "$(/usr/libexec/PlistBuddy -c 'Print :Label' "${DAEMON_PLIST}")" = "com.puremac.privileged-cleaning"
test "$(/usr/libexec/PlistBuddy -c 'Print :BundleProgram' "${DAEMON_PLIST}")" = "Contents/Library/LaunchServices/com.puremac.privileged-helper"
test "$(/usr/libexec/PlistBuddy -c 'Print :AssociatedBundleIdentifiers:0' "${DAEMON_PLIST}")" = "com.puremac.app"
test "$(/usr/libexec/PlistBuddy -c 'Print :MachServices:com.puremac.privileged-cleaning' "${DAEMON_PLIST}")" = "true"
codesign --verify --deep --strict --verbose=2 "${APP}"
codesign --verify --strict --verbose=2 "${HELPER}"
codesign --verify --strict --verbose=2 -R="${APP_REQUIREMENT}" "${APP}"
codesign --verify --strict --verbose=2 -R="${HELPER_REQUIREMENT}" "${HELPER}"
codesign -dvv "${APP}" 2>&1 | tee /tmp/cs-info.txt
codesign -dvv "${HELPER}" 2>&1 | tee /tmp/helper-cs-info.txt
codesign -d --entitlements :- "${APP}" > /tmp/app-entitlements.plist
codesign -d --entitlements :- "${HELPER}" > /tmp/helper-entitlements.plist
! plutil -p /tmp/app-entitlements.plist | grep -E 'get-task-allow|disable-library-validation|allow-dyld-environment-variables'
! plutil -p /tmp/helper-entitlements.plist | grep -E 'get-task-allow|disable-library-validation|allow-dyld-environment-variables'
grep -q "flags=0x10000(runtime)" /tmp/cs-info.txt || { echo "::error::Hardened runtime missing"; exit 1; }
grep -q "Identifier=com.puremac.privileged-helper" /tmp/helper-cs-info.txt || { echo "::error::Unexpected privileged helper identifier"; exit 1; }
grep -q "TeamIdentifier=${TEAM_ID}" /tmp/helper-cs-info.txt || { echo "::error::Unexpected privileged helper team"; exit 1; }
grep -q "flags=0x10000(runtime)" /tmp/helper-cs-info.txt || { echo "::error::Privileged helper hardened runtime missing"; exit 1; }
spctl --assess --type execute --verbose=4 "${APP}" || true
# Universal arch check
lipo -archs "${APP}/Contents/MacOS/PureMac" | grep -q "x86_64" && lipo -archs "${APP}/Contents/MacOS/PureMac" | grep -q "arm64"
lipo -archs "${HELPER}" | grep -q "x86_64" && lipo -archs "${HELPER}" | grep -q "arm64"

- name: Build DMG
env:
Expand Down
Loading
Loading