Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
launchd starts the helper only as the team's own build
Țugui Dragoș958ed6600229
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.mdindex 28a55a7d..99fe430b 100644--- a/ARCHITECTURE.md+++ b/ARCHITECTURE.md@@ -138,7 +138,8 @@ macOS asks the user to approve it once. It talks to the app over XPC.- It answers administrators only, asked when a connection opens and again with each message, and it acceptsonly a copy of Peel signed by the same team, checked when a connection opens and for every message after it.- A released helper refuses a build that can be debugged.+ A released helper refuses a build that can be debugged, and launchd starts the helper only as the team's own+ build of it (`SpawnConstraint` in its launchd property list).- It does three things: moves items to the Trash, puts them back, and starts, stops, enables, or disables anothervendor's launch daemon, never one macOS ships and never itself.- It serves a fixed list of folders (`PrivilegedPathPolicy`), refuses everything else, and refuses whateverdiff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 79e662b7..70580ea8 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -29,7 +29,9 @@ leaves upgrades to Terminal.- A team to sign with, even a free one. The project names its maintainer's team, so build with yours: add`DEVELOPMENT_TEAM=YOUR_TEAM_ID` to the `xcodebuild` command, or choose your team for the targets under Signing &Capabilities in Xcode and leave that change out of your commits. The helper accepts only an app signed by the- same team as itself, so the app and the helper you build work together. The package's tests need no signing.+ same team as itself, so the app and the helper you build work together. launchd starts the helper only as the+ 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.```bashdiff --git a/Packages/PeelCore/Tests/PeelCoreTests/HelperPolicyTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/HelperPolicyTests.swiftindex 6c7b92ee..5fb9ab24 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/HelperPolicyTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/HelperPolicyTests.swift@@ -35,6 +35,20 @@ struct HelperPolicyTests {}}+ /// The team in `SpawnConstraint` has to be the one every target of the project signs with.+ @Test func launchdStartsOnlyTheTeamsOwnHelper() throws {+ let repository = StringCatalogTests.repository+ let plist = try Data(contentsOf: repository.appending(path: "Support/\(HelperIdentity.launchdPlistName)"))+ let job = try #require(try PropertyListSerialization.propertyList(from: plist, format: nil) as? [String: Any])+ let project = try String(contentsOf: repository.appending(path: "Peel.xcodeproj/project.pbxproj"), encoding: .utf8)+ let teams = Set(project.matches(of: /DEVELOPMENT_TEAM = (\w+);/).map { String($0.output.1) })++ let constraint = try #require(job["SpawnConstraint"] as? [String: String], "launchd would start any code as the helper")+ #expect(teams.count == 1)+ let team = try #require(teams.first)+ #expect(constraint == ["team-identifier": team, "signing-identifier": HelperIdentity.helperIdentifier])+ }+/// Which one is compiled in follows the build, so a shipped helper can never be handed the looser text.@Test func theTextInUseFollowsTheBuild() {let inUse = CodeSigning.requirement(identifier: "com.tuguidragos.Peel", teamIdentifier: "6R6J264YA2")diff --git a/SAFETY.md b/SAFETY.mdindex 5672fa38..8292e487 100644--- a/SAFETY.md+++ b/SAFETY.md@@ -274,7 +274,8 @@ is deliberately small: no shell, no arbitrary paths, and it fails closed.- It answers administrators only, and only a copy of Peel signed by the same team. Both are checked when theapp connects and again with each request, so an account that stops being an administrator is refused from- then on, and a message from any other program closes the connection.+ then on, and a message from any other program closes the connection. macOS starts the helper only as the+ developer's own build of it, so other code put in its place never runs as root.- It refuses the list above on its own, without asking the app, and asks it both ways: a folder that holdssomething on the list is refused like the thing itself.- A path with a control character in it is refused. The rules read the whole name and the system stops atdiff --git a/Support/com.tuguidragos.Peel.Helper.plist b/Support/com.tuguidragos.Peel.Helper.plistindex d378fa39..a04cd14f 100644--- a/Support/com.tuguidragos.Peel.Helper.plist+++ b/Support/com.tuguidragos.Peel.Helper.plist@@ -11,6 +11,13 @@<key>com.tuguidragos.Peel.Helper</key><true/></dict>+ <key>SpawnConstraint</key>+ <dict>+ <key>team-identifier</key>+ <string>6R6J264YA2</string>+ <key>signing-identifier</key>+ <string>com.tuguidragos.Peel.Helper</string>+ </dict><key>AssociatedBundleIdentifiers</key><array><string>com.tuguidragos.Peel</string>