-
Notifications
You must be signed in to change notification settings - Fork 634
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
394 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
{ | ||
"version": "1.3", | ||
"package_type": "deb", | ||
"advisories": [ | ||
{ | ||
"oid": "1.3.6.1.4.1.25623.1.1.7.2.2023.10089729899100", | ||
"fixed_packages": [ | ||
{ | ||
"name": "gitlab-ce", | ||
"range": { | ||
"start": "?", | ||
"end": "=" | ||
} | ||
}, | ||
{ | ||
"name": "gitlab-ce", | ||
"range": { | ||
"start": "16.0.0", | ||
"end": "16.0.7" | ||
} | ||
}, | ||
{ | ||
"name": "gitlab-ce", | ||
"range": { | ||
"start": "16.1.0", | ||
"end": "16.1.2" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"oid": "1.3.6.1.4.1.25623.1.1.7.2.2023.0988598199100", | ||
"fixed_packages": [ | ||
{ | ||
"name": "grafana", | ||
"full_version": "8.5.24", | ||
"specifier": ">=" | ||
}, | ||
{ | ||
"name": "grafana", | ||
"range": { | ||
"start": "9.0.0", | ||
"end": "9.2.17" | ||
} | ||
}, | ||
{ | ||
"name": "grafana", | ||
"range": { | ||
"start": "9.3.0", | ||
"end": "9.3.13" | ||
} | ||
}, | ||
{ | ||
"name": "grafana", | ||
"range": { | ||
"start": "9.4.0", | ||
"end": "9.4.9" | ||
} | ||
}, | ||
{ | ||
"name": "grafana8", | ||
"full_version": "8.5.24", | ||
"specifier": ">=" | ||
}, | ||
{ | ||
"name": "grafana9", | ||
"full_version": "9.2.17", | ||
"specifier": ">=" | ||
}, | ||
{ | ||
"name": "grafana9", | ||
"range": { | ||
"start": "9.3.0", | ||
"end": "9.3.13" | ||
} | ||
}, | ||
{ | ||
"name": "grafana9", | ||
"range": { | ||
"start": "9.4.0", | ||
"end": "9.4.9" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
{ | ||
"version": "1.3", | ||
"package_type": "deb", | ||
"advisories": [ | ||
{ | ||
"oid": "1.3.6.1.4.1.25623.1.1.7.2.2023.10089729899100", | ||
"fixed_packages": [ | ||
{ | ||
"name": "gitlab-ce", | ||
"range": { | ||
"start": "15.11.0", | ||
"en": "15.11.11" | ||
} | ||
}, | ||
{ | ||
"name": "gitlab-ce", | ||
"range": { | ||
"start": "16.0.0", | ||
"end": "16.0.7" | ||
} | ||
}, | ||
{ | ||
"name": "gitlab-ce", | ||
"range": { | ||
"start": "16.1.0", | ||
"end": "16.1.2" | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"oid": "1.3.6.1.4.1.25623.1.1.7.2.2023.0988598199100", | ||
"fixed_packages": [ | ||
{ | ||
"name": "grafana", | ||
"full_version": "8.5.24", | ||
"specifier": ">=" | ||
}, | ||
{ | ||
"name": "grafana", | ||
"range": { | ||
"start": "9.0.0", | ||
"end": "9.2.17" | ||
} | ||
}, | ||
{ | ||
"name": "grafana", | ||
"range": { | ||
"start": "9.3.0", | ||
"end": "9.3.13" | ||
} | ||
}, | ||
{ | ||
"name": "grafana", | ||
"range": { | ||
"start": "9.4.0", | ||
"end": "9.4.9" | ||
} | ||
}, | ||
{ | ||
"name": "grafana8", | ||
"full_version": "8.5.24", | ||
"specifier": ">=" | ||
}, | ||
{ | ||
"name": "grafana9", | ||
"full_version": "9.2.17", | ||
"specifier": ">=" | ||
}, | ||
{ | ||
"name": "grafana9", | ||
"range": { | ||
"start": "9.3.0", | ||
"end": "9.3.13" | ||
} | ||
}, | ||
{ | ||
"name": "grafana9", | ||
"range": { | ||
"start": "9.4.0", | ||
"end": "9.4.9" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,38 @@ | ||
use std::fmt::Display; | ||
use std::{fmt::Display, io}; | ||
|
||
#[derive(PartialEq, PartialOrd, Debug)] | ||
pub enum NotusError { | ||
InvalidOS, | ||
JSONParseError, | ||
UnsupportedVersion(String), | ||
NoLoader, | ||
use models::FixedPackage; | ||
|
||
#[derive(Debug)] | ||
pub enum Error { | ||
// The directory containing the notus advisories does not exist | ||
MissingAdvisoryDir(String), | ||
// The given notus advisory directory is a file | ||
AdvisoryDirIsFile(String), | ||
// There are no corresponding notus files for the given Operating System | ||
UnknownOs(String), | ||
// General error while loading notus advisories | ||
LoadAdvisoryError(String, io::Error), | ||
// Unable to parse notus advisory file due to a JSON error | ||
JSONParseError(String, serde_json::Error), | ||
// The version of the notus advisory file is not supported | ||
UnsupportedVersion(String, String, String), | ||
// Unable to parse a given package | ||
PackageParseError(String), | ||
// Unable to parse a package in the notus advisory file | ||
AdvisoryParseError(String, FixedPackage), | ||
} | ||
|
||
impl Display for NotusError { | ||
fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
impl Display for Error { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
match self { | ||
NotusError::InvalidOS => todo!(), | ||
NotusError::JSONParseError => todo!(), | ||
NotusError::UnsupportedVersion(_) => todo!(), | ||
NotusError::NoLoader => todo!(), | ||
Error::UnknownOs(path) => write!(f, "the File {path} was not found, that is either due to a typo or missing notus advisories for the corresponding OS"), | ||
Error::JSONParseError(path, json_err) => write!(f, "unable to parse Notus file {path}. The corresponding parse error was: {json_err}"), | ||
Error::UnsupportedVersion(path, version1, version2) => write!(f, "the version of the parsed advisory file {path} is {version1}. This version is currently not supported, the version {version2} is required"), | ||
Error::MissingAdvisoryDir(path) => write!(f, "The directory {path}, which should contain the notus advisories does not exist"), | ||
Error::AdvisoryDirIsFile(path) => write!(f, "The given notus advisory directory {path} is a file"), | ||
Error::LoadAdvisoryError(path, err) => write!(f, "Unable to load advisories from {path}: {err}"), | ||
Error::PackageParseError(pkg) => write!(f, "Unable to parse the given package {pkg}"), | ||
Error::AdvisoryParseError(path, pkg) => write!(f, "Unable to parse fixed package information {:?} in the advisories {path}", pkg), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ pub mod loader; | |
pub mod packages; | ||
|
||
pub mod advisory; | ||
pub mod error; | ||
pub mod notus; |
Oops, something went wrong.