Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Tushar Goel <[email protected]>
  • Loading branch information
TG1999 committed Jan 5, 2023
1 parent 4335d98 commit 0c3c6cc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
25 changes: 17 additions & 8 deletions vulnerabilities/importers/xen.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
# See https://aboutcode.org for more information about nexB OSS projects.
#

import json

import requests

from vulnerabilities.importer import AdvisoryData
from vulnerabilities.importer import Importer
from vulnerabilities.references import XsaReference
Expand All @@ -21,14 +17,27 @@
class XenImporter(Importer):

url = "https://xenbits.xen.org/xsa/xsa.json"
spdx_license_expression = ""
license_url = ""
spdx_license_expression = "GPL-2"
license_url = "https://wiki.xenproject.org/wiki/Xen_FAQ_General"

def advisory_data(self):
data = fetch_response(self.url).json()
if not len(data):
# The data looks like this
# [
# {
# "xsas": [
# {
# "cve": [
# "CVE-2012-5510"
# ],
# "title": "XSA-1: Xen security advisory",
# }
# ]
# }
# ]
if not data:
return []
xsas = data[0].get("xsas") or []
xsas = data[0]["xsas"]
for xsa in xsas:
yield from self.to_advisories(xsa)

Expand Down
9 changes: 9 additions & 0 deletions vulnerabilities/tests/test_xen.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
#
# Copyright (c) nexB Inc. and others. All rights reserved.
# VulnerableCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/vulnerablecode for support or download.
# See https://aboutcode.org for more information about nexB OSS projects.
#

import json
import os

Expand Down

0 comments on commit 0c3c6cc

Please sign in to comment.