VulnerabilityCategorizer

Struct VulnerabilityCategorizer 

Source
pub struct VulnerabilityCategorizer { /* private fields */ }
Expand description

Helper for categorizing vulnerability findings

Implementations§

Source§

impl VulnerabilityCategorizer

Source

pub fn new(vrt: VrtTaxonomy) -> Self

Creates a new categorizer with VRT taxonomy only

Source

pub fn with_all_mappings( vrt: VrtTaxonomy, cwe_mapping: CweMapping, cvss_mapping: CvssV3Mapping, ) -> Self

Creates a categorizer with all mappings (VRT, CWE, CVSS)

Source

pub fn with_cwe_mapping(self, cwe_mapping: CweMapping) -> Self

Adds CWE mapping

Source

pub fn with_cvss_mapping(self, cvss_mapping: CvssV3Mapping) -> Self

Adds CVSS v3 mapping

Source

pub fn categorize_by_id(&self, vrt_id: &str) -> Option<CategorizedFinding>

Categorizes a finding by VRT ID

§Example
use bugcrowd_vrt::{VulnerabilityCategorizer, load_vrt_from_file};

let vrt = load_vrt_from_file("vrt.json").expect("Failed to load VRT");
let categorizer = VulnerabilityCategorizer::new(vrt);

if let Some(finding) = categorizer.categorize_by_id("sql_injection") {
    println!("VRT: {} (P{})", finding.vrt_name, finding.priority.unwrap_or(0));
}
Source

pub fn search_by_name(&self, query: &str) -> Vec<String>

Searches for VRT IDs by name (case-insensitive substring match)

Returns a list of matching VRT IDs

§Example
use bugcrowd_vrt::{VulnerabilityCategorizer, load_vrt_from_file};

let vrt = load_vrt_from_file("vrt.json").expect("Failed to load VRT");
let categorizer = VulnerabilityCategorizer::new(vrt);

let matches = categorizer.search_by_name("sql");
for id in matches {
    println!("Found: {}", id);
}
Source

pub fn categorize_by_description( &self, description: &str, ) -> Option<CategorizedFinding>

Finds the best matching VRT ID for a vulnerability name/description

Uses keyword matching to find the most relevant VRT category

§Example
use bugcrowd_vrt::{VulnerabilityCategorizer, load_vrt_from_file};

let vrt = load_vrt_from_file("vrt.json").expect("Failed to load VRT");
let categorizer = VulnerabilityCategorizer::new(vrt);

let finding_name = "SQL Injection detected in login form";
if let Some(finding) = categorizer.categorize_by_description(finding_name) {
    println!("Categorized as: {} (P{})", finding.vrt_name, finding.priority.unwrap_or(0));
}
Source

pub fn list_all_variants(&self) -> Vec<String>

Lists all available VRT variant IDs (leaf nodes)

Source

pub fn get_all_categorizations(&self) -> Vec<CategorizedFinding>

Gets all categorized findings for all variants

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.