Skip to content

Commit a5e7bd4

Browse files
committed
Update gentoo importer to include rle, rgt, and rge versions.
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
1 parent 5ef6840 commit a5e7bd4

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

vulnerabilities/pipelines/v2_importers/gentoo_importer.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,16 +170,20 @@ def get_safe_and_affected_constraints(pkg):
170170
affected_versions = set()
171171
for info in pkg:
172172
# All possible values of info.attrib['range'] =
173-
# {'gt', 'lt', 'rle', 'rge', 'rgt', 'le', 'ge', 'eq'}, out of
174-
# which ('rle', 'rge', 'rgt') are ignored, because they compare
175-
# 'release' not the 'version'.
173+
# {'gt', 'lt', 'rle', 'rge', 'rgt', 'le', 'ge', 'eq'}
176174
range_value = info.attrib.get("range")
177175
slot_value = info.attrib.get("slot")
178-
comparator_dict = {"gt": ">", "lt": "<", "ge": ">=", "le": "<=", "eq": "="}
176+
comparator_dict = {
177+
"gt": ">",
178+
"lt": "<",
179+
"ge": ">=",
180+
"le": "<=",
181+
"eq": "=",
182+
"rle": "<=",
183+
"rge": ">=",
184+
"rgt": ">",
185+
}
179186
comparator = comparator_dict.get(range_value)
180-
if not comparator:
181-
continue
182-
183187
if info.tag == "unaffected":
184188
safe_versions.add((comparator, info.text, slot_value))
185189

vulnerabilities/tests/test_data/gentoo_v2/glsa-201709-09-expected.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,20 @@
3333
"fixed_version_range": null,
3434
"introduced_by_commit_patches": [],
3535
"fixed_by_commit_patches": []
36+
},
37+
{
38+
"package": {
39+
"type": "ebuild",
40+
"namespace": "dev-vcs",
41+
"name": "subversion",
42+
"version": "",
43+
"qualifiers": "",
44+
"subpath": ""
45+
},
46+
"affected_version_range": "vers:ebuild/<=1.8.18",
47+
"fixed_version_range": null,
48+
"introduced_by_commit_patches": [],
49+
"fixed_by_commit_patches": []
3650
}
3751
],
3852
"references_v2": [

0 commit comments

Comments
 (0)