pub struct ConfidenceSignals {
pub has_literal_prefix: bool,
pub has_context_anchor: bool,
pub entropy: f64,
pub keyword_nearby: bool,
pub sensitive_file: bool,
pub match_length: usize,
pub has_companion: bool,
}
pub fn is_sensitive_path(path: &str) -> bool {
use std::sync::OnceLock;
static AC: OnceLock<Option<aho_corasick::AhoCorasick>> = OnceLock::new();
let ac = AC.get_or_init(|| {
aho_corasick::AhoCorasickBuilder::new()
.ascii_case_insensitive(true)
.build([
".env",
".env.local",
".env.production",
".env.staging",
"credentials",
"secrets",
"apikeys",
"api_keys",
".npmrc",
".pypirc",
".netrc",
".pgpass",
"terraform.tfvars",
"variables.tf",
"docker-compose",
"application.yml",
"application.properties",
"config.json",
"config.yaml",
"config.toml",
".pem",
".key",
".p12",
".pfx",
".jks",
".keystore",
".cer",
".crt",
".github/workflows",
"gitlab-ci.yml",
"Jenkinsfile",
"buildspec.yml",
"serverless.yml",
"sam-template",
"helm/values",
"chart/values",
])
.ok()
});
ac.as_ref().is_some_and(|ac| ac.is_match(path))
}