Expand description
§About CVEs
The Common Vulnerabilities and Exposures (CVEs) program catalogs publicly disclosed information-security vulnerabilities.
This catalog contains one so-called CVE Record for each vulnerability. Each record has an identifier (CVE ID) in the format “CVE-YYYY-NNNN”; that is the prefix “CVE”, a 4-digit year and then a 4+digit number, separated by “-” (dashes).
§About this crate
This crate implements a CveId type for syntactically valid CVE IDs. It does not implement other fields of a CVE Record.
The crate does not implement other semantic rules, e.g.
- CVEs were first assigned with start of the program in 1999
- the first number each year is 1
Syntactically “CVE-0000-0000” and “CVE-9999-9999999999999999999” are valid.
use cve_id::{CveId, CveYear};
let cve_min = CveId::new(0.try_into()?, 0);
let cve_first = "CVE-1999-0001".parse::<CveId>()?;
let cve_max = CveId::new(CveYear::new(9999)?, 9_999_999_999_999_999_999);
assert!(CveId::from_str("CAN-1999-0067").is_err());
assert!(CveId::from_str("CVE-1900-0420")?.is_example_or_test());§Features
Structs§
- CveId
- Common Vulnerabilities and Exposures Identifier
- CveYear
- Year YYYY part of
CveId - Invalid
CveYear Error - Invalid value error for
CveYear - Parse
CveId Error - Parse error for
CveId