Skip to content

Commit 512f39a

Browse files
committed
Fix nginx importer to correctly assign windows qualifiers
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
1 parent 0d2f504 commit 512f39a

2 files changed

Lines changed: 5 additions & 11 deletions

File tree

vulnerabilities/pipelines/v2_importers/nginx_importer.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class NginxImporterPipeline(VulnerableCodeBaseImporterPipelineV2):
3636
spdx_license_expression = "BSD-2-Clause"
3737
license_url = "https://nginx.org/LICENSE"
3838
url = "https://nginx.org/en/security_advisories.html"
39-
importer_name = "Nginx Importer"
4039

4140
@classmethod
4241
def steps(cls):
@@ -83,9 +82,6 @@ def to_advisory_data(nginx_adv: NginxAdvisory) -> AdvisoryData:
8382
Return AdvisoryData from an NginxAdvisory tuple.
8483
"""
8584
qualifiers = {}
86-
87-
purl = PackageURL(type="nginx", name="nginx", qualifiers=qualifiers)
88-
8985
_, _, affected_versions = nginx_adv.vulnerable.partition(":")
9086
affected_versions = affected_versions.strip()
9187

@@ -96,9 +92,7 @@ def to_advisory_data(nginx_adv: NginxAdvisory) -> AdvisoryData:
9692
_, _, fixed_versions = nginx_adv.not_vulnerable.partition(":")
9793
fixed_versions = fixed_versions.strip()
9894

99-
if "nginx/Windows" in fixed_versions:
100-
qualifiers["os"] = "windows"
101-
fixed_versions = fixed_versions.replace("nginx/Windows", "")
95+
purl = PackageURL(type="nginx", name="nginx", qualifiers=qualifiers)
10296

10397
fixed_version_range = None
10498
try:

vulnerabilities/tests/test_data/nginx_v2/security_advisories-advisory_data-expected.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,7 +1188,7 @@
11881188
"namespace": "",
11891189
"name": "nginx",
11901190
"version": "",
1191-
"qualifiers": "",
1191+
"qualifiers": "os=windows",
11921192
"subpath": ""
11931193
},
11941194
"affected_version_range": "vers:nginx/>=0.7.52|<=1.3.0",
@@ -1357,7 +1357,7 @@
13571357
"namespace": "",
13581358
"name": "nginx",
13591359
"version": "",
1360-
"qualifiers": "",
1360+
"qualifiers": "os=windows",
13611361
"subpath": ""
13621362
},
13631363
"affected_version_range": "vers:nginx/>=0.7.52|<=0.8.40",
@@ -1390,7 +1390,7 @@
13901390
"namespace": "",
13911391
"name": "nginx",
13921392
"version": "",
1393-
"qualifiers": "",
1393+
"qualifiers": "os=windows",
13941394
"subpath": ""
13951395
},
13961396
"affected_version_range": "vers:nginx/>=0.7.52|<=0.8.39",
@@ -1423,7 +1423,7 @@
14231423
"namespace": "",
14241424
"name": "nginx",
14251425
"version": "",
1426-
"qualifiers": "",
1426+
"qualifiers": "os=windows",
14271427
"subpath": ""
14281428
},
14291429
"affected_version_range": "vers:nginx/>=0.7.52|<=0.8.32",

0 commit comments

Comments
 (0)