From 7222c8d7efbc3e8112f772a31ba636d586c0cb2d Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 19 Feb 2026 13:50:20 +0000 Subject: [PATCH] fix(security): prevent AppleScript injection in show_dialog Properly escape backslashes in message and title before escaping quotes to prevent breaking out of the string context in osascript commands. In AppleScript, a trailing backslash can escape the closing quote, allowing for arbitrary code execution. Co-authored-by: bearice <270121+bearice@users.noreply.github.com> --- src/platform/macos/system_integration.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/platform/macos/system_integration.rs b/src/platform/macos/system_integration.rs index 903cbec..25c79fd 100644 --- a/src/platform/macos/system_integration.rs +++ b/src/platform/macos/system_integration.rs @@ -9,8 +9,8 @@ impl SystemIntegration for MacosSystemIntegration { .arg("-e") .arg(&format!( r#"display dialog "{}" with title "{}" buttons {{"OK"}} default button "OK""#, - message.replace("\"", "\\\""), - title.replace("\"", "\\\"") + message.replace("\\", "\\\\").replace("\"", "\\\""), + title.replace("\\", "\\\\").replace("\"", "\\\"") )) .spawn()?; Ok(())