Skip to content

Commit 0e119b0

Browse files
committed
Include "version" attribute in debian.extract_vulnerabilities()
Before this change, only "fixed_version" was retained. This is the lowest version of the package that includes a fix for the given vulnerability. However in the meantime, newer versions of the package might have become available in the Debian release passed in as "base_release". Signed-off-by: Haiko Schol <hs@haikoschol.com>
1 parent 97d2491 commit 0e119b0

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

vulnerabilities/scraper/debian.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,16 @@ def extract_vulnerabilities(debian_data, base_release='jessie'):
4848
if not release:
4949
continue
5050

51+
# the latest version of this package in base_release
52+
version = release.get('repositories', {}).get(base_release, '')
53+
5154
package_vulnerabilities.append({
5255
'package_name': package_name,
5356
'vulnerability_id': vulnerability,
5457
'description': details.get('description', ''),
5558
'status': release.get('status', ''),
5659
'urgency': release.get('urgency', ''),
60+
'version': version,
5761
'fixed_version': release.get('fixed_version', '')
5862
})
5963

vulnerabilities/tests/test_scrapers.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def test_debian_extract_vulnerabilities():
7272
'description': 'librsync before 1.0.0 uses a truncated MD4 checksum to match blocks',
7373
'status': 'open',
7474
'urgency': 'low',
75+
'version': '0.9.7-10',
7576
'fixed_version': ''
7677
},
7778
{
@@ -80,6 +81,7 @@ def test_debian_extract_vulnerabilities():
8081
'description': 'Multiple stack-based buffer overflows in mimetex.cgi in mimeTeX',
8182
'status': 'resolved',
8283
'urgency': 'medium',
84+
'version': '1.74-1',
8385
'fixed_version': '1.50-1.1'
8486
},
8587
{
@@ -88,6 +90,7 @@ def test_debian_extract_vulnerabilities():
8890
'description': 'Multiple unspecified vulnerabilities in mimeTeX',
8991
'status': 'resolved',
9092
'urgency': 'medium',
93+
'version': '1.74-1',
9194
'fixed_version': '1.50-1.1'
9295
}
9396
]

0 commit comments

Comments
 (0)