Skip to content

Commit c342565

Browse files
committed
Disable suse backportimporter and refactor suse score importer
Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
1 parent db628f0 commit c342565

5 files changed

Lines changed: 133 additions & 137 deletions

File tree

vulnerabilities/importer_yielder.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@
9797
"data_source": "RetireDotnetDataSource",
9898
"data_source_cfg": {"repository_url": "https://github.com/RetireNet/Packages.git"},
9999
},
100-
{
101-
"name": "suse_backports",
102-
"license": "",
103-
"last_run": None,
104-
"data_source": "SUSEBackportsDataSource",
105-
"data_source_cfg": {"url": "http://ftp.suse.com/pub/projects/security/yaml/", "etags": {}},
106-
},
100+
# {
101+
# "name": "suse_backports",
102+
# "license": "",
103+
# "last_run": None,
104+
# "data_source": "SUSEBackportsDataSource",
105+
# "data_source_cfg": {"url": "http://ftp.suse.com/pub/projects/security/yaml/", "etags": {}},
106+
# },
107107
{
108108
"name": "suse_scores",
109109
"license": "",

vulnerabilities/importers/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@
4343
from vulnerabilities.importers.ruby import RubyDataSource
4444
from vulnerabilities.importers.rust import RustDataSource
4545
from vulnerabilities.importers.safety_db import SafetyDbDataSource
46-
from vulnerabilities.importers.suse_backports import SUSEBackportsDataSource
4746
from vulnerabilities.importers.suse_scores import SUSESeverityScoreDataSource
4847
from vulnerabilities.importers.ubuntu import UbuntuDataSource
4948
from vulnerabilities.importers.ubuntu_usn import UbuntuUSNDataSource
5049
from vulnerabilities.importers.istio import IstioDataSource
50+
51+
# from vulnerabilities.importers.suse_backports import SUSEBackportsDataSource

vulnerabilities/importers/suse_scores.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ def to_advisory(score_data):
7575
Advisory(
7676
vulnerability_id=cve_id,
7777
summary="",
78-
impacted_package_urls=[],
7978
references=[Reference(url=URL, severities=severities)],
8079
)
8180
)
Lines changed: 124 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,135 +1,135 @@
1-
# Copyright (c) 2017 nexB Inc. and others. All rights reserved.
2-
# http://nexb.com and https://github.com/nexB/vulnerablecode/
3-
# The VulnerableCode software is licensed under the Apache License version 2.0.
4-
# Data generated with VulnerableCode require an acknowledgment.
5-
#
6-
# You may not use this software except in compliance with the License.
7-
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
8-
# Unless required by applicable law or agreed to in writing, software distributed
9-
# under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10-
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
11-
# specific language governing permissions and limitations under the License.
12-
#
13-
# When you publish or redistribute any data created with VulnerableCode or any VulnerableCode
14-
# derivative work, you must accompany this data with the following acknowledgment:
15-
#
16-
# Generated with VulnerableCode and provided on an "AS IS" BASIS, WITHOUT WARRANTIES
17-
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from
18-
# VulnerableCode should be considered or used as legal advice. Consult an Attorney
19-
# for any legal advice.
20-
# VulnerableCode is a free software code scanning tool from nexB Inc. and others.
21-
# Visit https://github.com/nexB/vulnerablecode/ for support and download.
1+
# # Copyright (c) 2017 nexB Inc. and others. All rights reserved.
2+
# # http://nexb.com and https://github.com/nexB/vulnerablecode/
3+
# # The VulnerableCode software is licensed under the Apache License version 2.0.
4+
# # Data generated with VulnerableCode require an acknowledgment.
5+
# #
6+
# # You may not use this software except in compliance with the License.
7+
# # You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
8+
# # Unless required by applicable law or agreed to in writing, software distributed
9+
# # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10+
# # CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
# # specific language governing permissions and limitations under the License.
12+
# #
13+
# # When you publish or redistribute any data created with VulnerableCode or any VulnerableCode
14+
# # derivative work, you must accompany this data with the following acknowledgment:
15+
# #
16+
# # Generated with VulnerableCode and provided on an "AS IS" BASIS, WITHOUT WARRANTIES
17+
# # OR CONDITIONS OF ANY KIND, either express or implied. No content created from
18+
# # VulnerableCode should be considered or used as legal advice. Consult an Attorney
19+
# # for any legal advice.
20+
# # VulnerableCode is a free software code scanning tool from nexB Inc. and others.
21+
# # Visit https://github.com/nexB/vulnerablecode/ for support and download.
2222

23-
from collections import OrderedDict
24-
import os
25-
from unittest import TestCase
26-
import yaml
23+
# from collections import OrderedDict
24+
# import os
25+
# from unittest import TestCase
26+
# import yaml
2727

28-
from packageurl import PackageURL
28+
# from packageurl import PackageURL
2929

30-
from vulnerabilities.importers.suse_backports import SUSEBackportsDataSource
31-
from vulnerabilities.data_source import Advisory
30+
# from vulnerabilities.importers.suse_backports import SUSEBackportsDataSource
31+
# from vulnerabilities.data_source import Advisory
3232

33-
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
33+
# BASE_DIR = os.path.dirname(os.path.abspath(__file__))
3434

3535

36-
def yaml_loader():
37-
path = os.path.join(BASE_DIR, "test_data/suse_backports/")
38-
yaml_files = {}
39-
for file in os.listdir(path):
40-
with open(os.path.join(path, file)) as f:
41-
yaml_files[file] = yaml.safe_load(f)
42-
return yaml_files
36+
# def yaml_loader():
37+
# path = os.path.join(BASE_DIR, "test_data/suse_backports/")
38+
# yaml_files = {}
39+
# for file in os.listdir(path):
40+
# with open(os.path.join(path, file)) as f:
41+
# yaml_files[file] = yaml.safe_load(f)
42+
# return yaml_files
4343

4444

45-
class TestSUSEBackportsDataSource(TestCase):
46-
@classmethod
47-
def setUpClass(cls):
48-
data_source_cfg = {"url": "https://endpoint.com", "etags": {}}
49-
cls.data_src = SUSEBackportsDataSource(1, config=data_source_cfg)
45+
# class TestSUSEBackportsDataSource(TestCase):
46+
# @classmethod
47+
# def setUpClass(cls):
48+
# data_source_cfg = {"url": "https://endpoint.com", "etags": {}}
49+
# cls.data_src = SUSEBackportsDataSource(1, config=data_source_cfg)
5050

51-
def test_process_file(self):
52-
parsed_yamls = yaml_loader()
53-
expected_data = [
54-
Advisory(
55-
summary="",
56-
impacted_package_urls=[],
57-
resolved_package_urls=[
58-
PackageURL(
59-
type="rpm",
60-
namespace="opensuse",
61-
name="MozillaFirefox",
62-
version="3.0.10-1.1.1",
63-
qualifiers=OrderedDict(),
64-
subpath=None,
65-
)
66-
],
67-
vulnerability_id="CVE-2009-1313",
68-
),
69-
Advisory(
70-
summary="",
71-
impacted_package_urls=[],
72-
resolved_package_urls=[
73-
PackageURL(
74-
type="rpm",
75-
namespace="opensuse",
76-
name="MozillaFirefox-branding-SLED",
77-
version="3.5-1.1.5",
78-
qualifiers=OrderedDict(),
79-
subpath=None,
80-
)
81-
],
82-
vulnerability_id="CVE-2009-1313",
83-
),
84-
Advisory(
85-
summary="",
86-
impacted_package_urls=[],
87-
resolved_package_urls=[
88-
PackageURL(
89-
type="rpm",
90-
namespace="opensuse",
91-
name="MozillaFirefox-translations",
92-
version="3.0.10-1.1.1",
93-
qualifiers=OrderedDict(),
94-
subpath=None,
95-
)
96-
],
97-
vulnerability_id="CVE-2009-1313",
98-
),
99-
Advisory(
100-
summary="",
101-
impacted_package_urls=[],
102-
resolved_package_urls=[
103-
PackageURL(
104-
type="rpm",
105-
namespace="opensuse",
106-
name="NetworkManager",
107-
version="0.7.0.r4359-15.9.2",
108-
qualifiers=OrderedDict(),
109-
subpath=None,
110-
)
111-
],
112-
vulnerability_id="CVE-2009-0365",
113-
),
114-
Advisory(
115-
summary="",
116-
impacted_package_urls=[],
117-
resolved_package_urls=[
118-
PackageURL(
119-
type="rpm",
120-
namespace="opensuse",
121-
name="NetworkManager",
122-
version="0.7.0.r4359-15.9.2",
123-
qualifiers=OrderedDict(),
124-
subpath=None,
125-
)
126-
],
127-
vulnerability_id="CVE-2009-0578",
128-
),
129-
]
51+
# def test_process_file(self):
52+
# parsed_yamls = yaml_loader()
53+
# expected_data = [
54+
# Advisory(
55+
# summary="",
56+
# impacted_package_urls=[],
57+
# resolved_package_urls=[
58+
# PackageURL(
59+
# type="rpm",
60+
# namespace="opensuse",
61+
# name="MozillaFirefox",
62+
# version="3.0.10-1.1.1",
63+
# qualifiers=OrderedDict(),
64+
# subpath=None,
65+
# )
66+
# ],
67+
# vulnerability_id="CVE-2009-1313",
68+
# ),
69+
# Advisory(
70+
# summary="",
71+
# impacted_package_urls=[],
72+
# resolved_package_urls=[
73+
# PackageURL(
74+
# type="rpm",
75+
# namespace="opensuse",
76+
# name="MozillaFirefox-branding-SLED",
77+
# version="3.5-1.1.5",
78+
# qualifiers=OrderedDict(),
79+
# subpath=None,
80+
# )
81+
# ],
82+
# vulnerability_id="CVE-2009-1313",
83+
# ),
84+
# Advisory(
85+
# summary="",
86+
# impacted_package_urls=[],
87+
# resolved_package_urls=[
88+
# PackageURL(
89+
# type="rpm",
90+
# namespace="opensuse",
91+
# name="MozillaFirefox-translations",
92+
# version="3.0.10-1.1.1",
93+
# qualifiers=OrderedDict(),
94+
# subpath=None,
95+
# )
96+
# ],
97+
# vulnerability_id="CVE-2009-1313",
98+
# ),
99+
# Advisory(
100+
# summary="",
101+
# impacted_package_urls=[],
102+
# resolved_package_urls=[
103+
# PackageURL(
104+
# type="rpm",
105+
# namespace="opensuse",
106+
# name="NetworkManager",
107+
# version="0.7.0.r4359-15.9.2",
108+
# qualifiers=OrderedDict(),
109+
# subpath=None,
110+
# )
111+
# ],
112+
# vulnerability_id="CVE-2009-0365",
113+
# ),
114+
# Advisory(
115+
# summary="",
116+
# impacted_package_urls=[],
117+
# resolved_package_urls=[
118+
# PackageURL(
119+
# type="rpm",
120+
# namespace="opensuse",
121+
# name="NetworkManager",
122+
# version="0.7.0.r4359-15.9.2",
123+
# qualifiers=OrderedDict(),
124+
# subpath=None,
125+
# )
126+
# ],
127+
# vulnerability_id="CVE-2009-0578",
128+
# ),
129+
# ]
130130

131-
found_data = self.data_src.process_file(parsed_yamls["backports-sle11-sp0.yaml"])
131+
# found_data = self.data_src.process_file(parsed_yamls["backports-sle11-sp0.yaml"])
132132

133-
found_advisories = list(map(Advisory.normalized, found_data))
134-
expected_advisories = list(map(Advisory.normalized, expected_data))
135-
assert sorted(found_advisories) == sorted(expected_advisories)
133+
# found_advisories = list(map(Advisory.normalized, found_data))
134+
# expected_advisories = list(map(Advisory.normalized, expected_data))
135+
# assert sorted(found_advisories) == sorted(expected_advisories)

vulnerabilities/tests/test_suse_scores.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ def test_to_advisory(self):
4040
expected_data = [
4141
Advisory(
4242
summary="",
43-
impacted_package_urls=[],
44-
resolved_package_urls=[],
4543
references=[
4644
Reference(
4745
reference_id="",
@@ -90,8 +88,6 @@ def test_to_advisory(self):
9088
),
9189
Advisory(
9290
summary="",
93-
impacted_package_urls=[],
94-
resolved_package_urls=[],
9591
references=[
9692
Reference(
9793
reference_id="",

0 commit comments

Comments
 (0)