A replayed older signed catalogue is accepted #243

Closed
opened 2026-10-27 13:35:32 +00:00 by sam · 1 comment
Owner

The catalogue signature covers only the package list, so a registry or network attacker can serve an older validly signed catalogue and pin outdated package digests. Done when the catalogue carries a signed issue time or sequence and archie-core refuses one older than the newest it has seen.


Imported from beads archie-core-em7s.12 · GitHub #1503 · type task · priority P2 · created 2026-10-05

The catalogue signature covers only the package list, so a registry or network attacker can serve an older validly signed catalogue and pin outdated package digests. Done when the catalogue carries a signed issue time or sequence and archie-core refuses one older than the newest it has seen. --- _Imported from beads `archie-core-em7s.12` · GitHub #1503 · type task · priority P2 · created 2026-10-05_
sam added the mediumtask labels 2026-10-27 13:35:32 +00:00
sam self-assigned this 2026-10-27 13:35:32 +00:00
Author
Owner

Triaged: no code change is needed for this. No code change: the work this issue asks for is already in the tree at HEAD (031291a, the same commit as refs/heads/main).

Evidence, in the order the acceptance criteria read:

  • Signed issue time: Catalogue in internal/domain/storepkg/catalogue.go has IssuedAt time.Time json:"issued_at"``, and Validate() refuses a zero issue time ("catalogue has no issue time"). The signature is over the layer bytes and decodeCatalogue decodes exactly those bytes, so issued_at is covered by the ed25519 signature and cannot be stripped or altered (internal/infrastructure/signedoci/signedoci.go Verify).
  • Refusal of an older catalogue: FreshCatalogueSource.Fetch returns ErrCatalogueStale when IssuedAt is before the newest accepted issue time, and only after the wrapped source's signature verification has succeeded.
  • "Newest it has seen", surviving restarts: internal/infrastructure/signedoci/freshness.go FileFreshness keeps a per-source high-water mark as an atomically written JSON file under MarkPath ($XDG_STATE_HOME///.json), never lowers it, and fails closed if the file does not parse.
  • Wired into the product, not just available: internal/infrastructure/storepkg/catalogue.go Catalogue(source) returns FreshCatalogueSource{OCICatalogue, FileFreshness{MarkPath("catalogue", source.Reference)}}; internal/app/statestore/catalogue.go:25-47 routes both the default and the configured catalogue through it, and server.go:277 puts it on the storepkg Service. Every catalogue consumer (webui extensions list/install, InstallFromCatalogue, the auto-update loop in domain/storepkg/update.go) goes through Service.ListCatalogue, so there is no unfreshened path.
  • Tests already encode the behaviour: TestFreshCatalogueSource and TestCatalogueValidateRequiresIssueTime (domain), TestVerifyCatalogue including the case "a signed catalogue with no issue time", TestFetchRefusesReplayedCatalogue (validly signed older catalogue refused, and still refused after a simulated restart), TestFileFreshness (monotonic mark, corrupt mark errors).

What I did not verify: I could not run go test in this read-only session, so I am reporting the tests' content, not their green state; and .git has only packed objects, so I confirmed via the ref files that HEAD and main are the same commit rather than reading the commit log.

Two things a reviewer should know, neither of which is a change to archie-core: no catalogue publisher exists in this repo, so whatever publishes the official catalogue must now include issued_at or installs will fail closed; and CHANGELOG.md [Unreleased] has no entry for this, unlike the equivalent release-side protection noted at line 88. If this issue is still tracked as open, the right action is to close it (optionally with a changelog line), not to start a workflow.

Triaged: no code change is needed for this. No code change: the work this issue asks for is already in the tree at HEAD (031291a, the same commit as refs/heads/main). Evidence, in the order the acceptance criteria read: - Signed issue time: `Catalogue` in internal/domain/storepkg/catalogue.go has `IssuedAt time.Time `json:"issued_at"``, and `Validate()` refuses a zero issue time ("catalogue has no issue time"). The signature is over the layer bytes and `decodeCatalogue` decodes exactly those bytes, so issued_at is covered by the ed25519 signature and cannot be stripped or altered (internal/infrastructure/signedoci/signedoci.go `Verify`). - Refusal of an older catalogue: `FreshCatalogueSource.Fetch` returns `ErrCatalogueStale` when `IssuedAt` is before the newest accepted issue time, and only after the wrapped source's signature verification has succeeded. - "Newest it has seen", surviving restarts: internal/infrastructure/signedoci/freshness.go `FileFreshness` keeps a per-source high-water mark as an atomically written JSON file under `MarkPath` ($XDG_STATE_HOME/<instance>/<kind>/<ref-hash>.json), never lowers it, and fails closed if the file does not parse. - Wired into the product, not just available: internal/infrastructure/storepkg/catalogue.go `Catalogue(source)` returns `FreshCatalogueSource{OCICatalogue, FileFreshness{MarkPath("catalogue", source.Reference)}}`; internal/app/statestore/catalogue.go:25-47 routes both the default and the configured catalogue through it, and server.go:277 puts it on the storepkg Service. Every catalogue consumer (webui extensions list/install, InstallFromCatalogue, the auto-update loop in domain/storepkg/update.go) goes through Service.ListCatalogue, so there is no unfreshened path. - Tests already encode the behaviour: TestFreshCatalogueSource and TestCatalogueValidateRequiresIssueTime (domain), TestVerifyCatalogue including the case "a signed catalogue with no issue time", TestFetchRefusesReplayedCatalogue (validly signed older catalogue refused, and still refused after a simulated restart), TestFileFreshness (monotonic mark, corrupt mark errors). What I did not verify: I could not run `go test` in this read-only session, so I am reporting the tests' content, not their green state; and `.git` has only packed objects, so I confirmed via the ref files that HEAD and main are the same commit rather than reading the commit log. Two things a reviewer should know, neither of which is a change to archie-core: no catalogue publisher exists in this repo, so whatever publishes the official catalogue must now include `issued_at` or installs will fail closed; and CHANGELOG.md [Unreleased] has no entry for this, unlike the equivalent release-side protection noted at line 88. If this issue is still tracked as open, the right action is to close it (optionally with a changelog line), not to start a workflow.
sam closed this issue 2026-11-08 22:02:25 +00:00
sam added a new dependency 2026-11-14 14:45:20 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Blocks
#1305 Store
sam/archie
Reference: sam/archie#243