securegit 0.8.5

Zero-trust git replacement with 12 built-in security scanners, LLM redteam bridge, universal undo, durable backups, and a 50-tool MCP server
Documentation
use crate::core::Severity;
use serde::{Deserialize, Serialize};
use std::path::PathBuf;

#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum Confidence {
    Low,
    Medium,
    High,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Finding {
    pub id: String,
    pub title: String,
    pub description: String,
    pub severity: Severity,
    pub confidence: Confidence,
    pub file_path: Option<PathBuf>,
    pub line_start: Option<u32>,
    pub line_end: Option<u32>,
    pub code_snippet: Option<String>,
    pub evidence: Vec<String>,
    pub remediation: Option<String>,
    pub references: Vec<String>,
    pub tags: Vec<String>,
    pub cwe_ids: Vec<u32>,
}

impl Finding {
    pub fn new(id: String, title: String, severity: Severity) -> Self {
        Self {
            id,
            title,
            description: String::new(),
            severity,
            confidence: Confidence::Medium,
            file_path: None,
            line_start: None,
            line_end: None,
            code_snippet: None,
            evidence: Vec::new(),
            remediation: None,
            references: Vec::new(),
            tags: Vec::new(),
            cwe_ids: Vec::new(),
        }
    }

    pub fn with_file(mut self, path: PathBuf) -> Self {
        self.file_path = Some(path);
        self
    }

    pub fn with_line(mut self, line: u32) -> Self {
        self.line_start = Some(line);
        self
    }

    pub fn with_description(mut self, desc: String) -> Self {
        self.description = desc;
        self
    }

    pub fn with_evidence(mut self, evidence: String) -> Self {
        self.evidence.push(evidence);
        self
    }
}