增加一些 get 方法,类似 cvrf

Signed-off-by: Jia Chao <jiac13@chinaunicom.cn>
This commit is contained in:
Jia Chao 2024-07-24 15:00:21 +08:00
parent d667ef7fda
commit 153a3a3298

View File

@ -54,6 +54,47 @@ impl CSAF {
return ""
}
/// 详细的公告描述信息
pub fn affected_component(&self) -> &str {
for note in &self.document.notes {
if note.title == "Affected Component" {
return &note.text
}
}
return ""
}
/// 受影响的产品列表
pub fn affected_products(&self) -> Vec<&Product> {
let mut products = vec![];
for product_branch in &self.product_tree.branches {
for branch in &product_branch.branches {
if &branch.name == "openEuler" {
products.push(&branch.branches[0].product);
break;
}
}
}
products
}
/// 已修复的 src 产品列表
pub fn fixed_srcs(&self) -> Vec<&Product> {
let mut srcs = vec![];
for product_branch in &self.product_tree.branches {
for branch in &product_branch.branches {
if &branch.name == "src" {
srcs.push(&branch.branches[0].product);
break;
}
}
}
srcs
}
/// 安全公告所涉及的所有 CVE 的列表
pub fn cves(&self) -> Vec<CVE> {
let mut cves = vec![];