Skip to content

Commit d9c34dc

Browse files
fix: update dangerous patterns for execute bash to include $ (#2811)
1 parent 178ccf1 commit d9c34dc

File tree

1 file changed

+2
-1
lines changed
  • crates/chat-cli/src/cli/chat/tools/execute

1 file changed

+2
-1
lines changed

crates/chat-cli/src/cli/chat/tools/execute/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl ExecuteCommand {
7070
let Some(args) = shlex::split(&self.command) else {
7171
return true;
7272
};
73-
const DANGEROUS_PATTERNS: &[&str] = &["<(", "$(", "`", ">", "&&", "||", "&", ";", "${", "\n", "\r", "IFS"];
73+
const DANGEROUS_PATTERNS: &[&str] = &["<(", "$(", "`", ">", "&&", "||", "&", ";", "$", "\n", "\r", "IFS"];
7474

7575
if args
7676
.iter()
@@ -328,6 +328,7 @@ mod tests {
328328
(r#"find / -fprintf "/path/to/file" <data-to-write> -quit"#, true),
329329
(r"find . -${t}exec touch asdf \{\} +", true),
330330
(r"find . -${t:=exec} touch asdf2 \{\} +", true),
331+
(r#"find /tmp -name "*" -exe$9c touch /tmp/find_result {} +"#, true),
331332
// `grep` command arguments
332333
("echo 'test data' | grep -P '(?{system(\"date\")})'", true),
333334
("echo 'test data' | grep --perl-regexp '(?{system(\"date\")})'", true),

0 commit comments

Comments
 (0)