diff --git a/Package.swift b/Package.swift index dd0b944..00cd6ce 100644 --- a/Package.swift +++ b/Package.swift @@ -61,7 +61,9 @@ let package = Package( resources: [.process("data/download-list-20220723.json"), .process("data/download-list-20231115.json"), .process("data/download-error.json"), - .process("data/download-unknown-error.json") + .process("data/download-unknown-error.json"), + .copy("data/apple-aea-certificate-chain.pem"), + .copy("data/self-signed-certificate-chain.pem") ], swiftSettings: swiftSettings ) diff --git a/README.md b/README.md index 4fa6e59..3e8a1f0 100644 --- a/README.md +++ b/README.md @@ -407,7 +407,7 @@ xcodeinstall install --name "Xcode_26.5.xip" --xcode-version "26.5-custom" ``` The installation process: -1. Extracts the `.xip` file (this takes several minutes) +1. Extracts the `.xip` or `.aea` file (this takes several minutes). An `.aea` archive is installed only when its signature traces back to Apple's root certificate. 2. Moves to `/Applications/Xcode-{version}.app` (version auto-detected from filename) 3. Installs additional system packages 4. Creates a symlink `/Applications/Xcode.app` pointing to the newly installed version diff --git a/Sources/xcodeinstall/API/AppleEncryptedArchive.swift b/Sources/xcodeinstall/API/AppleEncryptedArchive.swift new file mode 100644 index 0000000..844f9a9 --- /dev/null +++ b/Sources/xcodeinstall/API/AppleEncryptedArchive.swift @@ -0,0 +1,260 @@ +// +// AppleEncryptedArchive.swift +// xcodeinstall +// +// Apple ships some Xcode releases as an Apple Encrypted Archive (.aea). +// The archive is not encrypted: it uses the signature-only profile +// `hkdf_sha256_hmac__none__ecdsa_p256`, so no key or password is needed. +// Its content is an LZMA-compressed Apple Archive (.aar) holding Xcode.app. +// +// The public key that checks the signature travels inside the archive, in the +// auth data, as a PEM certificate chain. Trusting that key blindly would only +// prove the file is intact, not that Apple made it. So the chain is evaluated +// with the Security framework and must end at Apple Root CA - G3 before its +// leaf key is used to verify the archive. +// + +import AppleArchive +import CryptoKit +import Foundation +import Security +import System + +enum AppleEncryptedArchiveError: Error, Equatable { + case cannotOpenArchive + case notAnAppleEncryptedArchive + case unsupportedProfile(String) + case malformedAuthData + case missingCertificateChain + case invalidCertificateChain + case untrustedCertificateChain(String) + case notSignedByApple + case unsupportedSigningKey + case extractionFailed(String) +} + +/// Key-value entries stored in the auth data block of an Apple Encrypted Archive. +/// +/// Each entry is laid out as a little-endian `UInt32` holding the entry size +/// (header included), a NUL-terminated UTF-8 key, then the value bytes. +nonisolated struct AEAAuthData: Equatable { + + let entries: [String: Data] + + init(entries: [String: Data]) { + self.entries = entries + } + + init(_ data: Data) throws { + let bytes = [UInt8](data) + var entries: [String: Data] = [:] + var offset = 0 + + while offset < bytes.count { + guard bytes.count - offset >= 4 else { + throw AppleEncryptedArchiveError.malformedAuthData + } + let size = + Int(bytes[offset]) + | Int(bytes[offset + 1]) << 8 + | Int(bytes[offset + 2]) << 16 + | Int(bytes[offset + 3]) << 24 + let end = offset + size + guard size > 4, end <= bytes.count else { + throw AppleEncryptedArchiveError.malformedAuthData + } + guard let nul = bytes[(offset + 4).. P256.Signing.PublicKey { + var trust: SecTrust? + let status = SecTrustCreateWithCertificates( + certificates as CFArray, + SecPolicyCreateBasicX509(), + &trust + ) + guard status == errSecSuccess, let trust else { + throw AppleEncryptedArchiveError.invalidCertificateChain + } + SecTrustSetVerifyDate(trust, date as CFDate) + SecTrustSetNetworkFetchAllowed(trust, false) + + var error: CFError? + guard SecTrustEvaluateWithError(trust, &error) else { + let reason = error.map { CFErrorCopyDescription($0) as String } ?? "unknown reason" + throw AppleEncryptedArchiveError.untrustedCertificateChain(reason) + } + + // A chain any public CA vouches for is not enough: Apple must have issued it. + guard let chain = SecTrustCopyCertificateChain(trust) as? [SecCertificate], + let root = chain.last, + Self.sha256Hex(of: root) == Self.appleRootCAG3SHA256 + else { + throw AppleEncryptedArchiveError.notSignedByApple + } + + guard let leafKey = SecCertificateCopyKey(certificates[0]), + let x963 = SecKeyCopyExternalRepresentation(leafKey, nil) as Data?, + let key = try? P256.Signing.PublicKey(x963Representation: x963) + else { + throw AppleEncryptedArchiveError.unsupportedSigningKey + } + return key + } + + private static func sha256Hex(of certificate: SecCertificate) -> String { + let der = SecCertificateCopyData(certificate) as Data + return SHA256.hash(data: der).map { String(format: "%02x", $0) }.joined() + } +} + +/// Verifies and expands an Apple Encrypted Archive. +nonisolated struct AppleEncryptedArchive { + + let file: URL + + /// Reads the certificate chain from the archive and returns the verified + /// Apple signing key. + func appleSigningKey(at date: Date = Date()) throws -> P256.Signing.PublicKey { + let (stream, context) = try open() + defer { try? stream.close() } + + guard let rawAuthData = context.authData else { + throw AppleEncryptedArchiveError.missingCertificateChain + } + guard let pem = try AEAAuthData(rawAuthData).entries[AppleSigningCertificateChain.authDataKey] else { + throw AppleEncryptedArchiveError.missingCertificateChain + } + return try AppleSigningCertificateChain(pem: pem).verifiedSigningKey(at: date) + } + + /// Checks the archive signature with `signingKey` and extracts its content + /// into `directory`. A bad signature makes the extraction throw. + /// + /// The work is CPU and disk bound and takes about a minute for Xcode, so it + /// runs on the concurrent executor instead of the caller's actor. + @concurrent + func extract(to directory: URL, signingKey: P256.Signing.PublicKey) async throws { + let (fileStream, context) = try open() + defer { try? fileStream.close() } + + do { + try context.setSigningPublicKey(signingKey) + } catch { + throw AppleEncryptedArchiveError.extractionFailed("can not use the signing key: \(error)") + } + + guard + let decryptionStream = ArchiveByteStream.decryptionStream( + readingFrom: fileStream, + encryptionContext: context + ) + else { + throw AppleEncryptedArchiveError.extractionFailed("can not verify the archive signature") + } + defer { try? decryptionStream.close() } + + guard let decodeStream = ArchiveStream.decodeStream(readingFrom: decryptionStream) else { + throw AppleEncryptedArchiveError.extractionFailed("can not decode the archive") + } + defer { try? decodeStream.close() } + + // The archive records attributes, such as the owner, that only root may set. + // Like `aa extract`, skip those instead of failing the whole extraction. + guard + let extractStream = ArchiveStream.extractStream( + extractingTo: FilePath(directory.path), + flags: [.ignoreOperationNotPermitted] + ) + else { + throw AppleEncryptedArchiveError.extractionFailed("can not write to \(directory.path)") + } + + do { + _ = try ArchiveStream.process(readingFrom: decodeStream, writingTo: extractStream) + // closing the extract stream flushes the last entries to disk + try extractStream.close() + } catch { + try? extractStream.close() + throw AppleEncryptedArchiveError.extractionFailed("\(error)") + } + } + + private func open() throws -> (ArchiveByteStream, ArchiveEncryptionContext) { + guard + let stream = ArchiveByteStream.fileStream( + path: FilePath(file.path), + mode: .readOnly, + options: [], + permissions: [] + ) + else { + throw AppleEncryptedArchiveError.cannotOpenArchive + } + guard let context = ArchiveEncryptionContext(from: stream) else { + try? stream.close() + throw AppleEncryptedArchiveError.notAnAppleEncryptedArchive + } + guard context.profile == .hkdf_sha256_hmac__none__ecdsa_p256 else { + try? stream.close() + throw AppleEncryptedArchiveError.unsupportedProfile(context.profile.description) + } + return (stream, context) + } +} diff --git a/Sources/xcodeinstall/API/Install.swift b/Sources/xcodeinstall/API/Install.swift index 01acd83..45dd568 100644 --- a/Sources/xcodeinstall/API/Install.swift +++ b/Sources/xcodeinstall/API/Install.swift @@ -19,6 +19,8 @@ enum InstallerError: Error, Equatable { case fileDoesNotExistOrIncorrect case xCodeUnxipDirectoryDoesntExist case xCodeXIPInstallationError + case xCodeAEASignatureError + case xCodeAEAInstallationError case xCodeMoveInstallationError case xCodePKGInstallationError case CLToolsInstallationError @@ -37,7 +39,7 @@ enum SupportedInstallation { static func supported(_ file: String) -> SupportedInstallation { if file.hasPrefix("Command Line Tools for Xcode") && file.hasSuffix(".dmg") { return .xCodeCommandLineTools - } else if file.hasPrefix("Xcode") && file.hasSuffix(".xip") { + } else if file.hasPrefix("Xcode") && (file.hasSuffix(".xip") || file.hasSuffix(".aea")) { return .xCode } else { return .unsupported @@ -113,8 +115,8 @@ class ShellInstaller { /// Install Xcode or Xcode Command Line Tools /// At this stage, we do support only these two installation. /// - /// **Xcode** is provided as a XIP file. The installation procedure is as follow: - /// - It is uncompressed + /// **Xcode** is provided as a XIP file or as an Apple Encrypted Archive (AEA). The installation procedure is as follow: + /// - It is uncompressed (for an AEA, after checking Apple signed it) /// - It is moved to /Applications /// - Four packages are installed /// - `/Applications/Xcode.app/Contents/Resources/Packages/XcodeSystemResources.pkg` diff --git a/Sources/xcodeinstall/API/InstallXcode.swift b/Sources/xcodeinstall/API/InstallXcode.swift index 54bd0fc..0ee4e56 100644 --- a/Sources/xcodeinstall/API/InstallXcode.swift +++ b/Sources/xcodeinstall/API/InstallXcode.swift @@ -5,6 +5,7 @@ // Created by Stormacq, Sebastien on 29/08/2022. // +import CryptoKit import Subprocess import libunxip @@ -20,7 +21,7 @@ extension ShellInstaller { func installXcode(at src: URL, version: String? = nil) async throws { - // unXIP, mv, 4 PKG to install, activate (symlink + xcode-select) + // unXIP or unAEA, mv, 4 PKG to install, activate (symlink + xcode-select) let hasVersion = version != nil let totalSteps = 2 + PKGTOINSTALL.count + (hasVersion ? 1 : 0) var currentStep: Int = 0 @@ -30,17 +31,26 @@ extension ShellInstaller { // first uncompress file log.debug("Decompressing files") currentStep += 1 - self.progressBar.update( - step: currentStep, - total: totalSteps, - text: "Expanding Xcode xip (this might take a while)" - ) + if src.pathExtension == "aea" { + self.progressBar.update( + step: currentStep, + total: totalSteps, + text: "Expanding Xcode aea (this might take a while)" + ) + try await self.uncompressAEA(atURL: src) + } else { + self.progressBar.update( + step: currentStep, + total: totalSteps, + text: "Expanding Xcode xip (this might take a while)" + ) - do { - try await self.uncompressXIP(atURL: src) - } catch { - log.error("Failed to extract XIP file: \(error)") - throw InstallerError.xCodeXIPInstallationError + do { + try await self.uncompressXIP(atURL: src) + } catch { + log.error("Failed to extract XIP file: \(error)") + throw InstallerError.xCodeXIPInstallationError + } } // second move file to /Applications (versioned if version provided) @@ -127,6 +137,33 @@ extension ShellInstaller { } } + // verify and expand an Apple Encrypted Archive (.aea) next to the archive. + // The archive must be signed by a certificate chain ending at Apple's root. + func uncompressAEA(atURL file: URL) async throws { + + guard self.fileHandler.fileExists(file: file, fileSize: 0) else { + log.error("File to expand does not exist : \(file.path)") + throw InstallerError.fileDoesNotExistOrIncorrect + } + + let archive = AppleEncryptedArchive(file: file) + + let signingKey: P256.Signing.PublicKey + do { + signingKey = try archive.appleSigningKey() + } catch { + log.error("The archive is not signed by Apple: \(error)") + throw InstallerError.xCodeAEASignatureError + } + + do { + try await archive.extract(to: file.deletingLastPathComponent(), signingKey: signingKey) + } catch { + log.error("Failed to extract AEA file: \(error)") + throw InstallerError.xCodeAEAInstallationError + } + } + func moveApp(at src: URL, version: String? = nil) async throws -> String { let fileName: String diff --git a/Sources/xcodeinstall/CLI/ErrorPresenter.swift b/Sources/xcodeinstall/CLI/ErrorPresenter.swift index 0630c2f..9e6104d 100644 --- a/Sources/xcodeinstall/CLI/ErrorPresenter.swift +++ b/Sources/xcodeinstall/CLI/ErrorPresenter.swift @@ -153,7 +153,9 @@ enum ErrorPresenter { private static func presentation(for error: InstallerError) -> ErrorPresentation { switch error { case .unsupportedInstallation: - return .failure("Unsupported installation type. (We support Xcode XIP files and Command Line Tools PKG)") + return .failure( + "Unsupported installation type. (We support Xcode XIP and AEA files and Command Line Tools PKG)" + ) case .fileDoesNotExistOrIncorrect: return .failure( "The file to install does not exist, or its size does not match the one announced by Apple.", @@ -163,6 +165,15 @@ enum ErrorPresenter { return .failure("Can not find the directory where Xcode was expanded") case .xCodeXIPInstallationError: return .failure("Can not expand XIP file. Is there enough space on / ? (16GiB required)") + case .xCodeAEASignatureError: + return .failure( + "The Xcode archive is not signed by Apple. Delete it and download it again.", + style: .error(nextSteps: ["xcodeinstall download"]) + ) + case .xCodeAEAInstallationError: + return .failure( + "Can not verify or expand the Xcode AEA file. Is there enough space on / ? (16GiB required)" + ) case .xCodeMoveInstallationError: return .failure("Can not move Xcode to /Applications") case .xCodePKGInstallationError: diff --git a/Sources/xcodeinstall/Utilities/XcodeVersionExtractor.swift b/Sources/xcodeinstall/Utilities/XcodeVersionExtractor.swift index b6ef56d..8c5df6b 100644 --- a/Sources/xcodeinstall/Utilities/XcodeVersionExtractor.swift +++ b/Sources/xcodeinstall/Utilities/XcodeVersionExtractor.swift @@ -5,6 +5,8 @@ struct XcodeVersionExtractor { if let dotRange = name.range(of: ".xip", options: .backwards) { name = String(name[.. Data { + let url = try #require(Bundle.module.url(forResource: name, withExtension: "pem")) + return try Data(contentsOf: url) + } + + static func littleEndian(_ value: UInt32) -> Data { + Data([UInt8(value & 0xff), UInt8((value >> 8) & 0xff), UInt8((value >> 16) & 0xff), UInt8(value >> 24)]) + } + + static func authDataEntry(key: String, value: Data) -> Data { + var body = Data(key.utf8) + body.append(0) + body.append(value) + var entry = littleEndian(UInt32(4 + body.count)) + entry.append(body) + return entry + } + + static func makeTemporaryDirectory() throws -> URL { + let url = FileManager.default.temporaryDirectory + .appendingPathComponent("xcodeinstall-aea-\(UUID().uuidString)") + try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true) + return url + } + + /// Builds a signature-only archive, the profile Apple uses for Xcode, + /// holding a small `Xcode-test.app` directory. + static func makeSignedArchive(in directory: URL, signingKey: P256.Signing.PrivateKey) throws -> URL { + let source = directory.appendingPathComponent("source") + let contents = source.appendingPathComponent("Xcode-test.app/Contents") + try FileManager.default.createDirectory(at: contents, withIntermediateDirectories: true) + try Data("27.3".utf8).write(to: contents.appendingPathComponent("version.txt")) + + let archive = directory.appendingPathComponent("Xcode 27.3 test.aea") + let context = ArchiveEncryptionContext( + profile: .hkdf_sha256_hmac__none__ecdsa_p256, + compressionAlgorithm: .lzma + ) + try context.setSigningPrivateKey(signingKey) + + let fileStream = try #require( + ArchiveByteStream.fileStream( + path: FilePath(archive.path), + mode: .writeOnly, + options: [.create, .truncate], + permissions: [.ownerReadWrite] + ) + ) + let encryptionStream = try #require( + ArchiveByteStream.encryptionStream(writingTo: fileStream, encryptionContext: context) + ) + let encodeStream = try #require(ArchiveStream.encodeStream(writingTo: encryptionStream)) + let keySet = try #require(ArchiveHeader.FieldKeySet("TYP,PAT,DAT,UID,GID,MOD,FLG,MTM,CTM")) + try encodeStream.writeDirectoryContents(archiveFrom: FilePath(source.path), keySet: keySet) + try encodeStream.close() + try encryptionStream.close() + try fileStream.close() + return archive + } +} diff --git a/Tests/xcodeinstallTests/API/InstallTest.swift b/Tests/xcodeinstallTests/API/InstallTest.swift index 9e7e500..3e508b2 100644 --- a/Tests/xcodeinstallTests/API/InstallTest.swift +++ b/Tests/xcodeinstallTests/API/InstallTest.swift @@ -47,6 +47,19 @@ final class InstallTest { #expect(result == .xCode) } + @Test("Test Install Support File Xcode AEA") + func testInstallSupportFileXcodeAEA() async throws { + + // given + let pkgName = "Xcode 27.3 beta 2.aea" + + // when + let result: SupportedInstallation = SupportedInstallation.supported(pkgName) + + // then + #expect(result == .xCode) + } + @Test("Test Install Support File Command Line Tools") func testInstallSupportFileCommandLineTools() async throws { diff --git a/Tests/xcodeinstallTests/Utilities/XcodeVersionExtractorTests.swift b/Tests/xcodeinstallTests/Utilities/XcodeVersionExtractorTests.swift index c3e62f4..7234207 100644 --- a/Tests/xcodeinstallTests/Utilities/XcodeVersionExtractorTests.swift +++ b/Tests/xcodeinstallTests/Utilities/XcodeVersionExtractorTests.swift @@ -38,6 +38,11 @@ struct XcodeVersionExtractorTests { #expect(XcodeVersionExtractor().extractVersion(from: "Xcode-14.0.1.app") == "14.0.1") } + @Test("Extracts version from an AEA beta file name") + func testAEABeta() { + #expect(XcodeVersionExtractor().extractVersion(from: "Xcode 27.3 beta 2.aea") == "27.3-beta-2") + } + @Test("Returns nil for bare Xcode.xip") func testBareXcode() { #expect(XcodeVersionExtractor().extractVersion(from: "Xcode.xip") == nil) diff --git a/Tests/xcodeinstallTests/data/apple-aea-certificate-chain.pem b/Tests/xcodeinstallTests/data/apple-aea-certificate-chain.pem new file mode 100644 index 0000000..3c74a33 --- /dev/null +++ b/Tests/xcodeinstallTests/data/apple-aea-certificate-chain.pem @@ -0,0 +1,63 @@ +-----BEGIN CERTIFICATE----- +MIIEqTCCBC6gAwIBAgIQT/yUzRk6ApBbNu1pqtV/wzAKBggqhkjOPQQDAzB5MS0w +KwYDVQQDEyRBcHBsZSBQbGF0Zm9ybSBTaWduaW5nIEVDQyBDQSAxIC0gRzExJjAk +BgNVBAsTHUFwcGxlIENlcnR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7YyYl3J6YRbTzBPEVoA/VhYDKX1DyxNB0cTddqXl5dvMVztK517 +IDvYuVTZXpmkOlEKMaNCMEAwHQYDVR0OBBYEFLuw3qFYM4iapIqZ3r6966/ayySr +MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMAoGCCqGSM49BAMDA2gA +MGUCMQCD6cHEFl4aXTQY2e3v9GwOAEZLuN+yRhHFD/3meoyhpmvOwgPUnPWTxnS4 +at+qIxUCMG1mihDK1A3UT82NQz60imOlM27jbdoXt2QfyFMm+YhidDkLF1vLUagM +6BgD56KyKA== +-----END CERTIFICATE----- diff --git a/Tests/xcodeinstallTests/data/self-signed-certificate-chain.pem b/Tests/xcodeinstallTests/data/self-signed-certificate-chain.pem new file mode 100644 index 0000000..d29ebed --- /dev/null +++ b/Tests/xcodeinstallTests/data/self-signed-certificate-chain.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBmTCCAUCgAwIBAgIUBpDP1awM4B5zm86xbHZxqcrHyFUwCgYIKoZIzj0EAwIw +MjETMBEGA1UECgwKQXBwbGUgSW5jLjEbMBkGA1UEAwwSQXBwbGUgUm9vdCBDQSAt +IEczMCAXDTI2MTExOTExNTAwN1oYDzIxMjYxMDI2MTE1MDA3WjAyMRMwEQYDVQQK +DApBcHBsZSBJbmMuMRswGQYDVQQDDBJBcHBsZSBSb290IENBIC0gRzMwWTATBgcq +hkjOPQIBBggqhkjOPQMBBwNCAARhTczb8u6R5WuGKYTeYc6Ws9G3Zd8BHCKEuEI3 +GXgnX+QYrub7/RaH7G6omLslANjyiAPVIY46vuqTcrZwheIzozIwMDAdBgNVHQ4E +FgQUI2L7jFkKwj/DtooMQ0bjKsTLE78wDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjO +PQQDAgNHADBEAiAUNO4/XRzzKZSj4OYg3/sRGnY0ao66SjIk9SI3/3k8awIgWOfE +sf0AUdnYPnbjE6TTdYeU58nScL1UF6O40urA2K8= +-----END CERTIFICATE-----