Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions macOS/Release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ Every catalog must use schema 5 and select the built-in `native-v1` engine. Olde
The descriptor remains schema 3 and names four distinct channel endpoints, with Testing as the bundled default. The bundled default is the sealed, offline fallback, never Edge. In the standard build a new installation opens on Edge instead when the selected profile's verified Edge catalog admits this Mac and lists it as family-qualified: `edgeQualification.devices` maps the Mac's device identifier to `{"evidenceDigest": "sha256:<64 hex>"}`, the digest of a detached evidence record naming the Mac and the machine row its chip family passed. One qualified machine qualifies its family; the app checks only that the map is well formed, and which models a row covers is the signed publisher's policy. A catalog without `devices` but with `neoEvidence` qualifies only `apple,j700` (a temporary fallback for alpha.1/alpha.2 catalogs, to be removed in a follow-up PR once `fedora-kde` Edge is re-published with `devices`), and a malformed `devices` qualifies no Mac. A listed Mac that isn't family-qualified, or a catalog with no release for it, opens on Nightly; Edge can still be chosen where it is listed. An Edge catalog that cannot be fetched or verified keeps Edge chosen rather than falling back, so preparing retries it, and Check Channels Again decides that default again from the same read the menu shows. Each profile is decided once per launch, and a Release channel menu choice wins. Reset and Update Boot Loader act on an existing installation and read the channel recorded when this app installed it (by the space it occupies), or Testing when none was recorded, never the Edge default; their masthead names that channel, Edge included. Because `InstallationChannelRecordStore` is stored per-user in Application Support, running Reset or Update Boot Loader from a different macOS account finds no record and falls back to Testing (shown in the masthead). Installations made before the record existed read Testing: the lane in the installation's own `omarchy/install.conf` is on its EFI partition, which only the privileged helper mounts, and `lane=edge` from installers before alpha.22 meant today's Testing. Developer and private builds keep the bundled default. Edge's ID is `edge`; its new URL is `channels/edge-alpha/catalog.signed.json`. The older `channels/edge` URL is a legacy Testing alias for already released installers and never carries the new Edge track. A legacy three-channel descriptor is read as a development descriptor: its old default Edge resolves to Testing, while new Edge is unavailable.

A sealed catalog is usable only for its own default channel. Edge cannot reuse a sealed Testing catalog. Missing Edge endpoints, signed empty Edge catalogs and unqualified legacy development catalogs are displayed as unavailable without substituting Testing. A nonempty Edge catalog must carry signed `channel: edge` and a valid `edgeQualification` bound to the actual payload, Linux/Mesa source revisions and Git tree IDs.

Every channel's catalog declares that channel in its signed `channel` field, an empty catalog included: `scripts/publish-channels empty-catalog --channel <channel>` writes it, and `os-promote` refuses a catalog that declares another channel or none. A release set bound for more than one channel stages one signed catalog for each as `releases/<tag>/catalog.<channel>.signed.json`. The app accepts a Stable, RC or Edge catalog only when it declares that channel. A catalog that declares another channel fails verification on every channel, Edge included; on Edge only an undeclared catalog reads as not published. Testing keeps one exception for the development deliveries published before the field existed: an undeclared catalog is read as Testing only when it lists at least one Mac that is not disabled and every model is of that delivery lineage (or disabled); a lineage source must be the canonical `https://github.com/aurora-silicon/<repository>/releases/download/<tag>/<fileName>` URL byte for byte. `scripts/prepare-distribution-release.py` applies the same rule to the bundled default catalog, which must otherwise declare the descriptor's default channel; `Tests/AuroraAppleInstallerTrustCoreTests/Fixtures/legacy-testing-catalog-vectors.json` pins both implementations to the same cases. That exception goes away once those deliveries are republished with `channel: testing`.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
import Foundation

/// Applied only after the catalog signature and rollback floor are verified.
/// Legacy development catalogs belong to Testing; they can never become Edge.
/// The signed `channel` is what binds a catalog to the channel it is served
/// on: every channel's catalog, an empty one included, must declare that
/// channel, or the same signed bytes could be served on any of them. The one
/// exception is Testing, whose published development deliveries predate the
/// field: an undeclared catalog is accepted there only when it lists a model
/// that isn't disabled and each of them is of that delivery lineage (or
/// disabled). Those catalogs belong to Testing; they can never become Stable,
/// RC or Edge.
enum ReleaseCatalogChannelPolicy {
static func validate(payload: Data, channel: ReleaseChannel) throws {
guard let object = try JSONSerialization.jsonObject(with: payload) as? [String: Any],
Expand All @@ -13,18 +20,21 @@
throw InstallerReleaseConfigurationError.invalidCatalogChannel
}
guard channel == .edge else {
if let declared, declared != channel.rawValue {
throw InstallerReleaseConfigurationError.invalidCatalogChannel
}
if channel == .testing && declared == nil && !models.allSatisfy(isLegacyDevelopment) {
throw InstallerReleaseConfigurationError.invalidCatalogChannel
}
if declared == channel.rawValue { return }
guard channel == .testing, declared == nil,
models.contains(where: { $0["status"] as? String != "disabled" }),
models.allSatisfy(isLegacyDevelopment)
else { throw InstallerReleaseConfigurationError.invalidCatalogChannel }
return
}
if models.isEmpty && (declared == nil || declared == "edge") { return }
guard declared == "edge" else {
throw InstallerReleaseConfigurationError.edgeAlphaUnavailable
// A catalog signed for another channel and served on Edge was mis-served
// or replayed: that is a verification failure, as on every other
// channel. Only an undeclared catalog means Edge has no Alpha yet.
guard let declared else { throw InstallerReleaseConfigurationError.edgeAlphaUnavailable }
guard declared == channel.rawValue else {
throw InstallerReleaseConfigurationError.invalidCatalogChannel
}
if models.isEmpty { return }
guard let envelope = try? JSONDecoder().decode(Envelope.self, from: payload) else {
throw InstallerReleaseConfigurationError.invalidEdgeQualification
}
Expand Down Expand Up @@ -84,6 +94,10 @@
&& board.allSatisfy { (48...57).contains($0) || (97...122).contains($0) }
}

/// The published development delivery lineage. scripts/
/// prepare-distribution-release.py ports this exactly, and
/// Fixtures/legacy-testing-catalog-vectors.json pins both to the same
/// cases. The source must be the canonical release URL byte for byte.
private static func isLegacyDevelopment(_ model: [String: Any]) -> Bool {
if model["status"] as? String == "disabled" { return true }
guard let profile = model["installationProfile"] as? String,
Expand All @@ -92,9 +106,7 @@
let artifact = model["payloadArtifact"] as? [String: Any],
let fileName = artifact["fileName"] as? String,
let source = artifact["sourceURL"] as? String,
let url = URL(string: source),
url.scheme == "https", url.host == "github.com", url.user == nil,
url.password == nil, url.query == nil, url.fragment == nil
isFileName(fileName)
else { return false }
let run = String(evidence.dropFirst("image-build-".count))
guard !run.isEmpty, run.first != "0", run.utf8.allSatisfy({ (48...57).contains($0) })
Expand All @@ -103,16 +115,28 @@
"fedora": "fedora-aurora", "arch": "alarm-aurora",
"nixos": "nixos-aurora", "omarchy": "omarchy-aurora",
]
guard AuroraInstallationSelection.allProfileIDs.contains(profile),
guard
AuroraInstallationSelection.allProfileIDs.contains(where: {
$0.utf8.elementsEqual(profile.utf8)
}),
let distribution = profile.split(separator: "-").first,
let repository = repositories[String(distribution)]
else { return false }
let parts = url.pathComponents
let tag = "payload-\(profile)-\(run)"
return parts.count == 7 && parts[1] == "aurora-silicon" && parts[2] == repository
&& parts[3] == "releases" && parts[4] == "download"
&& [tag, tag + "-models58", tag + "-models65"].contains(parts[5])
&& parts[6] == fileName
return [tag, tag + "-models58", tag + "-models65"].contains { release in
source.utf8.elementsEqual(
"https://github.com/aurora-silicon/\(repository)/releases/download/\(release)/\(fileName)"
.utf8)
}
}

/// ASCII letters and digits, then also `.`, `_`, `+` and `-`.
private static func isFileName(_ value: String) -> Bool {
let isAlphanumeric = { (byte: UInt8) in
(48...57).contains(byte) || (65...90).contains(byte) || (97...122).contains(byte)
}
guard let first = value.utf8.first, isAlphanumeric(first) else { return false }
return value.utf8.allSatisfy { isAlphanumeric($0) || [46, 95, 43, 45].contains($0) }
}

private struct Envelope: Decodable {
Expand Down
2 changes: 1 addition & 1 deletion macOS/Sources/AuroraInstallerUXCore/PlainLanguage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@
"Check your internet connection and try again, or choose another channel from the Release channel menu."
)
case .invalidCatalogEnvelope, .invalidCatalogSignature,
.oversizedDocument:
.invalidCatalogChannel, .oversizedDocument:
return FailureDisplay(
headline: "The release couldn’t be verified",
plainDetail:
Expand Down
Loading
Loading