Skip to content

Commit b661ea9

Browse files
committed
Add CVE regex in helpers.py
Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
1 parent a11e01b commit b661ea9

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

vulnerabilities/helpers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
# Visit https://github.com/nexB/vulnerablecode/ for support and download.
2222

2323
import json
24+
import re
2425

2526
import yaml
2627
import requests
@@ -61,3 +62,6 @@ def create_etag(data_src, url, etag_key):
6162

6263
data_src.config.etags[url] = etag
6364
return True
65+
66+
67+
is_cve = re.compile(r"CVE-\d+-\d+", re.IGNORECASE).match

vulnerabilities/importers/project_kb_msr2019.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from vulnerabilities.data_source import Reference
3636
from vulnerabilities.data_source import DataSourceConfiguration
3737
from vulnerabilities.helpers import create_etag
38+
from vulnerabilities.helpers import is_cve
3839

3940

4041
@dataclasses.dataclass
@@ -69,7 +70,7 @@ def to_advisories(csv_reader):
6970
vuln_id, proj_home, fix_commit, _ = row
7071
commit_link = proj_home + "/commit/" + fix_commit
7172

72-
if re.compile(r"CVE-\d+-\d+").match(vuln_id):
73+
if is_cve(vuln_id):
7374
reference = Reference(url=commit_link)
7475

7576
else:

0 commit comments

Comments
 (0)