Skip to content

feat(apps): verify trusted packages and stage immutable app versions #452

Done

Description

@RentnerKev

Phase: 3 | Priority: P0

Implement the local trust and staging boundary before executing any downloaded app code.

Scope

  • Consume canonical TUF metadata, platform-shipped roots and exact version/target/digest identities.

  • Perform bounded download, archive validation and manager-owned immutable extraction.

  • Check runtime/API/engine/data compatibility and show capability/scope changes before granting them.

  • Retain local verified package history for restart/recovery; separate staging from activation.

  • Read the independent public app-catalog distribution directly, using platform-shipped roots/bootstrap snapshot, bounded refresh and a persistent last-verified catalog cache. Fetch exact approved .tar.zst bytes from controlled GitHub Releases rather than the Marketplace website.

  • Treat official identity and per-version approval as signed namespace/digest metadata. Neither registration, a developer source release nor a rating is installation authority; no Marketplace/GitHub user login, shared client secret or website download ticket is required.

Dependencies

These are implementation prerequisites; app-to-app delivery gates do not create runtime dependencies.

Acceptance criteria

  • All package bytes and metadata are verified before any app entrypoint or migration can execute.
  • Corruption, wrong namespace/target/profile, revoked/unapproved packages and unsupported requirements fail without modifying the active app.
  • Traversal, symlink/hardlink/device entries, privileged modes, duplicate paths and archive size/count expansion attacks are rejected.
  • Packages are manager-owned/read-only to app identities; only designated app data/run directories are mutable.
  • Interrupted/partial downloads and extraction recover or clean up safely; published version/target collisions are rejected.
  • Existing verified installations start offline; recovery uses recorded trusted digests without bypassing updater trust history.
  • A fresh client lists the bundled catalog and can fetch a valid current catalog plus install a newly approved package while the Marketplace website/database/account endpoints are unavailable.
  • Required metadata, descriptions/icons and install assets contain no Marketplace runtime URLs. Cache writes are atomic, persist across restart and never roll updater trust state backwards.
  • Expired/invalid/revoked metadata cannot authorize a new network installation. Catalog/registry outage has explicit outcomes; previously verified installed apps and valid local recovery remain usable, without pretending uncached new downloads work offline.

Planning baseline: Beta 4.
This issue schedules future work; backlog creation does not implement or deploy it.
Use focused project checks and short integration/recovery tests. Endurance runs belong to release preparation. Normal PRs need no additional documentation files or screenshot commits unless requested.

Activity

  1. added this to the v1.0.0-beta.4 milestone on Nov 15, 2026
  2. added
    enhancement
    security
    area: runtime
    on Nov 15, 2026
  3. RentnerKev commented on Nov 26, 2026

    @RentnerKev
    MemberAuthor

    The acceptance criteria are covered by merged changes and tests. Two parts were deliberately left out: the bundled catalog in criterion 7 and icons in criterion 8. Both are explained below the table.

    Where the tests run: ARR is the App Runtime Reference workflow, jobs "Native app runtime reference (amd64)" and "(arm64)". Rust is the CI job "Rust". Its step "Run privileged IPC fixtures with coverage" repeats the app tests as root.

    Criterion Covered by
    1. Bytes and metadata are verified before any entrypoint or migration runs #478, #523, #545 and #568. The signed catalog and compatibility are checked before staging. Staging checks the archive digest, the packaged manifest and contents, the UI and the ABI. Every launch re-verifies the tree through recover, and migrations run from the verified package. Tests: signed_package_stages_and_recovers_offline_with_exact_identities (Rust), privileged_signed_greeting_package (ARR), and the boot into Recovery on a missing archive in privileged_signed_lifecycle (Rust, ARR). #588 adds packaged_manifest_must_match_the_signed_release and published_tree_without_a_receipt_must_match_its_archive.
    2. Corrupt, wrong-namespace/target/profile, revoked, unapproved and unsupported packages fail without touching the active app Interrupted and corrupt update downloads leave the running app, its generation, the store and the data unchanged (privileged_published_greeting_lifecycle, #544, ARR). An unapproved next version never reaches the download (privileged_signed_greeting_package, #524). A release that asks for a new grant is refused with 409, and the active app stays unchanged (privileged_published_greeting_distribution_gates, #569, ARR). Revoked versions do not recover (signed_package_stages_and_recovers_offline_with_exact_identities). Unsupported engine or profile requirements are refused before download (engine_capability_changes_are_preflighted_for_engine_providers, target_check_reads_installed_manifests_from_the_accepted_catalog, Rust). #588 adds three refusals: a missing target (release_without_this_target_never_reaches_the_download_boundary), a packaged app.json with another namespace, version or target (packaged_manifest_must_match_the_signed_release), and an app outside its publisher namespace (catalogs_with_colliding_identities_are_not_accepted).
    3. Traversal, links, devices, privileged modes, duplicates and size/count expansion are rejected #588, unsafe_archive_entries_are_refused_before_publication (Rust, as user and as root). It covers ../x, /bin/app, a hard link, a symbolic link, a character device, a FIFO, a setuid file, a group-writable file, a duplicate path, a case-variant duplicate, 4,097 entries and a 64 MiB + 1 file. Each one is refused with the validator's reason, nothing is published, and a sentinel file outside the store is not touched. staging_tree_refuses_special_files_before_touching_their_targets covers special files in a staged tree.
    4. Packages are manager-owned and read-only to app identities #478: the store is root-owned, and every launch re-hashes the package tree including owner and mode. #588: app_identity_writes_only_its_data_directory (Rust, root) and the extended privileged_signed_greeting_package (ARR) run a shell as the app UID. Writes to the package tree, packages/, archives/, the checkpoint and the store root fail. Writes to the app's data directory succeed. A changed owner or mode makes recover fail. The root step now also runs app_manager::ui::package::tests::, which had never run as root.
    5. Interrupted downloads and extraction recover or clean up; published version/target collisions are rejected signed_package_stages_and_recovers_offline_with_exact_identities (#478, Rust). A partial download leaves no archive. Leftover .download-* and .stage-* workspaces are removed, a symlinked workspace is refused, and a deleted tree is extracted again. The interrupted update download in privileged_published_greeting_lifecycle runs in ARR. #588 covers collisions. catalogs_with_colliding_identities_are_not_accepted refuses a release plus a revocation of one version, two releases of one version and two packages for one target, and leaves the checkpoint byte-identical. Further tests: published_tree_without_a_receipt_must_match_its_archive and republished_identity_cannot_replace_an_installed_package.
    6. Verified installations start offline; recovery uses recorded digests without bypassing trust history #478, #524, #543 and #545. recover reads only the stored checkpoint and the recorded archive and manifest digests. A restore advances the checkpoint only when the root and role floors extend the old ones and all revocations are kept. Tests: promotion_cannot_remove_or_change_observed_revocations (Rust), the offline rollback and restart in privileged_published_greeting_lifecycle (ARR), and privileged_restore_published_greeting (ARR). In #588, republished_identity_cannot_replace_an_installed_package re-signs a history with other bytes for the installed version: recovery fails and the tree stays intact.
    7. A fresh client lists the bundled catalog, fetches a current catalog and installs while Marketplace endpoints are down privileged_published_greeting_lifecycle (#543) starts with no checkpoint, lists the catalog as ready and installs the app. Only the catalog and release hosts answer on that host. Gates step 3 (#569) installs with market.rentner.dev and api.github.com blocked and records zero Marketplace connections. app-offline-restore.ts (#573) installs from the live catalog with the root shipped in the production image. All of these run in ARR. There is no bundled catalog (see deviations).
    8. No Marketplace runtime URLs; cache writes are atomic, persist and never roll trust back Catalog entries have no URL fields. Downloads use the fixed GitHub Releases prefix, which signed_package_stages_and_recovers_offline_with_exact_identities asserts. The gates assert zero Marketplace connections and anonymous GETs only. Checkpoint and receipt writes go through a temporary file, fsync, rename and a directory fsync. No crash test exists for these writes; atomicity rests on that write order. No rollback: persisted_roles_protect_against_rollback_expiry_and_partial_metadata, startup_refresh_allows_local_readers_and_cannot_replace_a_newer_catalog, gates steps 1, 6 and 8. In #588, refused catalogs leave the checkpoint byte-identical.
    9. Expired, invalid or revoked metadata cannot authorize new installs; outages have explicit outcomes Expired metadata: gates steps 1 and 6 (#569), persisted_roles_protect_against_rollback_expiry_and_partial_metadata. Invalid metadata: installer_respects_root_path_admission_and_retains_its_catalog_when_refresh_fails (tampered checkpoint, pin mismatch) and flipped_role_signatures_leave_the_accepted_catalog_unchanged (#588). Revoked: signed_package_stages_and_recovers_offline_with_exact_identities. Outcomes: #589 reports catalogUnavailable, packageSourceUnavailable and networkUnavailable and marks uncached packages. Installed apps keep running without network (gates step 8).

    Deviations

    • Bundled bootstrap snapshot (criterion 7): deliberately not implemented. A bundled snapshot goes stale and cannot authorize installs on its own; the appliance needs fresh signed metadata anyway. The image ships the trusted root and the installer configuration. Until its first successful refresh, a new appliance lists no apps and reports which source is unreachable.
    • Icons (criterion 8): there is no icon pipeline, and no app ships icons yet. The installer never fetches icon targets.

    Open decision

    • The Platform catalog reader authenticates the TUF chain and refuses rollback, but it does not compare releases across revisions. Only the publisher's update_catalog refuses a changed release or a dropped revocation. Installations stay bound to their recorded archive and manifest digests; republished_identity_cannot_replace_an_installed_package pins this. Whether the reader should also refuse such revisions is still open.

    Closing as completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: runtimeenhancementsecurity

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions