Repository navigation
🔒 [Security] Fix command injection in PowerShell notification - #265
Tcode-Motion wants to merge 2 commits into
Conversation
Eliminate command injection vector in `stdlib/src/notification.rs` by fully Base64-encoding the user-controlled `title` and `body` variables before passing them to the PowerShell script. This guarantees that user input is never parsed or evaluated as code, safely mitigating any injection via subexpressions, escaped strings, or environment variable leaks. The `-NoProfile` flag was also added to improve PowerShell startup performance and safety. Co-authored-by: Tcode-Motion <188012755+Tcode-Motion@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Completely eliminate the risk of command injection in `stdlib/src/notification.rs` by fully embedding the user-controlled `title` and `body` variables into a Base64-decoding PowerShell script, encoding the *entire* script into a UTF-16LE Base64 string, and invoking PowerShell using the `-EncodedCommand` flag. This safely avoids all PowerShell command-line argument parsing and string interpolation vulnerabilities. The `-NoProfile` flag was also retained to improve execution isolation and startup speed. Co-authored-by: Tcode-Motion <188012755+Tcode-Motion@users.noreply.github.com>
🎯 What: Fixed a command injection vulnerability in
⚠️ Risk: If an attacker could control the notification title or body (e.g., via a TechScript string generated from unvalidated external input), they could potentially execute arbitrary PowerShell commands on the host machine.
stdlib/src/notification.rswhere user-provided notificationtitleandbodyvariables were passed insecurely to a PowerShell subprocess on Windows.🛡️ Solution: The solution entirely bypasses PowerShell's parsing and escaping quirks by Base64-encoding the strings in Rust (
base64::prelude::BASE64_STANDARD.encode). The PowerShell script itself was rewritten to decode these Base64 strings dynamically at runtime, ensuring that malicious payloads cannot break out of the string context. TheTS_NOTIFY_TITLEandTS_NOTIFY_BODYenvironment variables were also removed to prevent accidental leakage. The-NoProfileflag was added to ensure isolated and rapid script execution.PR created automatically by Jules for task 14505776625068902587 started by @Tcode-Motion