fix(search): use fixed-string matching to prevent ReDoS

Add -F flag to git grep to disable regex interpretation, preventing
catastrophic backtracking from malicious query patterns.
This commit is contained in:
zhenyi
2026-06-10 18:32:10 +08:00
parent c9c1a739fd
commit c3017a255f
+2 -1
View File
@@ -25,7 +25,8 @@ impl GitBare {
"--git-dir".to_string(),
self.bare_dir.to_string_lossy().into_owned(),
"grep".to_string(),
"-I".to_string(), // don't match binary files
"-F".to_string(),
"-I".to_string(),
"--line-number".to_string(),
"--column".to_string(),
];