diff --git a/src/update/keys.rs b/src/update/keys.rs index 207fe7b..0f0be85 100644 --- a/src/update/keys.rs +++ b/src/update/keys.rs @@ -9,14 +9,14 @@ use super::UpdateError; /// Public half of the release signing key, embedded in the binary. /// -/// This is a PLACEHOLDER (all zeros). While it is unchanged the updater refuses to run -/// ([`is_placeholder`]), so a build without a real key can never accept an update. -/// -/// To replace it: generate an Ed25519 key pair offline, keep the secret key only in the CI -/// secret store (`manifest.json.sig` is produced from it), and paste the 32 byte public key -/// here. Rotating the key requires shipping a release signed with the old key that embeds the new -/// one. -pub const RELEASE_PUBLIC_KEY: [u8; 32] = [0u8; 32]; +/// The matching secret key lives only in the CI secret `VNOX_RELEASE_SIGNING_KEY` +/// (`manifest.json.sig` is produced from it). An all-zero value is treated as an unconfigured +/// placeholder and the updater refuses to run ([`is_placeholder`]). Rotating the key requires +/// shipping a release signed with the old key that embeds the new one. +pub const RELEASE_PUBLIC_KEY: [u8; 32] = [ + 0x7e, 0xd5, 0x38, 0x8c, 0xff, 0x33, 0xa2, 0xaf, 0x13, 0x52, 0xc2, 0x67, 0xef, 0x84, 0x2f, 0xe0, + 0xac, 0x37, 0x13, 0x42, 0xb7, 0x6b, 0xba, 0x4c, 0x0b, 0x7c, 0x41, 0xaf, 0x11, 0x4c, 0x95, 0x4c, +]; /// Second public key accepted during a key rotation, `None` otherwise. A release that embeds both /// keys is signed with the old one; the next releases are signed with the new one. @@ -159,16 +159,17 @@ mod tests { verify_any(&[old, public()], msg, &sign(msg)).unwrap(); assert!(verify_any(&[old], msg, &sign(msg)).is_err()); assert!(matches!( - verify_any(&[RELEASE_PUBLIC_KEY], msg, &sign(msg)), + verify_any(&[[0u8; 32]], msg, &sign(msg)), Err(UpdateError::NoReleaseKey) )); } #[test] fn placeholder_key_never_verifies() { - assert!(is_placeholder(&RELEASE_PUBLIC_KEY)); + assert!(is_placeholder(&[0u8; 32])); + assert!(!is_placeholder(&RELEASE_PUBLIC_KEY)); assert!(matches!( - verify(&RELEASE_PUBLIC_KEY, b"m", &sign(b"m")), + verify(&[0u8; 32], b"m", &sign(b"m")), Err(UpdateError::NoReleaseKey) )); } diff --git a/src/update/manager_tests.rs b/src/update/manager_tests.rs index 3a93303..ab3d2cb 100644 --- a/src/update/manager_tests.rs +++ b/src/update/manager_tests.rs @@ -181,7 +181,7 @@ async fn placeholder_key_disables_updates() { let fx = Fixture::new().await; fx.publish_good("0.2.0"); let mut cfg = fx.config(); - cfg.public_keys = keys::production_keys(); + cfg.public_keys = vec![[0u8; 32]]; let manager = UpdateManager::new(cfg, None, fx.dir.path().join("u.json")); assert!(matches!( manager.check().await,