mirror of
https://github.com/insidegui/VirtualBuddy.git
synced 2026-12-02 00:29:56 +08:00
* Move ECID getter into VZMacMachineIdentifier * Implement a custom macOS restore backend to work around macOS 27 issues on macOS 26 hosts * Add virtual installation requirement set and enforce during VM restore * Change requirement for macOS 27 Virtual Installation to min host macOS 26 * Add CI script that sets CURRENT_PROJECT_VERSION to the Xcode Cloud build number
40 lines
1.4 KiB
Swift
40 lines
1.4 KiB
Swift
import Foundation
|
|
import OSLog
|
|
|
|
public extension NSXPCConnection {
|
|
static let virtualInstallationClientAllowList: [String] = [
|
|
kVirtualInstallationServiceName,
|
|
kVirtualBuddyBundleID,
|
|
"codes.rambo.experiment.VMRestoreServicePrototype",
|
|
]
|
|
|
|
func setVirtualInstallationCodeSigningRequirement() {
|
|
/// Disable XPC code signing checks for non-managed releases so open-source contributors don't have to modify configuration files.
|
|
#if !BUILDING_NON_MANAGED_RELEASE
|
|
setCodeSigningRequirement(NSXPCConnection.virtualInstallationCodeSigningRequirementString)
|
|
#endif
|
|
}
|
|
}
|
|
|
|
private extension NSXPCConnection {
|
|
static let virtualInstallationCodeSigningRequirementString: String = {
|
|
let bundleIdentifierClause = virtualInstallationClientAllowList.map {
|
|
"""
|
|
info["CFBundleIdentifier"] = "\($0)"
|
|
"""
|
|
}.joined(separator: " or ")
|
|
|
|
let requirement = String(format: """
|
|
anchor apple generic \
|
|
and certificate leaf[subject.OU] = "%@" \
|
|
and info["CFBundleVersion"] >= "%@" \
|
|
and (%@)
|
|
""", kVirtualInstallationTeamIDForCodeSigningRequirements, kVirtualInstallationProjectVersionForCodeSigningRequirements, bundleIdentifierClause)
|
|
|
|
Logger(subsystem: kVirtualInstallationSubsystem, category: "Security")
|
|
.debug("XPC code signing requirement: \(requirement)")
|
|
|
|
return requirement
|
|
}()
|
|
}
|