pub mod allowlist;
pub mod banner;
pub mod config;
pub mod credential;
mod dedup;
pub mod encoding;
mod finding;
pub mod hardening;
pub mod report;
pub mod safe_bin;
mod source;
mod spec;
use std::borrow::Cow;
pub mod registry;
pub use allowlist::*;
pub use config::*;
pub use credential::{Credential, SensitiveString};
pub use dedup::*;
pub use finding::*;
pub use report::*;
pub use source::*;
pub mod auto_fix;
pub mod calibration;
pub mod merkle_index;
pub use spec::*;
mod embedded {
include!(concat!(env!("OUT_DIR"), "/embedded_detectors.rs"));
}
pub fn embedded_detector_tomls() -> &'static [(&'static str, &'static str)] {
embedded::EMBEDDED_DETECTORS
}
#[inline]
pub fn embedded_detector_count() -> usize {
embedded_detector_tomls().len()
}
pub fn redact(s: &str) -> Cow<'static, str> {
if s.is_ascii() {
if s.len() <= 8 {
return Cow::Borrowed("****");
}
let mut out = String::with_capacity(s.len().min(11));
out.push_str(&s[..4]);
out.push_str("...");
out.push_str(&s[s.len() - 4..]);
return Cow::Owned(out);
}
let char_count = s.chars().count();
if char_count <= 8 {
return Cow::Borrowed("****");
}
let first_four: String = s.chars().take(4).collect();
let last_four: String = s.chars().skip(char_count.saturating_sub(4)).collect();
Cow::Owned(format!("{first_four}...{last_four}"))
}