Skip to content

Commit c873e1c

Browse files
committed
Removed ghp false positive
1 parent 9cd79a7 commit c873e1c

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/scans/tools/secret_tool.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,22 @@ impl SecretTool {
9090
if json_output["SourceMetadata"]["Data"]["Filesystem"]["file"]
9191
.as_str()
9292
.unwrap()
93-
.contains(".git/config")
93+
.contains(".git/")
9494
{
95-
println!("[+] Skipping .git/config file...");
95+
println!("[+] Skipping .git/ file...");
9696
continue;
9797
}
98-
// if "Raw" is in json_output and not null then check if it contains environment variables
98+
// Check if "Raw" is in json_output and not null
9999
if json_output["Raw"].is_string() && !json_output["Raw"].is_null() {
100-
if count_env_variables(&json_output["Raw"].as_str().unwrap()) > 0 {
100+
// Clone the string to create an owned String, extending its lifetime
101+
let raw_value = json_output["Raw"].as_str().unwrap().to_string();
102+
103+
// Check if it contains environment variables
104+
if count_env_variables(&raw_value) > 0 {
101105
continue;
102106
}
103107
}
104-
results.push(json_output);
108+
results.push(json_output.clone());
105109
}
106110
// ## iterate into each results and implement checks for specific DetectorName
107111
let mut new_results: Vec<Value> = Vec::new();

0 commit comments

Comments
 (0)