pub struct CweMapping {
pub metadata: MappingMetadata,
pub content: Vec<CweMappingNode>,
}Expand description
The complete VRT to CWE mapping document
This represents the root structure of a CWE mapping file.
Fields§
§metadata: MappingMetadataMetadata about the mapping
content: Vec<CweMappingNode>The mapping content (root nodes)
Implementations§
Source§impl CweMapping
impl CweMapping
Sourcepub fn find_by_vrt_id(&self, vrt_id: &str) -> Option<&CweMappingNode>
pub fn find_by_vrt_id(&self, vrt_id: &str) -> Option<&CweMappingNode>
Finds a mapping node by VRT ID across all root nodes
Sourcepub fn lookup_cwe(&self, vrt_id: &str) -> Option<Vec<&CweId>>
pub fn lookup_cwe(&self, vrt_id: &str) -> Option<Vec<&CweId>>
Looks up CWE IDs for a given VRT ID
§Example
use bugcrowd_vrt::load_cwe_mapping_from_file;
let mapping = load_cwe_mapping_from_file("cwe.mappings.json")
.expect("Failed to load mapping");
if let Some(cwes) = mapping.lookup_cwe("cross_site_scripting_xss") {
for cwe in cwes {
println!("CWE: {}", cwe);
}
}Sourcepub fn all_cwe_ids(&self) -> Vec<&CweId>
pub fn all_cwe_ids(&self) -> Vec<&CweId>
Returns all unique CWE IDs present in the mapping
Sourcepub fn statistics(&self) -> MappingStatistics
pub fn statistics(&self) -> MappingStatistics
Returns statistics about the mapping
Trait Implementations§
Source§impl Clone for CweMapping
impl Clone for CweMapping
Source§fn clone(&self) -> CweMapping
fn clone(&self) -> CweMapping
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CweMapping
impl Debug for CweMapping
Source§impl<'de> Deserialize<'de> for CweMapping
impl<'de> Deserialize<'de> for CweMapping
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for CweMapping
impl PartialEq for CweMapping
Source§impl Serialize for CweMapping
impl Serialize for CweMapping
impl StructuralPartialEq for CweMapping
Auto Trait Implementations§
impl Freeze for CweMapping
impl RefUnwindSafe for CweMapping
impl Send for CweMapping
impl Sync for CweMapping
impl Unpin for CweMapping
impl UnwindSafe for CweMapping
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more