mirror of
https://github.com/maxgoedjen/secretive.git
synced 2026-09-09 18:09:04 +02:00
Remove broken task entitlement lookup and only enforce on release builds. (#824)
This commit is contained in:
@@ -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 }
|
|
||||||
}
|
|
||||||
@@ -12,7 +12,9 @@ public final class XPCServiceDelegate: NSObject, NSXPCListenerDelegate {
|
|||||||
newConnection.exportedInterface = NSXPCInterface(with: (any _XPCProtocol).self)
|
newConnection.exportedInterface = NSXPCInterface(with: (any _XPCProtocol).self)
|
||||||
let exportedObject = exportedObject
|
let exportedObject = exportedObject
|
||||||
newConnection.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()
|
newConnection.resume()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ public struct XPCTypedSession<ResponseType: Codable & Sendable, ErrorType: Error
|
|||||||
public init(serviceName: String, warmup: Bool = false) async throws {
|
public init(serviceName: String, warmup: Bool = false) async throws {
|
||||||
let connection = NSXPCConnection(serviceName: serviceName)
|
let connection = NSXPCConnection(serviceName: serviceName)
|
||||||
connection.remoteObjectInterface = NSXPCInterface(with: (any _XPCProtocol).self)
|
connection.remoteObjectInterface = NSXPCInterface(with: (any _XPCProtocol).self)
|
||||||
connection.setCodeSigningRequirement("anchor apple generic and certificate leaf[subject.OU] = \"\(ProcessInfo.processInfo.teamID)\"")
|
#if !DEBUG
|
||||||
|
connection.setCodeSigningRequirement("anchor apple generic and certificate leaf[subject.OU] = \"Z72PRUAWF6\"")
|
||||||
|
#endif
|
||||||
connection.resume()
|
connection.resume()
|
||||||
guard let proxy = connection.remoteObjectProxy as? _XPCProtocol else { fatalError() }
|
guard let proxy = connection.remoteObjectProxy as? _XPCProtocol else { fatalError() }
|
||||||
self.connection = connection
|
self.connection = connection
|
||||||
|
|||||||
Reference in New Issue
Block a user