mirror of
https://github.com/insidegui/VirtualBuddy.git
synced 2026-12-02 13:59:28 +08:00
* Automatic provisioning of Mac apps launched via Xcode * Improve Xcode integration sheet UI * Security: harden local debugging socket and Xcode tool usage * Soften rule around Xcode MCP use and xcodebuild prohibition * Security: harden App Store Connect API key storage and access * Fix debugged app incorrectly detected as not provisioned due to wildcard matching in provisioning profile * Add previews for provisioning and debugging UI elements * Disambiguate virtual machine vs. host Mac in provisioning and signing team management UIs * Make Xcode debugging setup accessible from the Guest menu * Completely disable debugging socket when developer features disabled, fix socket dying on accept failure * Add versioning to scheme bindings, refer to VirtualBuddy components by a stable symlinked location, store scheme URLs so that app can potentially migrate schemes in the future * Delay showing provisioning sheet so that an app that's already provisioned for the VM doesn't trigger it
48 lines
2.7 KiB
Swift
48 lines
2.7 KiB
Swift
import Foundation
|
|
import MacDebugProtocol
|
|
import Testing
|
|
@testable import MacDebugHost
|
|
|
|
struct DevelopmentProfileTests {
|
|
@Test func scalarWildcardGrantsStringListEntitlements() {
|
|
#expect(DevelopmentProfile.covers("*", ["applinks:example.com", "webcredentials:example.com"]))
|
|
#expect(DevelopmentProfile.covers("*", ["CloudKit"]))
|
|
#expect(!DevelopmentProfile.covers("*", ["CloudKit", true] as [Any]))
|
|
#expect(!DevelopmentProfile.covers("*", ["mode": "CloudKit"]))
|
|
#expect(!DevelopmentProfile.covers("CloudKit", ["CloudKit", "CloudDocuments"]))
|
|
#expect(!DevelopmentProfile.covers(["CloudKit"], ["CloudKit", "CloudDocuments"]))
|
|
}
|
|
|
|
@Test func grantsCoverAllRequestedValues() {
|
|
#expect(DevelopmentProfile.covers(["TEAM.*", "group.example"], ["TEAM.app", "group.example"]))
|
|
#expect(!DevelopmentProfile.covers(["TEAM.*"], ["TEAM.app", "group.example"]))
|
|
#expect(!DevelopmentProfile.covers("TEAM.app", "TEAM.application"))
|
|
#expect(DevelopmentProfile.covers(["mode": ["read", "write"]], ["mode": ["read"]]))
|
|
#expect(!DevelopmentProfile.covers(true, 1))
|
|
}
|
|
|
|
@Test func onlyAnAlteredEmbeddedProfileCanBeResealed() async throws {
|
|
try await DebugTools.withTemporaryDirectory { root in
|
|
let app = root.appendingPathComponent("Sample.app")
|
|
let contents = app.appendingPathComponent("Contents")
|
|
let macOS = contents.appendingPathComponent("MacOS")
|
|
let resources = contents.appendingPathComponent("Resources")
|
|
try DebugTools.directory(macOS)
|
|
try DebugTools.directory(resources)
|
|
try FileManager.default.copyItem(at: URL(fileURLWithPath: "/usr/bin/true"), to: macOS.appendingPathComponent("Sample"))
|
|
let info = ["CFBundleIdentifier": "test.provisioning.seal", "CFBundleExecutable": "Sample", "CFBundlePackageType": "APPL"]
|
|
try PropertyListSerialization.data(fromPropertyList: info, format: .xml, options: 0).write(to: contents.appendingPathComponent("Info.plist"))
|
|
let profile = contents.appendingPathComponent("embedded.provisionprofile")
|
|
let resource = resources.appendingPathComponent("example")
|
|
try Data([1]).write(to: profile)
|
|
try Data([2]).write(to: resource)
|
|
try await DebugTools.run(URL(fileURLWithPath: "/usr/bin/codesign"), ["-f", "-s", "-", app.path])
|
|
#expect(try !DebugCodeSignature(app).needsProfileReseal(at: profile))
|
|
try Data([3]).write(to: profile)
|
|
#expect(try DebugCodeSignature(app).needsProfileReseal(at: profile))
|
|
try Data([4]).write(to: resource)
|
|
#expect(throws: MacDebugError.self) { try DebugCodeSignature(app).needsProfileReseal(at: profile) }
|
|
}
|
|
}
|
|
}
|