From e8e678b9b0628194e6e1c6c97916956ab7417feb Mon Sep 17 00:00:00 2001 From: Mickael Farina Date: Mon, 18 May 2026 01:07:25 +0200 Subject: [PATCH 1/2] fix(security): AppleScript injection fixes + plugin trust hardening (D-13, D-18, D-21) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes three audit findings that share a "untrusted input crosses a trust boundary" pattern, even though the surfaces differ: - D-13 (MEDIUM): AppleScript injection in imessage_send recipient field - D-21 (LOW): AppleScript injection in do_screenshot_question OCR ctx - D-18 (MEDIUM): plugin hooks have full Python privileges with no isolation ## D-13 — imessage_send recipient validation _validate_recipient enforces strict phone/email regex before any AppleScript interpolation. Phone: ^\+?[1-9]\d{9,14}$ (E.164-ish). Email: ^[\w.+\-]+@[\w\-]+(?:\.[\w\-]+)+$. Both anchored, length cap 254 (RFC 5321). Quotes, newlines, tabs, carriage returns, backslashes all rejected — the audit's documented breakout (`xx@x.com" of targetService\nactivate application "Calculator"...`) fails the regex. Audit emit `imessage_send_blocked` on refusal. Text body escape extended to cover `\\`, `\"`, `\r`, `\n`, `\t`. ## D-21 — do_screenshot_question argv binding The OCR summary is no longer interpolated into the AppleScript source. The new pattern uses `on run argv` + `item 1 of argv`: Python passes the body as `osascript -e