Sign the app update feed with Ed25519 and verify it in the app

Each installation generates a private Ed25519 key once (0600, under
~/.config/pipelines), signs version.json with a detached version.json.sig
when publishing APK and desktop builds, and embeds its own and listed
trusted public keys in app builds. The app verifies the feed signature
before trusting the artifact sha256, refuses unsigned or foreign feeds when
it has keys, and requires the sha256 and Android signer in signed feeds.
This commit is contained in:
2026-11-10 00:51:16 +00:00
parent a706739088
commit 9f38e38f6a
17 changed files with 1010 additions and 26 deletions
+5
View File
@@ -83,6 +83,11 @@ class AppBuildTests(unittest.TestCase):
feed = json.loads((updates / "version.json").read_text())
self.assertEqual(feed["signingCertificateSha256"], "ab" * 32)
self.assertEqual(feed["sha256"], app_build.hashlib.sha256((updates / "pipelines.apk").read_bytes()).hexdigest())
# Signed with the installation key generated (0600) in the scratch home.
key = Path(self.home.name) / ".config/pipelines/update-signing-key.pem"
self.assertEqual(key.stat().st_mode & 0o777, 0o600)
signature = json.loads((updates / "version.json.sig").read_text())
self.assertEqual(signature["publicKey"], app_build.update_signing.public_key(key))
(output / "signing-certificate-sha256.txt").write_text("invalid")
with patch.object(app_build, "load_manifest", return_value=manifest), patch.object(app_build, "build", return_value=output):
with self.assertRaisesRegex(ValueError, "exactly one"):