Skip to content

fix(os-ota): guard os-pilot against cross-key release-keys publication (#2391) - #2399

Draft
NubsCarson wants to merge 1 commit into
developfrom
fix/os-pilot-cross-key-ota-guard
Draft

NubsCarson wants to merge 1 commit into
developfrom
fix/os-pilot-cross-key-ota-guard

Conversation

@NubsCarson

Copy link
Copy Markdown
Collaborator

Summary

Prevents user/release-keys OS OTAs from overwriting the live os-pilot channel while Nov 18 userdebug/test-keys pilot phones remain enrolled on it, and enables publishing user/release-keys OTAs to a dedicated os-* channel tag (such as os-stable). Addresses #2391 (context: #672, #673).

Changes

  • Live-pointer cross-key guard (apps/app/scripts/release.ts):
    • Added osBuildVariant(fingerprint) and isCompatibleOsBuildTransition(live, candidate) parsing the 3-segment Android Build.FINGERPRINT (<brand>/<product>/<device>:<release>/<id>/<incremental>:<type>/<tags>) and refusing any cross-type or cross-key transition (such as userdebug/test-keys <-> user/release-keys).
    • Updated readOsPointer and publishOsRelease to inspect the live alpha-os-update.json buildFingerprint (failing closed if missing or incompatible) before uploading any archive or mutating the channel manifest or ledger.
  • Pilot enrollment guard and multi-channel os-* tag support (apps/app/scripts/release.ts, .github/workflows/release-os-ota-publish.yml, packages/cli/src/commands/pixel-bundle.ts):
    • Added osChannelTagValid (^os-[A-Za-z0-9][A-Za-z0-9._-]{0,124}$), createGithubOsChannel(tag), tag-aware osKept(url, asset, tag), and --tag support across os-manifest, os-publish, os-status, publishOsRelease, and checkOsChannelStatus.
    • Added assertOsChannelEnrollmentCompatible and os-publish --enrollment FILE so publishing a user/release-keys candidate onto os-pilot is refused whenever aosp/pilot-system-update-enrollment.json pins os-pilot to userdebug/test-keys with rotatePlatformOrAVBKeys: false (even if live alpha-os-update.json is temporarily absent), while permitting user/release-keys publication to a dedicated production tag such as os-stable.
    • Added optional channel_tag input (default os-pilot) and --enrollment aosp/pilot-system-update-enrollment.json to .github/workflows/release-os-ota-publish.yml, while preserving all ota doctor invariants.
    • Updated packages/cli/src/commands/pixel-bundle.ts to validate and extract any os-* channel tag from manifest.url instead of hardcoding os-pilot.
  • Unit tests (apps/app/test/os-ota-guard.test.ts, packages/cli/test/pixel-bundle-channel.test.ts):
    • Added dedicated unit tests covering fingerprint parsing, bidirectional cross-key refusal, fail-closed missing-fingerprint refusal, same-key os-pilot updates, dedicated os-stable publication and status verification, CLI --enrollment / --tag refusal, workflow contract assertions, and pixel-bundle os-* tag validation.

Companion elizaOS/eliza On-Device Guard Note

ai.eliza.systemupdater.PackageVerifier lives in elizaOS/eliza at packages/os/aosp/system-updater/src/ai/eliza/systemupdater/PackageVerifier.java (lines 64-71), not in this repository. That verifier checks ota-type=AB, pre-device, post-build, productOf(expectedFingerprint), ota-wipe, ota-downgrade, pre-build (incremental), post-timestamp, and post-security-patch-level, but does not compare the build-type/signing-keys suffix (:user/release-keys vs :userdebug/test-keys) against Build.FINGERPRINT. A companion elizaOS/eliza PR adds that on-device PackageVerifier.java check so both publish-time and device-side defenses are enforced independently.

Verification

  • pnpm --filter @repo/app exec vitest run test/os-ota-guard.test.ts test/image.test.ts: 2/2 files PASS (os-ota-guard.test.ts 6/6 PASS, image.test.ts 33/33 PASS, 2 skipped)
  • pnpm --filter @repo/cli exec vitest run test/pixel-bundle-channel.test.ts test/cli.test.ts: 2/2 files, 32/32 tests PASS
  • pnpm exec node vibestack/spec.ts tasks @repo/app#typecheck @repo/cli#typecheck: 10/10 tasks PASS
  • NODE_OPTIONS=--max-old-space-size=4096 pnpm exec eslint --max-warnings 0 on all 4 touched/added .ts files: PASS (0 errors, 0 warnings)
  • pnpm exec jscpd --silent --exit-code 1 --threshold 0 across all 4 touched/added .ts files plus apps/app/test/image.test.ts and packages/cli/test/cli.test.ts: PASS (0 clones, 0.00%)
  • pnpm run no-bun and git diff --check: PASS

#2391)

Prevent user/release-keys OS OTAs from overwriting the live os-pilot
channel while Nov 18 userdebug/test-keys pilot phones remain enrolled
on it, and support dedicated os-* release channel tags (such as
os-stable) for user/release-keys OTAs.

- Parse 3-segment Android build fingerprints and refuse cross-key or
  cross-type transitions in publishOsRelease before uploading assets
  or moving alpha-os-update.json (failing closed on missing
  buildFingerprint).
- Add os-* channel tag validation, --tag support across os-manifest,
  os-publish, os-status, and pixel-bundle, plus --enrollment checks
  against aosp/pilot-system-update-enrollment.json.
- Wire optional channel_tag and pilot enrollment guard into
  .github/workflows/release-os-ota-publish.yml.
- Add dedicated unit tests in apps/app/test/os-ota-guard.test.ts and
  packages/cli/test/pixel-bundle-channel.test.ts.

This branch was previously deployed

1 inactive deployment
turbo-cache-read — 77413464 Deployed Dec 4, 2026 by NubsCarson via selftest-rest #1627
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.

1 participant