Skip to content

catalog: require every channel's catalog to declare that channel - #213

Merged
DjDeveloperr merged 7 commits into
mainfrom
sec/catalog-channel
Nov 23, 2026
Merged

DjDeveloperr merged 7 commits into
mainfrom
sec/catalog-channel

Conversation

@RyanTheTide

@RyanTheTide RyanTheTide commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem. On Stable and RC the app accepted a signed catalog that carries no channel field, with no further check. On Edge it accepted an empty undeclared catalog. The publisher still wrote empty catalogs without channel and could promote an undeclared catalog to any channel. The same signed bytes therefore verified on every channel.

Change.

  • App (ReleaseCatalogChannelPolicy):
    • Stable, RC and Edge accept only a catalog whose signed channel is that channel, empty catalogs included.
    • Testing keeps one narrow exception, because the development deliveries published today carry no channel. An undeclared catalog counts as Testing only when it lists models and all of them are of that delivery lineage.
  • Publisher (publish-channels):
    • empty-catalog requires --channel and writes it.
    • os-promote refuses a catalog that declares no channel.
    • Because one signed catalog can no longer serve both rc and stable, os-promote prefers a per-channel staged catalog.<channel>.signed.json and falls back to catalog.signed.json. publish-m1-release publish-r2 uploads those per-channel files when present.
    • channel-status compares stable and rc on content, ignoring channel/issuedAt.

Published state, checked read-only on 2026-11-23. Every published Stable, RC and Edge catalog (base plus 9 profiles) already declares its channel, so this breaks no current user and needs no republish first. All Testing catalogs are undeclared, which is why the exception stays. Removing it needs aurora-distributions to publish Testing with channel: testing first; it currently strips the field in build-payload.yml.

Testing.

  • apple-installer-channel-publish-test.sh: 40 ok on main, 42 ok here. The new case fails on main.
  • python3 -m unittest discover -s scripts/tests: 103 OK on main, 106 OK here.
  • Five new Swift tests in ReleaseChannelAvailabilityTests, not compiled locally (no Swift on the buildbox); macOS CI is the first compile.

Still to run. macOS CI, and a release-tooling review from whoever runs promotions (review requested from the publish-channels owner).

Assisted-by: LLM (Claude:Opus 5.5)

…moted without it

A catalog's signature binds it to a channel only when the catalog declares
one. empty-catalog wrote no channel, and os-promote accepted a catalog that
declared none on stable, rc and testing, so the same signed bytes could be
served on any of them.

empty-catalog now takes --channel and writes it. os-promote refuses a
catalog that declares no channel, as it already refused one declaring
another. A release set bound for more than one channel stages one signed
catalog for each as releases/TAG/catalog.CHANNEL.signed.json, which
os-promote reads first; publish-r2 uploads those beside catalog.signed.json.
channel-status prints the declared channel and compares stable with rc by
what they offer, since their bytes now always differ.

prepare-distribution-release.py still reads an undeclared delivery as
Testing: the development deliveries published today predate the field.
Tests pin that it refuses a delivery signed for any other channel.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The app accepted a signed catalog with no channel field on Stable and RC
without any check, and an empty undeclared one on Edge. Such a catalog
verifies on every channel alike, so one channel's catalog, or an old one,
could be served on another.

Stable, RC and Edge now accept only a catalog whose signed channel is that
channel, an empty catalog included. Testing keeps one exception, because
the development deliveries published today carry no channel: an undeclared
catalog is read as Testing only when it lists models and every one is of
that delivery lineage. An undeclared empty catalog is no longer accepted
there.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Review at ffad3f5.

The app side is right. channel is read from the same payload bytes the signature covers, and ReleaseCatalogChannelPolicy.validate runs after validateSupportCatalog in both loaders (InstallerReleaseAssetCoordinator.swift:97 and :119). Every later consumer (plan review, plan preparation, the sealed catalog) takes its documents from those two, and the helper parses no catalog, so there is no second path. I fetched the live catalogs today (base plus 8 profiles): every Stable, RC and Edge one declares its channel, and every Testing one is undeclared with 58 models that all pass a re-implementation of isLegacyDevelopment. Merging breaks no current install. Locally at this head: 106 Python tests OK, 42 ok in the channel-publish shell test.

  1. publish-channels:354: any failed fetch of catalog.<channel>.signed.json (a 5xx or a reset, not only a 404) falls back to catalog.signed.json. If that file declares the same channel, the promotion publishes it instead of the per-channel catalog and says nothing. Fall back only on 404; fetch_status (:262) already tells the two apart.
  2. ReleaseCatalogChannelPolicy.swift:29: a catalog signed for Stable, RC or Testing and served at the Edge address reads as edgeAlphaUnavailable ("Edge isn't available yet"), and testAnEmptyEdgeCatalogMustDeclareEdge pins that. On the other three channels the same mix-up is a verification failure. Keep "not published" for the undeclared case, and throw invalidCatalogChannel when another channel is declared, so a mis-served catalog is not shown as a quiet empty channel.
  3. prepare-distribution-release.py:74 accepts an undeclared catalog as the bundled Testing default without the lineage test the app applies (ReleaseCatalogChannelPolicy.swift:23-24). A delivery that passes here can be refused by the built app, and because the sealed catalog replaces the fetch for the default channel, that build has no working default. Mirror the lineage check, or require channel: testing for new bundles.
  4. publish-m1-release:442: the per-channel files are uploaded to immutable keys without checking that each one declares the channel in its name. os-promote refuses a wrong one later, but by then the key cannot be replaced for that tag. Check it before upload.
  5. invalidCatalogChannel now also fires for undeclared Stable and RC catalogs and still falls through to the default text at PlainLanguage.swift:1222 ("The release is unavailable ... Review the error details"). It belongs with the "couldn't be verified" case just above it.

The Testing exception stays fail-open until aurora-distributions publishes Testing with channel: testing, as the body says. An undeclared catalog whose models are all disabled also passes it (:92). Please track the removal in an issue.

Still owed at this head: the macOS checks leg. The five new Swift tests have never been compiled, and it was pending when I looked.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formal §1–§6 pre-PR checklist review at ffad3f556a389e9fc78488eafb7c15e4cb71cec8:

Requiring signed channel declaration on Stable, RC, and Edge (including empty catalogs) and blocking promotion of undeclared catalogs closes the cross-channel catalog replay gap cleanly. However, adversarial review confirms four real policy/fail-closed gaps across publish-channels, ReleaseCatalogChannelPolicy.swift, prepare-distribution-release.py, and publish-m1-release that should be fixed before merge.

Checklist summary:

  • §1 No model gating: Pass (no chip/board/model gates).
  • §2 Production-ready, no hacks: Pass.
  • §3 Safety: Needs fixes (see Blockers #1–#4 below).
  • §4 Clean-room & attribution: Pass (both commits carry human author/committer Ryan Murray <ryan@aurorasilicon.org>, human Signed-off-by: only, zero AI trailers in commits; PR body includes Assisted-by: disclosure).
  • §5 Evidence: Pass for test/live-catalog read-only verification (Portable checks + macOS checks green; live published R2 catalogs verified read-only; release-tooling review requested).
  • §6 Naming: Pass.

CI verification at ffad3f556a:

  • Portable checks: SUCCESS
  • macOS checks: SUCCESS
  • Conformance matrix: FAILURE — verified in job 137435061121 logs to fail solely on the unrelated repo-wide 42x FAIL branch pins: aura 56299352d9f4, pin 3ff778945672 (#196) plus the 8 pre-existing -shrunk-synthetic FAIL plan rows. Zero PR-specific failures.

Blockers before merge

  1. Silent fallback on non-404 errors in os_promote (macOS/scripts/publish-channels:351-356):

    • if ! fetch_public "releases/$tag/catalog.$channel.signed.json" ... falls back to releases/$tag/catalog.signed.json on any failure (HTTP 5xx, timeout, connection reset, TLS error), not only HTTP 404.
    • If catalog.<channel>.signed.json fails transiently while catalog.signed.json happens to exist and declare the same channel, os-promote silently promotes the fallback instead of failing closed. fetch_status (publish-channels:262-273) already distinguishes 200, 404, and transport/HTTP errors — fall back to catalog.signed.json only on 404 and die on any other status.
  2. Explicit cross-channel catalog substitution on Edge misclassified as .notPublished (macOS/Sources/AuroraAppleInstaller/ReleaseCatalogChannelPolicy.swift:47-50):

    • On Stable, RC, and Testing, a catalog signed for another channel throws InstallerReleaseConfigurationError.invalidCatalogChannel (verification failure). On Edge, lines 47–50 throw .edgeAlphaUnavailable (rendered as .notPublished / "Edge isn't available yet") even when declared explicitly names "stable", "rc", or "testing", and testAnEmptyEdgeCatalogMustDeclareEdge locks in that behavior.
    • Reserve .edgeAlphaUnavailable for undeclared/unqualified legacy catalogs, and throw .invalidCatalogChannel whenever declared != nil && declared != "edge" so a mis-served or replayed catalog surfaces as a verification failure on all four channels.
  3. Bundled Testing validation is weaker than the app's runtime check (macOS/scripts/prepare-distribution-release.py:69-72):

    • prepare-distribution-release.py accepts any catalog where catalog.get("channel") in (None, "testing"), without enforcing ReleaseCatalogChannelPolicy's requirement that an undeclared Testing catalog be non-empty and satisfy isLegacyDevelopment.
    • A sealed build passing prepare-distribution-release.py with an undeclared empty or non-legacy catalog will fail verification at runtime with no working offline default. Mirror the non-empty + lineage check or require "channel": "testing" for new sealed bundles.
  4. Per-channel catalogs uploaded to immutable R2 keys without channel validation (macOS/scripts/publish-m1-release:446-451):

    • publish_r2_release uploads catalog.<channel>.signed.json to immutable releases/<tag>/ keys without checking that each envelope's signed payload declares the channel matching its filename. A mislabeled file burns the immutable tag before os-promote catches it. Validate each per-channel catalog's declared channel before upload.

Non-blocking notes

  • macOS/Sources/AuroraInstallerUXCore/PlainLanguage.swift:1211-1226: add .invalidCatalogChannel to the .invalidCatalogEnvelope, .invalidCatalogSignature, .oversizedDocument verification-failure case rather than falling through to the generic "The release is unavailable" default.
  • Track removal of the undeclared Testing fallback (and note that isLegacyDevelopment at ReleaseCatalogChannelPolicy.swift:92 returns true for all-disabled models) in a follow-up issue once aurora-distributions stops stripping channel.

Assisted-by: LLM (Gemini 4 Neon)

os-promote read releases/<tag>/catalog.<channel>.signed.json and, on any
failure to fetch it, promoted releases/<tag>/catalog.signed.json instead.
A 5xx, a reset or a truncated body for the channel's own catalog could
therefore promote the other file without a word, when that file also
declared the channel.

The fetch now goes through fetch_status: only a 404 falls back, and any
other result stops the promotion and names the status.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
On Stable, RC and Testing a catalog signed for another channel fails
verification. On Edge the same catalog was reported as edgeAlphaUnavailable,
which the app shows as "Edge isn't available yet", so a mis-served or
replayed catalog looked like a quiet empty channel.

Edge now throws invalidCatalogChannel when the catalog declares any other
channel. Only an undeclared catalog still reads as not published.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…undled catalog

The bundled catalog replaces the fetch for the default channel, but the
release preparation accepted any catalog declaring no channel or Testing.
A build could pass it with an undeclared catalog the app then refuses,
leaving that build with no working default.

The bundled catalog of each profile, and the root one, now pass the rule
the app applies: a declared channel must be the descriptor's default
channel, and an undeclared catalog is accepted only as Testing and only as
a development delivery. The lineage test is ported from
ReleaseCatalogChannelPolicy, and a shared vector file pins the Swift and
Python implementations to the same cases.

Two changes to the app's rule make the port exact and close gaps:
- An undeclared catalog must list at least one Mac that is not disabled.
  A catalog of only disabled models matched the lineage test and read as
  an empty Testing channel.
- The payload source must be the canonical release URL byte for byte, and
  the file name ASCII letters, digits, '.', '_', '+' and '-'. URL parsing
  let a port, percent-encoding, doubled slashes and a '..' file name
  through, which a string check in Python would not mirror.

Every published Testing catalog still passes both implementations.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
…pload

publish-r2 uploaded catalog.<channel>.signed.json to the immutable
releases/<tag>/ keys without reading it. os-promote refuses a catalog that
declares the wrong channel, but by then the key cannot be replaced for that
tag.

Each per-channel envelope is now decoded and its signed catalog must declare
the channel in its file name; otherwise nothing is uploaded. The reader,
catalog_declared_channel, is shared with publish-channels os-promote, which
sources this script, in place of its inline copy.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
… failure

invalidCatalogChannel, which now covers undeclared Stable and RC catalogs
and another channel's catalog on Edge, fell through to the generic "The
release is unavailable" text. It is a verification failure, so it now reads
"The release couldn't be verified", as a bad envelope or signature does.

Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
@RyanTheTide

RyanTheTide commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Five new commits (1f1232b..11a0ef8) address both reviews:

  1. publish-channels os-promote falls back to catalog.signed.json only on a 404. Any other status stops the promotion. New shell cases: 503 and a truncated 200 fail with nothing changed; 404 falls back.
  2. Edge: a catalog that declares another channel is now invalidCatalogChannel (a verification failure). edgeAlphaUnavailable is kept for undeclared catalogs only. Tests updated, plus a new one.
  3. prepare-distribution-release.py now applies the app's rule to every bundled default catalog:
    • A declared channel must equal the descriptor's default.
    • An undeclared catalog must be Testing and pass the lineage test.
    • The predicate is ported exactly. A shared fixture (35 vectors, Fixtures/legacy-testing-catalog-vectors.json) is checked by both a Python and a Swift test.
    • The Swift predicate is now as strict as the port: a canonical release URL byte for byte, and a restricted file-name alphabet. At ffad3f5 it accepted an explicit port, percent-encoding, a doubled slash and ...
    • An undeclared all-disabled catalog no longer passes: at least one model must not be disabled.
    • All 10 live Testing catalogs (58 models each) still pass both implementations.
  4. publish-m1-release publish-r2 decodes each catalog.<channel>.signed.json and stops before any upload unless it declares that channel. os-promote uses the same helper. There is a new shell test.
  5. PlainLanguage: invalidCatalogChannel now joins the "couldn't be verified" case, with a test.

Tests:

  • scripts/tests: 110 OK. test/all: passes. channel-publish test: 43 ok.
  • The new Python/shell tests fail at ffad3f5.
  • Swift: parse and lint are clean, and the real policy file compiled on Linux against the fixture gives 0 mismatches (11 at ffad3f5). XCTest comes from CI.

Removing the Testing exception is tracked in #220.

Assisted-by: LLM (Claude:Opus 5.5)

@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Review at 11a0ef8.

  1. os-promote fallback: fixed (publish-channels:353-369). Only a 404 falls back to catalog.signed.json. fetch_status reports a truncated 200 as a curl error, so it stops, as the new 503 and truncation cases show.
  2. Edge with another channel's catalog: fixed (ReleaseCatalogChannelPolicy.swift:31-37). An undeclared catalog is still edgeAlphaUnavailable, and one that declares another channel is now invalidCatalogChannel.
  3. Bundled default vs the app: fixed. check_bundled_default() requires a declared channel to equal the descriptor's default, and requires an undeclared catalog to be Testing and pass the ported lineage test. This runs for every profile and for the root descriptor, before anything is written. The shared 35-vector fixture pins Python and Swift to the same answers. The stricter Swift URL match (byte-exact canonical URL, restricted file names, utf8.elementsEqual for the profile) also closes the port, percent-encoding and .. cases.
  4. Per-channel upload check: fixed (publish-m1-release:473-486). catalog_declared_channel ... envelope decodes the signed bytes and stops before any upload. publish-channels sources the same helper.
  5. PlainLanguage: fixed.
    The all-disabled case: fixed (at least one model must not be disabled). Removing the Testing exception is tracked in Remove the undeclared Testing catalog fallback once Testing catalogs declare their channel #220.

New code: I found no issues. One small difference that fails safe: the Python lineage test checks against the requested profile set (Omarchy only when enabled), while Swift uses allProfileIDs. So the script can only be stricter than the app.

Verdict: APPROVE. Owed: the macOS checks leg at this head (still queued), because the new and changed XCTests have only been compiled on Linux against the fixture.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formal §1–§6 pre-PR re-review at 11a0ef8f2166a4d45e7518d1f7930927e77d1b27 (following REQUEST_CHANGES at ffad3f556a38).

Verdict: APPROVE.

Verified Resolved from ffad3f556a38

  1. 404-only fallback in os_promote() (macOS/scripts/publish-channels:353-369, commit 1f1232b3): Resolved. Uses fetch_status so only HTTP 404 falls back to catalog.signed.json; HTTP 5xx and truncated 200 / curl failures abort without touching any channel (covered by new CURL_UNAVAILABLE and CURL_TRUNCATED shell test cases).
  2. Cross-channel catalog on Edge (macOS/Sources/AuroraAppleInstaller/ReleaseCatalogChannelPolicy.swift:30-37, commit b82866c9): Resolved. Undeclared catalogs on Edge still throw .edgeAlphaUnavailable, while any catalog declaring another channel (empty or non-empty) now throws .invalidCatalogChannel (verification failure), covered by updated and new XCTests.
  3. Bundled default parity & tightened legacy predicate (macOS/scripts/prepare-distribution-release.py:79-120,164-172 & ReleaseCatalogChannelPolicy.swift:24-27,101-140, commit e7a7f0ce): Resolved. check_bundled_default() validates every profile and root release.json before emitting output, mirroring the app's rule. Both Swift and Python enforce byte-exact canonical GitHub release URLs, restricted ASCII file names, and at least one non-disabled model, pinned together by the shared 35-vector fixture (Fixtures/legacy-testing-catalog-vectors.json).
  4. Pre-upload per-channel check in publish-m1-release (macOS/scripts/publish-m1-release:66-92,470-488, commit a3a64020): Resolved. Shared catalog_declared_channel decodes each catalog.<channel>.signed.json envelope and verifies declared_channel == named_channel before any aws s3 cp upload (covered by new apple-installer-r2-catalog-channel-test.sh).
  5. Non-blocking notes resolved (11a0ef8f & #220): PlainLanguage.swift:1212 maps .invalidCatalogChannel to the "The release couldn’t be verified" failure display (tested in PlainLanguageTests.swift), and removal of the Testing exception is tracked in #220.

Checklist & CI Verification at 11a0ef8f2166

  • §1–§3, §6: Pass — fresh audit of all 5 new commits found no fail-open paths or regressions.
  • §4 Clean-room & attribution: Pass — all 7 commits (4622cce6..11a0ef8f) carry human author/committer (Ryan Murray <ryan@aurorasilicon.org>) and human Signed-off-by: only, zero AI trailers in commits; PR body carries Assisted-by:.
  • §5 Evidence & CI: Pass — Portable checks, macOS checks, policy, and selftest are all SUCCESS. Conformance matrix (FAILURE, run 45106648479) verified in logs to fail solely on the unrelated repo-wide 42x FAIL branch pins: aura 56299352d9f4, pin 3ff778945672 (#196) plus the 8 pre-existing -shrunk-synthetic FAIL plan rows (0 PR-specific failures). Live R2 catalogs (Stable/RC/Edge + all 10 Testing catalogs) verified read-only, and release-tooling owner reviewed at 11a0ef8f.

Assisted-by: LLM (Gemini 4 Neon)

@DjDeveloperr
DjDeveloperr merged commit 3dd40d0 into main Nov 23, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants