From e9a0ff31d34feee5e14248c52927e57a9feb980e Mon Sep 17 00:00:00 2001 From: Max Goedjen Date: Sun, 6 Sep 2026 21:13:34 -0700 Subject: [PATCH] Remove broken task entitlement lookup and only enforce on release builds. (#824) --- .../Packages/Sources/XPCWrappers/TeamID.swift | 26 ------------------- .../XPCWrappers/XPCServiceDelegate.swift | 4 ++- .../Sources/XPCWrappers/XPCTypedSession.swift | 4 ++- 3 files changed, 6 insertions(+), 28 deletions(-) delete mode 100644 Sources/Packages/Sources/XPCWrappers/TeamID.swift diff --git a/Sources/Packages/Sources/XPCWrappers/TeamID.swift b/Sources/Packages/Sources/XPCWrappers/TeamID.swift deleted file mode 100644 index 56848a1..0000000 --- a/Sources/Packages/Sources/XPCWrappers/TeamID.swift +++ /dev/null @@ -1,26 +0,0 @@ -import Foundation - -extension ProcessInfo { - private static let fallbackTeamID = "Z72PRUAWF6" - - private static let teamID: String = { - #if DEBUG - guard let task = SecTaskCreateFromSelf(nil) else { - assertionFailure("SecTaskCreateFromSelf failed") - return fallbackTeamID - } - - guard let value = SecTaskCopyValueForEntitlement(task, "com.apple.developer.team-identifier" as CFString, nil) as? String else { - assertionFailure("SecTaskCopyValueForEntitlement(com.apple.developer.team-identifier) failed") - return fallbackTeamID - } - - return value - #else - /// Always use hardcoded team ID for release builds, just in case. - return fallbackTeamID - #endif - }() - - public var teamID: String { Self.teamID } -} diff --git a/Sources/Packages/Sources/XPCWrappers/XPCServiceDelegate.swift b/Sources/Packages/Sources/XPCWrappers/XPCServiceDelegate.swift index b2050f4..3719135 100644 --- a/Sources/Packages/Sources/XPCWrappers/XPCServiceDelegate.swift +++ b/Sources/Packages/Sources/XPCWrappers/XPCServiceDelegate.swift @@ -12,7 +12,9 @@ public final class XPCServiceDelegate: NSObject, NSXPCListenerDelegate { newConnection.exportedInterface = NSXPCInterface(with: (any _XPCProtocol).self) let exportedObject = exportedObject newConnection.exportedObject = exportedObject - newConnection.setCodeSigningRequirement("anchor apple generic and certificate leaf[subject.OU] = \"\(ProcessInfo.processInfo.teamID)\"") +#if !DEBUG + newConnection.setCodeSigningRequirement("anchor apple generic and certificate leaf[subject.OU] = \"Z72PRUAWF6\"") +#endif newConnection.resume() return true } diff --git a/Sources/Packages/Sources/XPCWrappers/XPCTypedSession.swift b/Sources/Packages/Sources/XPCWrappers/XPCTypedSession.swift index 509c48e..101a21b 100644 --- a/Sources/Packages/Sources/XPCWrappers/XPCTypedSession.swift +++ b/Sources/Packages/Sources/XPCWrappers/XPCTypedSession.swift @@ -8,7 +8,9 @@ public struct XPCTypedSession