Skip to content

Commit 8a65a97

Browse files
committed
Address review comments
Signed-off-by: Tushar Goel <[email protected]>
1 parent c37f0e4 commit 8a65a97

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

vulnerabilities/importers/xen.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
# See https://aboutcode.org for more information about nexB OSS projects.
88
#
99

10-
import json
11-
12-
import requests
13-
1410
from vulnerabilities.importer import AdvisoryData
1511
from vulnerabilities.importer import Importer
1612
from vulnerabilities.references import XsaReference
@@ -21,14 +17,27 @@
2117
class XenImporter(Importer):
2218

2319
url = "https://xenbits.xen.org/xsa/xsa.json"
24-
spdx_license_expression = ""
25-
license_url = ""
20+
spdx_license_expression = "GPL-2"
21+
license_url = "https://wiki.xenproject.org/wiki/Xen_FAQ_General"
2622

2723
def advisory_data(self):
2824
data = fetch_response(self.url).json()
29-
if not len(data):
25+
# The data looks like this
26+
# [
27+
# {
28+
# "xsas": [
29+
# {
30+
# "cve": [
31+
# "CVE-2012-5510"
32+
# ],
33+
# "title": "XSA-1: Xen security advisory",
34+
# }
35+
# ]
36+
# }
37+
# ]
38+
if not data:
3039
return []
31-
xsas = data[0].get("xsas") or []
40+
xsas = data[0]["xsas"]
3241
for xsa in xsas:
3342
yield from self.to_advisories(xsa)
3443

vulnerabilities/tests/test_xen.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
#
2+
# Copyright (c) nexB Inc. and others. All rights reserved.
3+
# VulnerableCode is a trademark of nexB Inc.
4+
# SPDX-License-Identifier: Apache-2.0
5+
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6+
# See https://github.com/nexB/vulnerablecode for support or download.
7+
# See https://aboutcode.org for more information about nexB OSS projects.
8+
#
9+
110
import json
211
import os
312

0 commit comments

Comments
 (0)