From 6d56d841d3f365a25f92b087561fdb08e02169de Mon Sep 17 00:00:00 2001 From: Max Goedjen Date: Mon, 8 Sep 2025 00:13:56 -0700 Subject: [PATCH] . --- .../Sources/XPCWrappers/XPCWrappers.swift | 24 ++++--------------- Sources/Secretive.xcodeproj/project.pbxproj | 10 ++++++++ .../LaunchConstraints.coderequirement | 8 +++++++ 3 files changed, 22 insertions(+), 20 deletions(-) create mode 100644 Sources/Secretive/LaunchConstraints.coderequirement diff --git a/Sources/Packages/Sources/XPCWrappers/XPCWrappers.swift b/Sources/Packages/Sources/XPCWrappers/XPCWrappers.swift index 53cc680..b237746 100644 --- a/Sources/Packages/Sources/XPCWrappers/XPCWrappers.swift +++ b/Sources/Packages/Sources/XPCWrappers/XPCWrappers.swift @@ -1,32 +1,16 @@ import Foundation import XPC -@_silgen_name("xpc_session_set_peer_code_signing_requirement") -func xpc_session_set_peer_code_signing_requirement(_ session: Any, _ requirement: UnsafePointer) -> Int32 - public struct XPCTypedSession: Sendable { private let session: XPCSession public init(serviceName: String, warmup: Bool = false) throws { -// if #available(macOS 26.0, *) { -// session = try XPCSession(xpcService: serviceName, requirement: .isFromSameTeam()) -// } else { - session = try XPCSession(xpcService: serviceName, options: .inactive) - let test = Mirror(reflecting: session) - for case let (label?, value) in test.children { - if label == "_session" { - print("HIT") - "anchor apple".utf8CString.withUnsafeBufferPointer { x in - _ = xpc_session_set_peer_code_signing_requirement( - value, - x.baseAddress! - ) - } - } + if #available(macOS 26.0, *) { + session = try XPCSession(xpcService: serviceName, requirement: .isFromSameTeam()) + } else { + session = try XPCSession(xpcService: serviceName) } -// try session.activate() - // } if warmup { Task { [self] in _ = try? await send() diff --git a/Sources/Secretive.xcodeproj/project.pbxproj b/Sources/Secretive.xcodeproj/project.pbxproj index c9fce11..502af80 100644 --- a/Sources/Secretive.xcodeproj/project.pbxproj +++ b/Sources/Secretive.xcodeproj/project.pbxproj @@ -51,6 +51,7 @@ 5066A6C82516FE6E004B5A36 /* CopyableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5066A6C72516FE6E004B5A36 /* CopyableView.swift */; }; 506772C72424784600034DED /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 506772C62424784600034DED /* Credits.rtf */; }; 506772C92425BB8500034DED /* NoStoresView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 506772C82425BB8500034DED /* NoStoresView.swift */; }; + 50692C5B2E6EB8D40043C7BB /* LaunchConstraints.coderequirement in Resources */ = {isa = PBXBuildFile; fileRef = 50692C5A2E6EB8D40043C7BB /* LaunchConstraints.coderequirement */; }; 5079BA0F250F29BF00EA86F4 /* StoreListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5079BA0E250F29BF00EA86F4 /* StoreListView.swift */; }; 508A58AA241E06B40069DC07 /* PreviewUpdater.swift in Sources */ = {isa = PBXBuildFile; fileRef = 508A58A9241E06B40069DC07 /* PreviewUpdater.swift */; }; 508A58B3241ED2180069DC07 /* AgentStatusChecker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 508A58B2241ED2180069DC07 /* AgentStatusChecker.swift */; }; @@ -201,6 +202,7 @@ 5066A6C72516FE6E004B5A36 /* CopyableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CopyableView.swift; sourceTree = ""; }; 506772C62424784600034DED /* Credits.rtf */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; path = Credits.rtf; sourceTree = ""; }; 506772C82425BB8500034DED /* NoStoresView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoStoresView.swift; sourceTree = ""; }; + 50692C5A2E6EB8D40043C7BB /* LaunchConstraints.coderequirement */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = LaunchConstraints.coderequirement; sourceTree = ""; }; 5079BA0E250F29BF00EA86F4 /* StoreListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoreListView.swift; sourceTree = ""; }; 508A58A9241E06B40069DC07 /* PreviewUpdater.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreviewUpdater.swift; sourceTree = ""; }; 508A58AB241E121B0069DC07 /* Config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = ""; }; @@ -381,6 +383,7 @@ 50617D8E23FCE48E0099B055 /* Info.plist */, 508BF28D25B4F005009EFB7E /* InternetAccessPolicy.plist */, 50617D8F23FCE48E0099B055 /* Secretive.entitlements */, + 50692C5A2E6EB8D40043C7BB /* LaunchConstraints.coderequirement */, 506772C62424784600034DED /* Credits.rtf */, 5008C23D2E525D8200507AC2 /* Localizable.xcstrings */, 50617D8823FCE48E0099B055 /* Preview Content */, @@ -639,6 +642,7 @@ 5008C23E2E525D8900507AC2 /* Localizable.xcstrings in Resources */, 50617D8723FCE48E0099B055 /* Assets.xcassets in Resources */, 506772C72424784600034DED /* Credits.rtf in Resources */, + 50692C5B2E6EB8D40043C7BB /* LaunchConstraints.coderequirement in Resources */, 508BF28E25B4F005009EFB7E /* InternetAccessPolicy.plist in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1151,6 +1155,7 @@ ENABLE_RESOURCE_ACCESS_PRINTING = NO; ENABLE_RESOURCE_ACCESS_USB = NO; INFOPLIST_FILE = Secretive/Info.plist; + LAUNCH_CONSTRAINT_RESPONSIBLE = "$(SRCROOT)/Secretive/LaunchConstraints.coderequirement"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", @@ -1191,6 +1196,7 @@ ENABLE_RESOURCE_ACCESS_PRINTING = NO; ENABLE_RESOURCE_ACCESS_USB = NO; INFOPLIST_FILE = Secretive/Info.plist; + LAUNCH_CONSTRAINT_RESPONSIBLE = "$(SRCROOT)/Secretive/LaunchConstraints.coderequirement"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", @@ -1303,6 +1309,7 @@ ENABLE_RESOURCE_ACCESS_PRINTING = NO; ENABLE_RESOURCE_ACCESS_USB = NO; INFOPLIST_FILE = Secretive/Info.plist; + LAUNCH_CONSTRAINT_RESPONSIBLE = "$(SRCROOT)/Secretive/LaunchConstraints.coderequirement"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", @@ -1336,6 +1343,7 @@ ENABLE_RESOURCE_ACCESS_PRINTING = NO; ENABLE_RESOURCE_ACCESS_USB = NO; INFOPLIST_FILE = SecretAgent/Info.plist; + LAUNCH_CONSTRAINT_RESPONSIBLE = "$(SRCROOT)/Secretive/LaunchConstraints.coderequirement"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", @@ -1371,6 +1379,7 @@ ENABLE_RESOURCE_ACCESS_PRINTING = NO; ENABLE_RESOURCE_ACCESS_USB = NO; INFOPLIST_FILE = SecretAgent/Info.plist; + LAUNCH_CONSTRAINT_RESPONSIBLE = "$(SRCROOT)/Secretive/LaunchConstraints.coderequirement"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", @@ -1407,6 +1416,7 @@ ENABLE_RESOURCE_ACCESS_PRINTING = NO; ENABLE_RESOURCE_ACCESS_USB = NO; INFOPLIST_FILE = SecretAgent/Info.plist; + LAUNCH_CONSTRAINT_RESPONSIBLE = "$(SRCROOT)/Secretive/LaunchConstraints.coderequirement"; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/../Frameworks", diff --git a/Sources/Secretive/LaunchConstraints.coderequirement b/Sources/Secretive/LaunchConstraints.coderequirement new file mode 100644 index 0000000..c0e0dd6 --- /dev/null +++ b/Sources/Secretive/LaunchConstraints.coderequirement @@ -0,0 +1,8 @@ + + + + + team-identifier + Z72PRUAWF6 + +