Skip to content

Commit 072379e

Browse files
committed
Use find_all_cve from utils in libreoffice importer
Replace local re.findall CVE regex with the shared find_all_cve utility. Normalise to uppercase before dedup to handle IGNORECASE matches from both href and link text. Signed-off-by: Anmol Vats <anmolvats2003@gmail.com>
1 parent 08933df commit 072379e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

vulnerabilities/pipelines/v2_importers/libreoffice_importer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
import json
1111
import logging
12-
import re
1312
from typing import Iterable
1413

1514
import dateparser
@@ -20,6 +19,7 @@
2019
from vulnerabilities.importer import VulnerabilitySeverity
2120
from vulnerabilities.pipelines import VulnerableCodeBaseImporterPipelineV2
2221
from vulnerabilities.severity_systems import SCORING_SYSTEMS
22+
from vulnerabilities.utils import find_all_cve
2323
from vulnerabilities.utils import get_cwe_id
2424

2525
logger = logging.getLogger(__name__)
@@ -75,7 +75,7 @@ def collect_advisories(self) -> Iterable[AdvisoryDataV2]:
7575

7676
def parse_cve_ids(html: str) -> list:
7777
"""Return deduplicated CVE IDs from the LibreOffice advisories listing page."""
78-
return list(dict.fromkeys(re.findall(r"CVE-\d{4}-\d+", html)))
78+
return list(dict.fromkeys(cve.upper() for cve in find_all_cve(html)))
7979

8080

8181
def parse_cve_advisory(data: dict, cve_id: str):

0 commit comments

Comments
 (0)