use crate::Severity;
use std::sync::Arc;
pub trait Reportable {
fn scanner(&self) -> &str;
fn target(&self) -> &str;
fn severity(&self) -> Severity;
fn title(&self) -> &str;
fn detail(&self) -> &str {
&self.title()[..0]
}
fn cwe_ids(&self) -> &[Arc<str>] {
&[]
}
fn cve_ids(&self) -> &[Arc<str>] {
&[]
}
fn tags(&self) -> &[Arc<str>] {
&[]
}
fn confidence(&self) -> Option<f64> {
None
}
fn cvss_score(&self) -> Option<f64> {
None
}
fn status(&self) -> crate::FindingStatus {
crate::FindingStatus::Open
}
fn location(&self) -> Option<&crate::Location> {
None
}
fn scan_id(&self) -> Option<&str> {
None
}
fn rule_id(&self) -> String {
format!(
"{}/{}",
self.scanner(),
self.title().to_lowercase().replace(' ', "-")
)
}
fn sarif_level(&self) -> &str {
self.severity().sarif_level()
}
fn exploit_hint(&self) -> Option<&str> {
None
}
fn remediation(&self) -> Option<&str> {
None
}
fn evidence(&self) -> &[crate::Evidence] {
&[]
}
fn kind(&self) -> crate::FindingKind {
crate::FindingKind::Unclassified
}
}
impl Reportable for crate::Finding {
fn scanner(&self) -> &str {
self.scanner()
}
fn target(&self) -> &str {
self.target()
}
fn severity(&self) -> Severity {
self.severity()
}
fn title(&self) -> &str {
self.title()
}
fn detail(&self) -> &str {
self.detail()
}
fn cwe_ids(&self) -> &[Arc<str>] {
self.cwe_ids()
}
fn cve_ids(&self) -> &[Arc<str>] {
self.cve_ids()
}
fn tags(&self) -> &[Arc<str>] {
self.tags()
}
fn confidence(&self) -> Option<f64> {
self.confidence()
}
fn cvss_score(&self) -> Option<f64> {
self.cvss_score()
}
fn status(&self) -> crate::FindingStatus {
self.status()
}
fn location(&self) -> Option<&crate::Location> {
self.location()
}
fn scan_id(&self) -> Option<&str> {
self.scan_id()
}
fn exploit_hint(&self) -> Option<&str> {
self.exploit_hint()
}
fn remediation(&self) -> Option<&str> {
self.remediation()
}
fn evidence(&self) -> &[crate::Evidence] {
self.evidence()
}
fn kind(&self) -> crate::FindingKind {
self.kind()
}
}