Skip to content

fix: arm signature verification for the T2 repo and close the quattro override window - #8709

Open
rmacy wants to merge 2 commits into
omacom:quattrofrom
rmacy:fix/unsigned-t2-repo-and-quattro-override
Open

rmacy wants to merge 2 commits into
omacom:quattrofrom
rmacy:fix/unsigned-t2-repo-and-quattro-override

Conversation

@rmacy

@rmacy rmacy commented Aug 28, 2026

Copy link
Copy Markdown

Follow-up to #8072 (Require signed packages from the Omarchy repository). Two repositories in the tree still accept unauthenticated packages as root; this closes what can be closed Omarchy-side and arms the rest.

1. install/hardware/pacman.sh — the T2 stanza disables verification outright

[arch-mact2]
Server = https://github.com/NoaHimesaka1873/arch-mact2-mirror/releases/download/release
SigLevel = Never

SigLevel = Never means pacman performs no package authentication at all for the life of the install: any compromise of the arch-mact2 repository, the NoaHimesaka1873 account, or GitHub's release delivery path is root code execution on every T2 machine, through routine unattended pacman -Syu transactions. The repo ships the T2 kernel (linux-t2), firmware, and fan daemon, all executed or loaded at boot.

This differs from the #8072 finding in one important way: upstream cannot enforce signatures today. Verified against the live repository:

  • none of the ~40 packages in arch-mact2.db carries a %PGPSIG% entry except apple-bcm-wifi-firmware;
  • standalone .sig sidecars 404 for every package checked;
  • arch-mact2.db.sig exists but is stale — it verifies as BAD (signed 2022-02-26, key 8BE1FEE1 4302 371D EF6F 910A 0E58 77AC 225D 1980, "Noa Himesaka [email protected]") against the current database.

So SigLevel = Required would refuse every T2 package and break the install. The stanza instead arms verification as far as upstream permits:

  • The pinned upstream signing key is imported and locally signed (pacman-key --recv-keys … --keyserver keyserver.ubuntu.com, then --lsign-key). A failed import refuses to enable the repository rather than silently continuing unverified — a T2 install without its kernel cannot succeed anyway, and an explicit error beats an unauthenticated stanza.
  • SigLevel = PackageOptional DatabaseNever: unsigned packages shipped today are accepted; any package that gains a signature is verified the moment it appears (a present-but-invalid signature is rejected, so a later compromise cannot strip signatures past an already-imported key); the stale database signature is skipped, which a plain Optional would find and reject.

Residual risk, stated plainly: until upstream signs its packages, this repository is accepted without authentication and origin compromise is still root on T2 machines. This PR cannot fix that; upstream signing can. Disclosed to [email protected].

2. bin/omarchy-upgrade-to-quattro — the bootstrap override outlives the keyring install

The upgrader regenerates the [omarchy] stanza with SigLevel = Optional TrustAll because the keyring package that provides trust arrives through the very repository it authenticates. #8072's migration strips that override on the next update pass — but everything the upgrader itself installs in between (hardware transition packages, the entire install_omarchy_quattro_packages set) happens unauthenticated.

New require_signed_omarchy_repo() runs immediately after install_keyrings and deletes the override line, so every later transaction in the upgrade verifies signatures like a normal post-#8072 machine. If the keyring failed to install, the override is left in place and the machine keeps working — the log says why.

Tests

New test/shell.d/t2-repo-signature-test.sh:

  • tree-wide guard: no repository stanza anywhere in install/, default/, bin/ sets SigLevel = Never;
  • behavioral, with mocked lspci (T2 PCI ids) and pacman-key (arg-validating: only the pinned fingerprint is accepted): stanza written with the armed policy, key imported from the keyserver and locally signed, write is idempotent on a second run;
  • failure path: a pacman-key that fails leaves no stanza and exits non-zero;
  • quattro guards: the override is still written (bootstrap), the removal step exists, and it runs on the line immediately after install_keyrings.

upgrade-to-quattro-test.sh passes unchanged (22/22). All touched scripts pass bash -n.

Notes for reviewers

  • The behavioral test reaches the install script through OMARCHY_T2_PACMAN_CONF, a one-variable seam so the test never touches the real /etc/pacman.conf; the variable is unset on real installs and the script writes /etc/pacman.conf exactly as before.
  • The stanza keeps a plain heredoc; no shell expansion enters the config file.
  • Key fingerprint source: fetched from keyserver.ubuntu.com and cross-checked against the arch-mact2.db.sig issuer keyid; the t2linux wiki documents the same identity.

… override window

The t2linux repository stanza written for Apple T2 Macs sets
SigLevel = Never, which disables package authentication entirely for the
life of the install: a compromise of the arch-mact2 repository or its
delivery path is root code execution through routine pacman
transactions. Upstream cannot enforce signatures today -- no package in
the repository carries one and the published database signature is
stale (it verifies as BAD) -- so flipping to Required would refuse
every package and break T2 installs.

The stanza now arms verification as far as upstream allows:

- the pinned t2linux signing key (8BE1 FEE1 4302 371D EF6F
  910A 0E58 77AC 225D 1980) is imported and locally signed, and a
  failed import refuses to enable the repository instead of falling
  back to an unauthenticated stanza;
- SigLevel = PackageOptional DatabaseNever accepts the unsigned
  packages shipped today, verifies any package that gains a signature
  the moment upstream starts signing (rejecting present-but-invalid
  ones), and skips the stale database signature that a plain Optional
  would find and reject.

A behavioral test drives the script with a mocked lspci and pacman-key:
it asserts the stanza is written with the armed policy, that the pinned
fingerprint is the only key accepted, that the write is idempotent, and
that a failed key import leaves no stanza behind. A tree-wide guard
asserts no repository stanza disables verification outright.

bin/omarchy-upgrade-to-quattro regenerates the [omarchy] stanza with
SigLevel = Optional TrustAll because the keyring package that provides
trust arrives through the very repository it authenticates. That
override now serves only the keyring bootstrap: require_signed_omarchy_repo
runs immediately after install_keyrings and deletes the override line,
so every later transaction in the upgrade verifies signatures like a
post-omacom#8072 machine. If the keyring failed to install, the override is
left in place and the machine keeps working; the upgrade log says so.
Copilot AI balanced review requested due to automatic review settings August 28, 2026 02:56

Copilot AI 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.

Pull request overview

Hardens package verification for T2 systems and the Quattro upgrade path.

Changes:

  • Imports and trusts the pinned T2 signing key.
  • Enables optional T2 package-signature verification.
  • Removes Quattro’s unsigned bootstrap override after keyring installation.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
install/hardware/pacman.sh Arms T2 package verification and imports its signing key.
bin/omarchy-upgrade-to-quattro Restores signed Omarchy repository enforcement after bootstrap.
test/shell.d/t2-repo-signature-test.sh Adds signature-policy and upgrade-ordering checks.
Suppressed comments (1)

install/hardware/pacman.sh:29

  • This guard leaves the vulnerable policy unchanged on existing T2 installations: their config already contains [arch-mact2], so the key import and SigLevel replacement are both skipped. Normal updates run migrations (bin/omarchy-update:48), not the hardware installer, and even a manual hardware reapply takes this branch. Add a migration/reconciliation path that imports and locally signs the pinned key before replacing the old SigLevel = Never entry.
  if ! grep -q '^\[arch-mact2\]' "$t2_pacman_conf"; then

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread install/hardware/pacman.sh Outdated
Comment on lines +10 to +14
# - PackageOptional verifies any package that carries a signature the moment
# upstream starts signing, while still accepting the unsigned packages
# shipped today. A present-but-invalid signature is rejected, so a later
# compromise cannot rely on swapping signatures past an already-imported
# key.
Copilot review follow-ups:

1. Existing T2 machines already carry [arch-mact2] with SigLevel = Never,
   and the original guard skipped any config that already had the stanza,
   so the whole installed base kept the unverified policy. pacman.sh now
   reconciles in place: when the stanza exists with SigLevel = Never, the
   pinned key is imported and locally signed and the line is upgraded to
   the armed policy. A failed import there is non-fatal -- packages are
   unsigned either way, so the machine keeps working and a later retry
   can succeed; the fresh-install path still fails closed because an
   install without its kernel cannot proceed anyway.

2. Normal updates run migrations, not the hardware installer, so a
   migration (migrations/1787720000.sh) performs the same gated
   reconciliation for the installed base. Self-detecting and idempotent:
   it only acts when the stanza exists AND still says Never, and it
   leaves the machine untouched when the key import fails.

3. The comment on PackageOptional now states exactly what it guarantees:
   a present-but-invalid signature is rejected, but signature stripping
   is only excluded once upstream signs consistently and the policy
   tightens to PackageRequired.

Tests extended: legacy-stanza reconciliation (in-place upgrade, no
duplicate stanza, key imported and signed), failed-reconciliation
non-fatality, migration guards (pinned fingerprint, keyserver, lsign,
armed policy, Never-gated mutation).
@rmacy

rmacy commented Aug 28, 2026

Copy link
Copy Markdown
Author

Addressed both review comments in 5b09c4e:

1. Signature-stripping caveat (line 14) — correct. PackageOptional rejects a present-but-invalid signature; it does not stop a compromised repository from simply not publishing signatures. The comment now states the guarantee precisely (present-but-invalid rejected; stripping excluded only once upstream signs consistently and the policy tightens to PackageRequired). The honest bottom line is unchanged and stated in the PR body: until upstream signs, this repository is accepted without authentication.

2. Existing T2 installs skipped by the stanza guard (line 29) — real defect, and the more important of the two: every T2 machine installed before this change already carries [arch-mact2] with SigLevel = Never, and normal updates run migrations rather than the hardware installer, so the original version only fixed fresh installs. Now:

  • install/hardware/pacman.sh reconciles in place: if the stanza exists with SigLevel = Never, the pinned key is imported/locally signed and the line is upgraded to PackageOptional DatabaseNever. A failed import there is non-fatal (packages are unsigned either way, so the machine keeps working and a later retry can succeed) — asymmetric with the fresh-install path, which still fails closed because an install without its kernel cannot proceed anyway.
  • New migrations/1787720000.sh performs the same gated reconciliation for the installed base via the normal update path. Self-detecting and idempotent: it acts only when the stanza exists AND still says Never, and touches nothing when the key import fails.

Tests extended to cover both: legacy-stanza reconciliation (in-place upgrade, no duplicate stanza, key imported and signed), reconciliation failure non-fatality, and migration guards (pinned fingerprint, keyserver, lsign, armed policy, Never-gated mutation). Full suite green; upgrade-to-quattro-test.sh 22/22 unchanged.

@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed at 5b09c4e against quattro (c05d901). Both problems are real on the base: the T2 stanza is written with SigLevel = Never, and the quattro upgrader installs everything after install_keyrings under Optional TrustAll. The upgrader half looks right to me: the quattro [omarchy] repository serves a .sig for its packages, and a stock install already trusts it with no override. The T2 half has two defects that need changing before it can land.

What ran, on a disposable Omarchy worker: ./test/cli (116 ok), t2-repo-signature-test.sh (8/8) and upgrade-to-quattro-test.sh (22/22), all green. I also ran install/hardware/pacman.sh from the base and from the head with lspci reporting a T2 bridge, against both configs it meets during an ISO install (the ISO's offline pacman.conf from install/hardware/all.sh, then the restored default/pacman/pacman-stable.conf from install/post-install/pacman.sh), once with the network cut off (unshare -n) and once online. Online, the armed policy works against the live repository: the key imports as "Noa Himesaka [email protected]", pacman -Sy and pacman -Sw arch-mact2/t2fanrd pass integrity checks, and all 76 packages in arch-mact2.db currently 404 on their .sig, which matches the description.

1. A T2 install without network now fails (install/hardware/pacman.sh:43-45). The comment says a T2 install without its kernel cannot succeed anyway, but linux-t2 comes from install/omarchy-other.packages via the ISO's offline mirror, not from arch-mact2. The stanza is only for later updates. With no network, or with keyserver.ubuntu.com unreachable, the post-install pass exits 1 where the base exits 0. omarchy-apply-system runs under set -euo pipefail, so the install stops there and udev.sh and localdb.sh never run. Today the key verifies nothing, because no package carries a signature, so failing the install over it costs T2 users an install and buys no protection yet.

2. The reconciliation is not scoped to [arch-mact2] (install/hardware/pacman.sh:35,38, migrations/1787720000.sh:10,17). grep '^SigLevel = Never$' and the sed match that line in any stanza. During install/hardware/all.sh the config is the ISO's, whose [offline] repository is SigLevel = Never. On the head that branch fires: online it rewrites [offline] to PackageOptional DatabaseNever and adds no [arch-mact2] stanza; offline it prints the warning and also adds none. On an installed machine the migration likewise rewrites a user's own repository that says SigLevel = Never, as long as [arch-mact2] is present anywhere. The match and the edit both need to sit inside the [arch-mact2] block, the way the upgrader's sed '/^\[omarchy\]/,/^\[/{...}' does.

Smaller: the migration's comment says a failed import can be picked up by "a later migration retry", but omarchy-migrate records a migration as done once it exits 0, so a T2 machine that is offline when it runs stays at Never for good. The new tests mock pacman-key as always succeeding on the post-install path and only grep the upgrader, so they would not catch either defect above.

How much the T2 half is worth while upstream signs nothing is a call for the maintainer. The upgrader half could stand alone as its own pull request.

Second opinion: none. The configured reviewer (Codex Medium) answered its availability check, but omabot's daily review budget was spent, so this review is one model's reasoning (Claude Opus 5.5). Nothing was pushed to the branch: how the fresh-install path should behave when the key cannot be fetched is a design choice, so it is left to you. Waiting on the author for the two fixes above.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants