From d10615d903876ce05e4c3d2d6cde0f056f964361 Mon Sep 17 00:00:00 2001 From: Knotty Wyvern Date: Thu, 29 Oct 2026 01:40:35 -0700 Subject: [PATCH] Refuse a browser engine pin with another protocol The pin names the protocol of its engine. An engine of another protocol would fail at its first start, so the host now refuses its pin before the download. This also uses the protocol field, which the build reported as unread. --- src-tauri/src/browser_engine.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src-tauri/src/browser_engine.rs b/src-tauri/src/browser_engine.rs index dc4128d..cc9d685 100644 --- a/src-tauri/src/browser_engine.rs +++ b/src-tauri/src/browser_engine.rs @@ -109,6 +109,10 @@ fn parse(text: &str) -> Result { if !valid_version(&manifest.version) { return Err("The browser engine manifest has an invalid version.".into()); } + // An engine of another protocol would fail at its first start. Refuse its pin before the download. + if manifest.protocol != PROTOCOL { + return Err("The browser engine manifest names another engine protocol.".into()); + } for package in manifest.platforms.values() { let hex = package.sha256.len() == 64 && package.sha256.bytes().all(|c| c.is_ascii_digit() || (b'a'..=b'f').contains(&c)); if !hex || package.bytes == 0 || Url::parse(&package.url).is_err() { @@ -531,6 +535,7 @@ mod tests { r#"{"version":"../1","protocol":1}"#, r#"{"version":"0.1.8","protocol":1,"platforms":{"windows-x86_64":{"url":"x","bytes":1,"sha256":"00"}}}"#, r#"{"version":"0.1.8","protocol":1,"extra":true}"#, + r#"{"version":"0.1.8","protocol":2}"#, ] { assert!(parse(text).is_err(), "{text}"); }