| 1 | #![no_std] |
| 2 | #![cfg_attr(docsrs, feature(doc_cfg))] |
| 3 | #![doc = include_str!("../README.md")] |
| 4 | #![doc(html_logo_url = "https://raw.githubusercontent.com/RustSec/logos/main/rustsec-logo-lg.png")] |
| 5 | #![forbid(unsafe_code)] |
| 6 | #![warn(missing_docs, rust_2018_idioms, unused_qualifications)] |
| 7 | |
| 8 | //! ## Usage |
| 9 | //! |
| 10 | //! The [`Cvss`] type provides a unified interface for working with CVSS |
| 11 | //! vectors. |
| 12 | //! |
| 13 | //! The [`v3::Base`] type provides the main functionality currently implemented |
| 14 | //! for CVSS v3, namely: support for parsing, serializing, and scoring |
| 15 | //! `CVSS:3.0` and `CVSS:3.1` Base Metric Group vector strings as described in |
| 16 | //! the [CVSS v3.1 Specification]. |
| 17 | //! |
| 18 | //! The [`v4::Vector`] type provides a fully-featured implementation of CVSS |
| 19 | //! v4.0, as described in the [CVSS v4.0 Specification]. |
| 20 | //! |
| 21 | //! Serde support is available through the optional `serde` Cargo feature. |
| 22 | //! |
| 23 | //! [CVSS v3.1 Specification]: https://www.first.org/cvss/v3.1/specification-document |
| 24 | //! [CVSS v4.0 Specification]: https://www.first.org/cvss/v4.0/specification-document |
| 25 | |
| 26 | // TODO(tarcieri): CVSS v2.0, CVSS v3.1 Temporal and Environmental Groups |
| 27 | |
| 28 | extern crate alloc; |
| 29 | |
| 30 | #[cfg(feature = "std")] |
| 31 | extern crate std; |
| 32 | |
| 33 | // A part of the v3 API is exposed even without the feature for compatibility. |
| 34 | pub mod v3; |
| 35 | #[cfg(feature = "v4")] |
| 36 | pub mod v4; |
| 37 | |
| 38 | #[cfg(any(feature = "v3", feature = "v4"))] |
| 39 | mod cvss; |
| 40 | mod error; |
| 41 | mod severity; |
| 42 | |
| 43 | // For compatibility |
| 44 | pub use crate::v3::metric::{Metric, MetricType}; |
| 45 | |
| 46 | #[cfg(any(feature = "v3", feature = "v4"))] |
| 47 | pub use crate::cvss::Cvss; |
| 48 | |
| 49 | pub use crate::{ |
| 50 | error::{Error, Result}, |
| 51 | severity::Severity, |
| 52 | }; |
| 53 | |
| 54 | /// Prefix used by all CVSS strings |
| 55 | pub const PREFIX: &str = "CVSS"; |