Refactor database schema and scanning process:

- Introduced `issues` table for detailed vulnerability storage.
- Enhanced `files` table with project scoping and unique constraints.
- Replaced `OutputFormat` enum with `String` for flexibility.
- Added support for formatted console output of scan results.
- Integrated file and issue updating logic for incremental scans.
- Optimized scanning by leveraging database-stored issues.
This commit is contained in:
elipeter 2025-06-17 16:46:45 +02:00
parent 9ef591c7b1
commit 0eecf886f2
7 changed files with 302 additions and 357 deletions

View file

@ -9,6 +9,7 @@ mod php;
mod python;
use std::collections::HashMap;
use std::str::FromStr;
use serde::{Deserialize, Serialize};
use once_cell::sync::Lazy;
@ -33,6 +34,19 @@ pub struct Pattern {
pub severity: Severity,
}
impl FromStr for Severity { // TODO: FIX
type Err = ();
fn from_str(input: &str) -> Result<Self, Self::Err> {
match input.to_lowercase().as_str() {
"medium" => Ok(Severity::Medium),
"high" => Ok(Severity::High),
_ => Ok(Severity::Low),
}
}
}
/// Global, lazily-initialised registry: lang-name → pattern slice
static REGISTRY: Lazy<HashMap<&'static str, &'static [Pattern]>> = Lazy::new(|| {
let mut m = HashMap::new();