Skip to main content

api_scanner/scanner/
mod.rs

1// src/scanner/mod.rs
2//
3// Scanner trait definition and shared types.
4
5pub mod api_security;
6pub mod common;
7pub mod cors;
8pub mod csp;
9pub mod cve_templates;
10pub mod graphql;
11pub mod http_utils;
12pub mod jwt;
13pub mod mass_assignment;
14pub mod oauth_oidc;
15pub mod openapi;
16pub mod rate_limit;
17pub mod websocket;
18
19use crate::{config::Config, error::CapturedError, http_client::HttpClient, reports::Finding};
20
21/// Every scanner module implements this trait.
22///
23/// `scan()` returns `(findings, errors)` and must never panic; all internal
24/// errors should be captured and returned in the error vector.
25#[async_trait::async_trait]
26pub trait Scanner: Send + Sync + 'static {
27    /// Stable scanner identifier used for logging, metrics, and reporting.
28    fn name(&self) -> &'static str;
29
30    /// Run this scanner against a single URL.
31    async fn scan(
32        &self,
33        url: &str,
34        client: &HttpClient,
35        config: &Config,
36    ) -> (Vec<Finding>, Vec<CapturedError>);
37}