Skip to content

Commit e59cfd8

Browse files
committed
add extra check
1 parent f6b53f2 commit e59cfd8

File tree

1 file changed

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

1 file changed

+3
-2
lines changed

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

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

7474
if args
7575
.iter()
@@ -300,8 +300,9 @@ mod tests {
300300
("cat <<< 'some string here' > myimportantfile", true),
301301
("echo '\n#!/usr/bin/env bash\necho hello\n' > myscript.sh", true),
302302
("cat <<EOF > myimportantfile\nhello world\nEOF", true),
303-
// newline check
303+
// newline checks
304304
("which ls\ntouch asdf", true),
305+
("which ls\rtouch asdf", true),
305306
// $IFS check
306307
(
307308
r#"IFS=';'; for cmd in "which ls;touch asdf"; do eval "$cmd"; done"#,

0 commit comments

Comments
 (0)