From e04f0a54cd9d67fb6949261698ed565a682c74bf Mon Sep 17 00:00:00 2001 From: skylar taylor-barrick Date: Mon, 23 Nov 2026 13:57:58 -0600 Subject: [PATCH] Pin the Linux release signing key for Linux Nightly installs (#1581) Linux Nightly reuses the ArtCraft Linux Release Signing Key that signs stable Linux releases, pinned by its primary fingerprint. Tests check the configured signer against a real signed PhotoCraft v0.23.1 release file. --- .gitattributes | 3 + ATTRIBUTION.md | 7 ++ .../assets/linux-release-signing-key.asc | 16 ++++ .../native/src/nightly_signing_linux_tests.rs | 74 +++++++++++++++++++ crates/native/src/nightly_trust.rs | 12 ++- .../linux-release-signed/SHA256SUMS.txt | 50 +++++++++++++ .../linux-release-signed/SHA256SUMS.txt.asc | 7 ++ docs/nightly-signing.md | 4 + 8 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 crates/native/assets/linux-release-signing-key.asc create mode 100644 crates/native/tests/fixtures/linux-release-signed/SHA256SUMS.txt create mode 100644 crates/native/tests/fixtures/linux-release-signed/SHA256SUMS.txt.asc diff --git a/.gitattributes b/.gitattributes index ac102f4a..2ec1af46 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,5 @@ # Signatures verify exact bytes; checkout must not convert signed TOML to CRLF. /crates/core/tests/fixtures/hosted-catalog.toml -text +# The real release signature fixture is checked over its exact bytes. +/crates/native/tests/fixtures/linux-release-signed/* -text +/crates/native/assets/linux-release-signing-key.asc -text diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index e3ecbee5..619d1f8f 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -76,6 +76,13 @@ licensed like those apps. Refresh them from the source path, never redraw them. | `crates/core/catalog.toml` | Bundled launcher catalog | ArtCraft Team | `storytold/artcraft-services` PR #205 | MIT OR Apache-2.0 | | `crates/core/tests/fixtures/hosted-catalog.toml.sig` | Detached catalog signature test fixture | ArtCraft Team | Signature of the bundled catalog with its pinned key | MIT OR Apache-2.0 | +## Linux release signing key + +| Path | Title | Author | Source | License | +|---|---|---|---|---| +| `crates/native/assets/linux-release-signing-key.asc` | ArtCraft Linux Release Signing Key (public part only; primary 2B76741B414AAD6CD33E631213A005C0B9D7C3ED) | ArtCraft Team | `release-signing-key.asc` published with PhotoCraft v0.23.1, supplied by Infra on 2026-11-23; same key as the `GPGKey` of getartcraft.com's artcraft-oci.flatpakrepo | MIT OR Apache-2.0 | +| `crates/native/tests/fixtures/linux-release-signed/SHA256SUMS.txt`, `SHA256SUMS.txt.asc` | Real signed release file and its detached signature, test fixture | ArtCraft Team and PhotoCraft contributors | Exact `SHA256SUMS.txt` and `SHA256SUMS.txt.asc` of the PhotoCraft v0.23.1 release, signed by the key above in the stable release workflow | MIT OR Apache-2.0 (PhotoCraft's license) | + ## External native signing test fixture (not bundled) | Manifest | Title | Author | Source and version | License and acquisition | diff --git a/crates/native/assets/linux-release-signing-key.asc b/crates/native/assets/linux-release-signing-key.asc new file mode 100644 index 00000000..a1c1f31e --- /dev/null +++ b/crates/native/assets/linux-release-signing-key.asc @@ -0,0 +1,16 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mDMEaulK1xYJKwYBBAHaRw8BAQdAqHJeDCjY6Hx5FTn/hW+aqu6V394ubLk0Zj3C +bftDwFm0IkFydENyYWZ0IExpbnV4IFJlbGVhc2UgU2lnbmluZyBLZXmIkwQTFgoA +OxYhBCt2dBtBSq1s0z5jEhOgBcC518PtBQJq6UrXAhsBBQsJCAcCAiICBhUKCQgL +AgQWAgMBAh4HAheAAAoJEBOgBcC518PtGeUA/RjvULBTLlccc+2wtJkfjSnCV+cf +PUMEGmW7XkZWkk51AP9w2A/WLv+79nREWEpZzI8LGK5EjrNazP+sY0l7j5rFCLgz +BGrpStcWCSsGAQQB2kcPAQEHQPl7XkQ1gWsvSPf/T9b4m/UHcjJjBpSOtpYlWR56 +er5RiO8EGBYKACAWIQQrdnQbQUqtbNM+YxIToAXAudfD7QUCaulK1wIbAgCBCRAT +oAXAudfD7XYgBBkWCgAdFiEEVo3B9o+Prsx5fzx7AG2va7DvM04FAmrpStcACgkQ +AG2va7DvM07taQEA4d2VFkKRIP0g9TrE86KpnuXPap+LKqe0tfIxpdf9YxIA/0Wo +9H/iG8nH++nxC087p3HE0S+0UovxqkhXJLSr8B4JDOoA/iLRpqTdYmk6fVXMyPJo +SkOVuwZIGS6VgBdSQP0e2P2YAP41L5OoSvwdQIG3/uNrM+ieqpYeM597/hCLFs5A +ga/qCA== +=3wGQ +-----END PGP PUBLIC KEY BLOCK----- diff --git a/crates/native/src/nightly_signing_linux_tests.rs b/crates/native/src/nightly_signing_linux_tests.rs index e0743baa..c781aa93 100644 --- a/crates/native/src/nightly_signing_linux_tests.rs +++ b/crates/native/src/nightly_signing_linux_tests.rs @@ -243,3 +243,77 @@ fn machine_status_never_accepts_error_multiple_signer_or_expiry_even_with_valids assert!(status(&crate::process::RunOutput::exit(1, &valid, "failure"), &pin, crate::now()).is_err()); assert!(status(&crate::process::RunOutput::success(&valid), &"B".repeat(40), crate::now()).is_err()); } + +// A real PhotoCraft v0.23.1 stable release file and its published detached signature, made by the +// production Linux release key's signing subkey. See ATTRIBUTION.md for provenance. +const RELEASE_SIGNED: &[u8] = include_bytes!("../tests/fixtures/linux-release-signed/SHA256SUMS.txt"); +const RELEASE_SIGNATURE: &[u8] = include_bytes!("../tests/fixtures/linux-release-signed/SHA256SUMS.txt.asc"); + +fn configured_signer() -> &'static LinuxSigner<'static> { + crate::nightly_trust::LINUX_SIGNER.as_ref().expect("the reviewed Linux Nightly signer is configured") +} + +#[test] +fn configured_signer_key_is_its_pinned_primary_and_refuses_other_keys() { + let signer = configured_signer(); + let root = tempfile::tempdir().unwrap(); + let home = tempfile::Builder::new().prefix("pinned-key-").tempdir_in(root.path()).unwrap(); + let pinned = home.path().join("pinned.asc"); + std::fs::write(&pinned, signer.public_key).unwrap(); + let shown = key_command(home.path(), &["--with-colons", "--show-keys", pinned.to_str().unwrap()]); + let records: Vec> = shown.lines().map(|line| line.split(':').collect()).collect(); + // Exactly one certificate, whose primary (not a subkey) is the pin, usable and not revoked or expired. + let primaries: Vec<_> = records.iter().filter(|fields| fields[0] == "pub").collect(); + assert_eq!(primaries.len(), 1, "{shown}"); + assert!(!matches!(primaries[0][1], "r" | "e" | "i" | "d"), "{shown}"); + let primary = records.iter().skip_while(|fields| fields[0] != "pub").find(|fields| fields[0] == "fpr").unwrap()[9]; + assert!(primary.eq_ignore_ascii_case(signer.primary_fingerprint), "{shown}"); + assert!(records.iter().any(|fields| matches!(fields[0], "pub" | "sub") && fields[11].contains('s')), "no signing key: {shown}"); + let paths = Paths::under(root.path()).for_channel(InstallChannel::Nightly); + let other = key(root.path(), false); + let (asset, signature, bytes, file) = signed_archive(root.path(), &other, false, &elf()); + assert!(prepare_with(&file, &asset, &signature, &bytes, &paths, signer, GPG).is_err()); +} + +fn release_fixture(root: &Path, name: &str, content: &[u8]) -> (Asset, Download, PathBuf) { + let file = root.join(name); + std::fs::write(&file, content).unwrap(); + let asset = Asset { + name: name.into(), + url: "unused exact release fixture".into(), + size: content.len() as u64, + sha256: Some(crate::http::sha256_file(&file).unwrap()), + }; + let signature = Download { + name: format!("{name}.asc"), + url: "unused exact release fixture".into(), + size: RELEASE_SIGNATURE.len() as u64, + sha256: format!("{:x}", Sha256::digest(RELEASE_SIGNATURE)), + }; + (asset, signature, file) +} + +#[test] +fn configured_signer_accepts_a_real_release_signature_only_for_its_exact_bytes_and_primary_pin() { + let signer = configured_signer(); + let root = tempfile::tempdir().unwrap(); + let paths = Paths::under(root.path()).for_channel(InstallChannel::Nightly); + let (asset, signature, file) = release_fixture(root.path(), "release-signed", RELEASE_SIGNED); + let verified = prepare_with(&file, &asset, &signature, RELEASE_SIGNATURE, &paths, signer, GPG).unwrap(); + assert_eq!(std::fs::read(&verified.file).unwrap(), RELEASE_SIGNED); + // One changed byte, even with a fresh matching checksum, does not borrow the real signature. + let mut changed = RELEASE_SIGNED.to_vec(); + changed[0] ^= 1; + let (asset, signature, file) = release_fixture(root.path(), "release-changed", &changed); + assert!(prepare_with(&file, &asset, &signature, RELEASE_SIGNATURE, &paths, signer, GPG).is_err()); + // The pin is the primary identity: pinning the signing subkey that made the signature refuses. + let home = tempfile::Builder::new().prefix("pinned-key-").tempdir_in(root.path()).unwrap(); + let pinned = home.path().join("pinned.asc"); + std::fs::write(&pinned, signer.public_key).unwrap(); + let shown = key_command(home.path(), &["--with-colons", "--show-keys", pinned.to_str().unwrap()]); + let subkey = shown.lines().skip_while(|line| !line.starts_with("sub:")).find(|line| line.starts_with("fpr:")).unwrap().split(':').nth(9).unwrap(); + assert!(!subkey.eq_ignore_ascii_case(signer.primary_fingerprint)); + let subkey_pin = LinuxSigner { public_key: signer.public_key, primary_fingerprint: subkey }; + let (asset, signature, file) = release_fixture(root.path(), "release-subkey-pin", RELEASE_SIGNED); + assert!(prepare_with(&file, &asset, &signature, RELEASE_SIGNATURE, &paths, &subkey_pin, GPG).is_err()); +} diff --git a/crates/native/src/nightly_trust.rs b/crates/native/src/nightly_trust.rs index abdf400c..4f47b87d 100644 --- a/crates/native/src/nightly_trust.rs +++ b/crates/native/src/nightly_trust.rs @@ -7,8 +7,18 @@ pub(crate) struct LinuxSigner<'a> { pub primary_fingerprint: &'a str, } +/// The ArtCraft Linux Release Signing Key, the same key that signs stable Linux releases' `.asc` +/// files (craft-common-actions' shared release workflow, `sign-linux.sh`) and the ArtCraft OCI +/// Flatpak images. Provenance: Infra supplied `release-signing-key.asc` as published with +/// PhotoCraft v0.23.1 (listed in that release's signed `SHA256SUMS.txt`) and the primary +/// fingerprint below, on 2026-11-23; it matches the `GPGKey` in getartcraft.com's +/// artcraft-oci.flatpakrepo. Signatures come from its signing subkey +/// 568DC1F68F8FAECC797F3C7B006DAF6BB0EF334E; the pin is the primary, as `VALIDSIG` reports it. #[cfg(target_os = "linux")] -pub(crate) const LINUX_SIGNER: Option> = None; +pub(crate) const LINUX_SIGNER: Option> = Some(LinuxSigner { + public_key: include_str!("../assets/linux-release-signing-key.asc"), + primary_fingerprint: "2B76741B414AAD6CD33E631213A005C0B9D7C3ED", +}); /// A Windows publisher, by what stays the same when its certificate renews. Subjects are exact /// native `X509Certificate2.Subject` strings, case-sensitive, not display CNs. No leaf key, diff --git a/crates/native/tests/fixtures/linux-release-signed/SHA256SUMS.txt b/crates/native/tests/fixtures/linux-release-signed/SHA256SUMS.txt new file mode 100644 index 00000000..ee5eca72 --- /dev/null +++ b/crates/native/tests/fixtures/linux-release-signed/SHA256SUMS.txt @@ -0,0 +1,50 @@ +4eb051274dd320dee65cbba8c0337ac02571fedbcbd242385cc96fe30e94bfc4 photocraft-0.23.1-freebsd-aarch64.tar.gz +75ab8fd294fb82b88d36e48e237297f07bb410a3004206adeca71118ad5b2eeb photocraft-0.23.1-freebsd-x86_64.tar.gz +e43d4debbe66cf0ea27626097f2756848176a5540a3de59252c85dd3c7698246 photocraft-0.23.1-linux-aarch64.AppImage +3cc051c0ceb53214f8d597d29b7ee4a633ab16bfc0bc4222d25e252aa9361c27 photocraft-0.23.1-linux-aarch64.AppImage.asc +2efbd42dec446b8bab9791d5c20716d270de89ec50fa96447ba4364621ba51c5 photocraft-0.23.1-linux-aarch64.AppImage.zsync +1edd7e6c1ae2c087ee6b7a99bcdd25665e48dc80c0ab771cc23eb380603b8982 photocraft-0.23.1-linux-aarch64.AppImage.zsync.asc +ee297409f1efc0a0b648eb0b44b0c879e3cc5408dc149ffda1e630a5a204f388 photocraft-0.23.1-linux-aarch64.deb +16092c9f98bbea70c1b3ede200765396b5302544822104af9ee9a160a695e80f photocraft-0.23.1-linux-aarch64.deb.asc +0f1ac08924c876b86e093ada9e8693f95b55be613d5ee7896d4d3d72c5d66786 photocraft-0.23.1-linux-aarch64.flatpak +6bf5a56226a1790cfb84aa99bae80d1af9dcb2126fdbe7e6cc5190fc29a04427 photocraft-0.23.1-linux-aarch64.flatpak.asc +b6e98ea0be894bbd2c9a35acbed1a6aa2cbc87294f9f9cc1010efad4bdbda93c photocraft-0.23.1-linux-aarch64.oci-manifest.json +021d76288734aeb0d189f454a222401c0b905b7d67b076e5ca29ea9827728a3f photocraft-0.23.1-linux-aarch64.oci.sig +3acff2bd3c7e815496d505fb463f540ea3124557a32fbbaeb13942cc80e900f8 photocraft-0.23.1-linux-aarch64.pkg.tar.zst +30216a0bceb0d98da40e09475dadf7531c8208686d359ee570299bc7ca04a6e8 photocraft-0.23.1-linux-aarch64.pkg.tar.zst.sig +10349d21e52c62cd847a6992c306f123913beeaf25217c9b817a038f96734716 photocraft-0.23.1-linux-aarch64.rpm +44bce8a6ab3d7b7ec7034124ca4e090c7f300b6c585dc83104caf16d73689fcf photocraft-0.23.1-linux-aarch64.rpm.asc +fcc81c38ae62c72fa9f4fd1ec3d18396493ba261662792d6995cc35905ce71d2 photocraft-0.23.1-linux-aarch64.tar.gz +5a6204e045b334c8531fa3ab15cd5db08e13f980c8ca6df5203f4e65404aeb68 photocraft-0.23.1-linux-aarch64.tar.gz.asc +b3adf0584865cd8722bd0c48f30273f38ab4234f6326ee1aff17e18e883b7a62 photocraft-0.23.1-linux-riscv64.deb +5f3e072b1fd9c440904ac95da8c1f6b21a7277978cd8d003edf275d433cf6123 photocraft-0.23.1-linux-riscv64.deb.asc +2df8f0eeb540634bb26f64382e35a547417080d8e360c57b398ac270f652ff57 photocraft-0.23.1-linux-riscv64.rpm +76f367ca86ab10c813b1293329186db4afb35eac42621adb102c4b2c31fbc4ce photocraft-0.23.1-linux-riscv64.rpm.asc +35e370e3672631d8e73930cc66916009c95d084b6e877866a161c70e0dc77d79 photocraft-0.23.1-linux-riscv64.tar.gz +5a35cd6af78342493edb768738bbbeff9ead53a1e18ea511c6fe344b2c9a5ade photocraft-0.23.1-linux-riscv64.tar.gz.asc +05747b3e527e1e0a0c1de39970361cf38c8fca7e8d3e3601ef2082fb0e6dd17f photocraft-0.23.1-linux-x86_64.AppImage +4fda29f0c784094c89e3d8ddb8cc319cb5bdd4d8af9f9302ad9f793713b93425 photocraft-0.23.1-linux-x86_64.AppImage.asc +58898af5629e782298045a83a74b9b5801806f17f3300a04dcd42db88f937d15 photocraft-0.23.1-linux-x86_64.AppImage.zsync +a57e518992327e5b62e56a0b15e656996cc23443652c2740b013558b7afb8d45 photocraft-0.23.1-linux-x86_64.AppImage.zsync.asc +baabdcdbe46df2f72ccf6ecc2e98be00fbc33dbd4c1cd9426362a89a4b95f673 photocraft-0.23.1-linux-x86_64.deb +88e96d6b732d1863b0e63668bf1ededdaae8ed7cfb6ab4f751fbb3e44acdb5ea photocraft-0.23.1-linux-x86_64.deb.asc +5c9deb58f07bd54f323a5d985bed295b4c5b15789e02651e2f203d5e8ef211a5 photocraft-0.23.1-linux-x86_64.flatpak +3aea55a4751eb05f9d2649a9d50bd13b44fd2c0fe70390f0d99d8be2213445b8 photocraft-0.23.1-linux-x86_64.flatpak.asc +2f3c5c19f988bbc78e910e1904eb1b537bd3092a54dc2a0e12513710923ec8c9 photocraft-0.23.1-linux-x86_64.oci-manifest.json +75f08c561476887c6d6c9293a8fa8e715ffd7f261304df5c2f2dcf23a6baeef5 photocraft-0.23.1-linux-x86_64.oci.sig +6f55b05a7880a6db38374ac7985730304bcc9b499dae0f18f9d2dbd6bbb8d201 photocraft-0.23.1-linux-x86_64.pkg.tar.zst +fbb0a056363e497ba8555b6645abf45690c5e97972383154657b321f7d84cb9d photocraft-0.23.1-linux-x86_64.pkg.tar.zst.sig +6de9029b7ae426e3fff794840095b47471b16e0937086da22aa6178466c15636 photocraft-0.23.1-linux-x86_64.rpm +08bc044e2907e41f86e7e154d7c64905860f9b78059da23661488922b716fe20 photocraft-0.23.1-linux-x86_64.rpm.asc +4383aef67a07cc370ad250a6ed60015205d3e6c463faf3ff4b0f67b8178ccfc8 photocraft-0.23.1-linux-x86_64.tar.gz +ce93bd2ca30585c7ecc9c7a9484c9c89a564a03f5eb281d66a5cc885486de42d photocraft-0.23.1-linux-x86_64.tar.gz.asc +606a52917188c65dc71709781180a0e3244e0f3b7f40b2f5b80170e87364420d photocraft-0.23.1-macos-universal.dmg +f02f0e754072836355b4aa8c46496fb0acff18a5fc780084bb4a40a2d9e1ab76 photocraft-0.23.1-windows-arm64-portable.zip +5542e387a5f35b22e60544ff38e3485bbebe480af3775d9c4d0b9a909ba70526 photocraft-0.23.1-windows-arm64-symbols.zip +d5fb081eaab54316b224cc1518e6ebace96b711b059828f4b397cc04e530611c photocraft-0.23.1-windows-arm64.msi +6317e764ecfa804227c38079311bea489283ab383ef040c81ef2fd6d86bd60b1 photocraft-0.23.1-windows-x64-portable.zip +61ceb478aa01d4dee19cb9fe2e1fe6367ca1a5974a20771c954885c21ba2bdd5 photocraft-0.23.1-windows-x64-symbols.zip +de757802d8a12a41718ba24248c281d83f3bbecd64c5230f46f10c7f62070671 photocraft-0.23.1-windows-x64.msi +a6ecdc6d4add02881642bda0a0b191b4974118651f2ec5641dc71b2c3ff4b752 photocraft-cli-0.23.1-macos-universal.zip +3a498eb517bca6cec89f9c6b1fc6448269a05428c8a3a4637c16817da157f03c photocraft-web-0.23.1.zip +8e6925a173d6a7134118da099948de4d9eeec7c1c0770998aec33c9d3f484740 release-signing-key.asc diff --git a/crates/native/tests/fixtures/linux-release-signed/SHA256SUMS.txt.asc b/crates/native/tests/fixtures/linux-release-signed/SHA256SUMS.txt.asc new file mode 100644 index 00000000..0d56c602 --- /dev/null +++ b/crates/native/tests/fixtures/linux-release-signed/SHA256SUMS.txt.asc @@ -0,0 +1,7 @@ +-----BEGIN PGP SIGNATURE----- + +iHUEABYKAB0WIQRWjcH2j4+uzHl/PHsAba9rsO8zTgUCavU0jAAKCRAAba9rsO8z +TjQcAQDBbNTCipPrKuo8MzmtDUF9GMb4YIkjQBfqvWdZyIiBMgEAmIUtznxoiFXr +0P+4o4eUy+hS9MtXX8NKZweLWWVkFQ4= +=sTmI +-----END PGP SIGNATURE----- diff --git a/docs/nightly-signing.md b/docs/nightly-signing.md index b14159b2..357ce877 100644 --- a/docs/nightly-signing.md +++ b/docs/nightly-signing.md @@ -21,6 +21,10 @@ release key, unsigned Launcher, environment variable or debug/local setting. Pub provisioning must include current revocation/expiry state; there is no release-selected key retrieval or automatic trust-root refresh. +Linux is provisioned with the ArtCraft Linux Release Signing Key, the same key that signs +stable Linux releases, pinned by its primary fingerprint; its signing subkey makes the +signatures. A test checks a real signed stable release file against the configured signer. + Linux uses installed `/usr/bin/gpg`, no user options/keyrings or automatic retrieval. A private temporary home imports only the pinned public material. Bounded subprocess verification requires one valid binary SHA-2 signature from the full pinned primary