Add multi-language AST-pattern scanning support

- Introduced `patterns` module with language-specific vulnerability patterns.
- Added `query_cache` utility for caching compiled queries.
- Expanded `scan.rs` to support scanning multiple languages dynamically.
- Updated `Cargo.toml` with additional tree-sitter dependencies.
- Added severity filtering to `ScannerConfig` for better configuration.
This commit is contained in:
elipeter 2025-06-17 01:17:48 +02:00
parent 0831b9fb48
commit 22369cc404
17 changed files with 665 additions and 25 deletions

View file

@ -2,10 +2,14 @@ use serde::{Deserialize, Serialize};
use std::path::{Path};
use std::fs;
use toml;
use crate::patterns::Severity;
#[derive(Debug, Serialize, Deserialize, Clone)]
#[serde(default)]
pub struct ScannerConfig {
/// The minimum severity level to output
pub min_severity: Severity,
/// The maximum file size to scan, in megabytes. TODO: IMPLEMENT
pub max_file_size_mb: u64,
@ -39,6 +43,7 @@ pub struct ScannerConfig {
impl Default for ScannerConfig {
fn default() -> Self {
Self {
min_severity: Severity::Low,
max_file_size_mb: 100,
excluded_extensions: vec![
"jpg", "png", "gif", "mp4", "avi", "mkv",