MCPcopy Index your code
hub / github.com/AI45Lab/Code / detect_sensitive

Method detect_sensitive

core/src/security/default.rs:190–200  ·  view source on GitHub ↗

Detect sensitive data in text

(&self, text: &str)

Source from the content-addressed store, hash-verified

188
189 /// Detect sensitive data in text
190 fn detect_sensitive(&self, text: &str) -> Vec<(String, String)> {
191 let mut matches = Vec::new();
192
193 for pattern in &self.patterns {
194 for capture in pattern.regex.find_iter(text) {
195 matches.push((pattern.name.clone(), capture.as_str().to_string()));
196 }
197 }
198
199 matches
200 }
201
202 /// Check for injection patterns
203 pub fn detect_injection(&self, text: &str) -> Vec<String> {

Callers 6

taint_inputMethod · 0.80
test_detect_ssnFunction · 0.80
test_detect_emailFunction · 0.80
test_detect_api_keyFunction · 0.80
test_multiple_patternsFunction · 0.80
test_no_false_positivesFunction · 0.80

Calls 2

cloneMethod · 0.45
as_strMethod · 0.45

Tested by 5

test_detect_ssnFunction · 0.64
test_detect_emailFunction · 0.64
test_detect_api_keyFunction · 0.64
test_multiple_patternsFunction · 0.64
test_no_false_positivesFunction · 0.64