diff --git a/src/lib.rs b/src/lib.rs index a70ca7d..22c7830 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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 ¬e.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 { let mut cves = vec![];