File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -406,13 +406,14 @@ fn string_to_c_string(s: &str) -> *mut c_char {
406406 }
407407}
408408
409- // Helper: Escape special characters in query strings to prevent injection (CWE-78)
409+ // Helper: Escape special characters in query strings to prevent query injection
410410//
411411// NOTE: This function is duplicated in src/tantivy/query_builder.inko
412412// Both versions must be kept in sync. Any changes to the special character
413413// list must be applied to both locations.
414414//
415- // Full list of Tantivy/Lucene special chars: " ' + - ( ) [ ] : * ? \ ^ ~ { } | ! and whitespace
415+ // Current escaped set (must match query_builder.inko::is_special_char):
416+ // " ' + - ( ) [ ] : * ? \ space ^ ~ { } | !
416417fn escape_query_string ( s : & str ) -> String {
417418 let mut result = String :: with_capacity ( s. len ( ) * 2 ) ;
418419 for c in s. chars ( ) {
Original file line number Diff line number Diff line change @@ -81,7 +81,8 @@ impl TantivyQueryBuilder {
8181# Both versions must be kept in sync. Any changes to the special character
8282# list must be applied to both locations.
8383#
84- # Full list of Tantivy/Lucene special chars: " ' + - ( ) [ ] : * ? \ ^ ~ { } | ! and space
84+ # Current escaped set (must match lib.rs::escape_query_string):
85+ # " ' + - ( ) [ ] : * ? \ space ^ ~ { } | !
8586fn escape_query_string(s: String) -> String {
8687 let mut buffer = StringBuffer.new
8788
You can’t perform that action at this time.
0 commit comments