Skip to content

docs/security: Correct OTA verification and rollback claims to match avocadoctl - #563

Open
jetm wants to merge 4 commits into
mainfrom
docs-ota-update-verification
Open

jetm wants to merge 4 commits into
mainfrom
docs-ota-update-verification

Conversation

@jetm

@jetm jetm commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Problem

The atomic update page says every device rolls back automatically, that the bootloader tracks boot attempts, that signatures are validated before write, that each boot slot holds the bootloader and device tree, and that Avocado supports delta compression and power-loss detection. The shipped code contradicts or does not implement each of these. Someone planning around the page would rely on protections that are not there, most visibly on Jetson (no device tree or bootloader in the slot, no attempt counter) and with stream_os_to_partition enabled.

What changed

  • atomic-update-architecture.md: rewritten around what the code does.
    • The update flow ends in a post-boot AVOCADO_OS_BUILD_ID check run by avocadoctl, with per-board activate, commit and rollback actions.
    • A "What is verified" table covers metadata signatures, per-target hashes and bundle.json hashes, default vs stream_os_to_partition. It states that bundle.json is unsigned, expires is never read, and metadata versions are not compared.
    • The rollback section says what triggers it, what does not, and that attempt counting exists only where the board's bootloader environment implements it. Some boards ship no rollback actions.
    • A per-board table of what an OS update writes (Jetson: rootfs and boot only).
    • The delta compression and power-loss claims are replaced with what is implemented.
  • sideloading.md: new "What the device checks" subsection.
  • seeding-var.md: an OS update does not write the var partition, and avocadoctl does not copy var_files.
  • features.md: the "Safe OTA with Automatic Rollback" text and the "No bricked devices" callout now say rollback is the post-boot AVOCADO_OS_BUILD_ID check, that attempt counting depends on the board's bootloader, that some boards ship no rollback actions, and that Jetson recovery from a slot that fails to boot depends on NVIDIA firmware. Links to the architecture page.
  • filesystem-integrity.md: the dm-verity failure step no longer says reboot falls back to the previous slot; avocadoctl rolls back only on a failed post-boot build-id check (sole caller src/commands/ext.rs:524, rollback at src/os_update.rs:573).
  • update-process.md: "Streaming Mode" states the OS bundle is not compared to the signed targets hash, is verified only by the unsigned bundle.json hashes, and that streaming is off by default (src/update.rs:303-305, :574-592; src/config.rs:42).

stream_os_to_partition is off by default, so the default path is verified against the signed targets hashes. The page says so.

Verified

  • prettier --check on all six touched files: exit 0.
  • npm --prefix src run build from origin/main e3e0712: exit 0.
  • Every claim checked against avocadoctl main (d6e82f3). Only CONTRIBUTING.md differs from v0.15.0, so these citations hold for the release.
  • Stone manifests read on meta-avocado wrynose (2bdaf34) for os_artifacts, commit and rollback.

Citations (avocadoctl v0.15.0):

  • Trust anchor and refusal without it: src/update.rs:89-90. Signature checks before any download: :107-153; ed25519 only: :1107-1109.
  • Per-target SHA-256 and length: :649, :680-717.
  • Streaming skips staging the bundle: :303-305, piped to apply_os_update_streaming: :574-592. Default off: src/config.rs:42.
  • Streamed artifacts hashed while written: src/os_update.rs:2717-2750. bundle.json carries no signature: :2856-2885.
  • expires is read nowhere in the verification code: git grep -i expires -- src hits only test fixtures and display-only fields.
  • No remote-vs-local metadata version comparison in perform_update (src/update.rs:69-300).
  • Pending marker, commit and rollback: src/os_update.rs:321, :534, :573. Post-boot check and reboot into the previous slot: src/commands/ext.rs:407-560.
  • No var_files, delta, power-loss, bootcount or mark-boot-successful handling: git grep -n -i 'var_files\|delta\|power.loss\|bootcount\|boot_tries\|mark-boot-successful' origin/main -- src returns no code hits.
  • Jetson manifests: meta-avocado-nvidia/stone/stone-jetson-agx-orin.json:13-33. Attempt counter: stone-nanopi-r5s.json, stone-rzv2n-sr-som.json:21.

Not verified

  • Nothing was run on a device.
  • What Jetson boot firmware does when a new slot fails to boot. The page says it is NVIDIA firmware behavior.
  • Which key signs avocado deploy, how root.json reaches a device, and Connect-side behavior. The sideloading section says only what the device checks.
  • The code reading has not been reviewed by the avocadoctl maintainers.
  • filesystem-integrity.md still says dm-verity failure can trigger a reboot into a recovery partition; no such code exists in avocadoctl and the claim was not part of this change.

jetm added 2 commits November 25, 2026 11:41
…doctl

The atomic update page promised automatic rollback on every device,
bootloader attempt counting, signatures validated before write, a
bootloader and device tree in each boot slot, delta compression and
power-loss detection. avocadoctl does none of the last two, verifies
streamed OS bundles only against the unsigned bundle.json, never reads
metadata expiry, and does not compare metadata versions. An integrator
planning a fleet around the old text would rely on protections that
are not in the code.

Rollback is a post-boot AVOCADO_OS_BUILD_ID check driven by per-board
manifest actions, and attempt counting exists only where a board's
bootloader environment implements it. Jetson manifests write only the
rootfs and boot kernel partitions. The pages now state each of these
as current behavior so an integrator can decide what to rely on.
…ture

The features overview promised that automatic rollback restores a
known-good state and that devices are never bricked, the filesystem
integrity page said a dm-verity failure falls back to the previous
slot on reboot, and the OS bundle page described streaming without
mentioning what it gives up. After the architecture page was
corrected, these three contradicted it and the code: avocadoctl rolls
back only from its post-boot build-id check, and streaming skips the
signed targets hash for the OS bundle.

Each page now states that trigger or that gap and links to the
architecture page instead of repeating its tables, so there is one
place to keep current.

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.

🟡 Changes recommended

The documentation overstates streaming artifact authentication and power-loss guarantees and omits initramfs verification from update success and rollback conditions.

3 open issues
What changed in this PR

This documentation-only PR aligns OTA verification and rollback guidance with avocadoctl behavior, replacing broad safety guarantees with update-path and board-specific limitations.

Changes:

  • Describes staged versus streaming verification, metadata limitations, and post-boot rollback checks.
  • Clarifies board-specific update artifacts and recovery behavior, removing unsupported delta-update and power-loss claims.
  • Updates related guides to explain sideload verification and provisioning-only var_files seeding.
File Description
src/​docs-overview/​security/​filesystem-integrity.md Separates dm-verity failures from post-update rollback.
src/​docs-overview/​security/​atomic-update-architecture.md Rewrites verification, rollback, board artifacts, and power-loss guidance.
src/​docs-overview/​features.md Qualifies OTA safety and automatic rollback claims.
src/​docs-guides/​sideloading.md Adds device-side verification checks and limitations.
src/​docs-guides/​seeding-var.md Clarifies var preservation and provisioning-only seeding.
src/​docs-guides/​avocadoctl/​os-bundles/​update-process.md Documents streaming verification limitations and its disabled default.

Review effort: Balanced

The update architecture page described one set of board artifacts and
one attempt-counter example as if they held everywhere, but the 2024
(scarthgap) and 2026 (wrynose) meta-avocado manifests differ: 2024
writes no imx_boot, rootfs_hash or UKIs, several boards have no update
section at all and avocadoctl refuses their OS bundle, and the
bootloader fallback comes from three different mechanisms depending on
board and release. The post-boot check also omitted the initramfs
verification that avocadoctl runs, and named a field that does not
exist. The streaming paragraph called unsigned bundle.json hashes
authentication, and the power-loss list claimed a temporary file for
a path that has none.

The artifact table now has one column per release, a no-OS-update
note, and the rollback section names the U-Boot counter, systemd-boot
boot counting and one-shot BootNext with the boards that use each. The
two summary pages follow the same wording.
Copilot AI balanced review requested due to automatic review settings November 25, 2026 22:08
@jetm
jetm requested a review from lee-reinhardt November 25, 2026 22:10

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.

🟡 Changes recommended

The security documentation conflates the signed bundle filename with the caller-controlled download origin and overstates power-cut safety by omitting the UEFI boot-order exception during streaming writes.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Low severity Clarify that metadata does not authenticate the artifact download origin

src/​docs-overview/​security/​atomic-update-architecture.md:82

Signed metadata supplies the bundle filename, not its complete URL: the filename is derived from image_id, while the update API accepts a caller-supplied artifacts_url. Please distinguish the signed filename from the caller-controlled repository/artifact base URL so this security explanation does not imply that metadata authenticates the download origin.

3 resolved since last review

Review effort: Balanced

lee-reinhardt
lee-reinhardt previously approved these changes Nov 25, 2026
…it action

The BootNext bullet said commit moves the new slot to the head of
BootOrder as if every efibootmgr board defined a commit action. The
Intel x86-64 manifests on scarthgap and the QEMU x86-64 manifest on
wrynose define none, and avocadoctl writes BootOrder only from a commit
action, so nothing writes it on those boards.

State the condition and name the two sets of manifests that define no
commit action, without saying what a reboot does there: that behavior
has been read in the source and not run on a board.

Signed-off-by: Javier Tia <javier@peridio.com>
@jetm
jetm dismissed lee-reinhardt’s stale review November 25, 2026 23:33

Dismissed because the head is changing to address your open thread at atomic-update-architecture.md:93. Please re-approve on the new head.

@jetm
jetm requested review from lee-reinhardt and a balanced review from Copilot November 25, 2026 23:35

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.

🔵 Needs a closer look

Human review is needed to assess the documentation’s reboot claim against the exception for bundles without rollback actions, where devices remain on the failed slot.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

This branch has not been deployed

No deployments
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.

3 participants