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:
@@ -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"):
|
||||
|
||||
Reference in New Issue
Block a user