1pub fn scan_input(input: &str) -> Vec<String> {
2 let mut issues = vec![];
3
4 if contains_zero_width(input) {
5 issues.push("ZERO_WIDTH_CHARACTER_DETECTED".to_string());
6 }
7
8 if contains_suspicious_unicode(input) {
9 issues.push("SUSPICIOUS_UNICODE_PATTERN".to_string());
10 }
11
12 issues
13}
14
15fn contains_zero_width(input: &str) -> bool {
16 input
17 .chars()
18 .any(|c| matches!(c, '\u{200B}' | '\u{200C}' | '\u{200D}' | '\u{FEFF}'))
19}
20
21fn contains_suspicious_unicode(input: &str) -> bool {
22 input.chars().any(|c| {
23 let code = c as u32;
24 (code >= 0x0370 && code <= 0x03FF) || (code >= 0x0400 && code <= 0x04FF) })
27}