Skip to content

Commit a7b7d64

Browse files
authored
Merge pull request #179 from Tcode-Motion/fix-powershell-command-injection-4878609109551855986
🔒 [security fix] Fix command injection in std.notification PowerShell invocation
2 parents 61f728f + 31f4e91 commit a7b7d64

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

‎stdlib/src/notification.rs‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,11 @@ impl StdlibRegistry {
3434
{
3535
use std::process::Command;
3636
let _ = Command::new("powershell")
37+
.env("TS_NOTIFY_TITLE", &title)
38+
.env("TS_NOTIFY_BODY", &body)
3739
.args([
3840
"-Command",
39-
&format!(
40-
"[System.Windows.MessageBox]::Show('{}','{}')",
41-
body.replace("'", "''"),
42-
title.replace("'", "''")
43-
),
41+
"[System.Windows.MessageBox]::Show($env:TS_NOTIFY_BODY, $env:TS_NOTIFY_TITLE)"
4442
])
4543
.spawn();
4644
}

0 commit comments

Comments
 (0)