-
Notifications
You must be signed in to change notification settings - Fork 231
/
Copy pathimporter_yielder.py
246 lines (239 loc) · 7.17 KB
/
importer_yielder.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
# Copyright (c) nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/vulnerablecode/
# The VulnerableCode software is licensed under the Apache License version 2.0.
# Data generated with VulnerableCode require an acknowledgment.
#
# You may not use this software except in compliance with the License.
# You may obtain a copy of the License at: http://apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software distributed
# under the License is distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR
# CONDITIONS OF ANY KIND, either express or implied. See the License for the
# specific language governing permissions and limitations under the License.
#
# When you publish or redistribute any data created with VulnerableCode or any VulnerableCode
# derivative work, you must accompany this data with the following acknowledgment:
#
# Generated with VulnerableCode and provided on an 'AS IS' BASIS, WITHOUT WARRANTIES
# OR CONDITIONS OF ANY KIND, either express or implied. No content created from
# VulnerableCode should be considered or used as legal advice. Consult an Attorney
# for any legal advice.
# VulnerableCode is a free software tool from nexB Inc. and others.
# Visit https://github.com/nexB/vulnerablecode/ for support and download.
from vulnerabilities.models import Importer
IMPORTER_REGISTRY = [
{
'name': 'rust',
'license': 'cc0-1.0',
'last_run': None,
'data_source': 'RustDataSource',
'data_source_cfg': {
'branch': None,
'repository_url': 'https://github.com/RustSec/advisory-db',
},
},
{
'name': 'alpine',
'license': '',
'last_run': None,
'data_source': 'AlpineDataSource',
'data_source_cfg': {
'branch': None,
'repository_url': 'https://gitlab.alpinelinux.org/alpine/infra/alpine-secdb',
},
},
{
'name': 'archlinux',
'license': 'mit',
'last_run': None,
'data_source': 'ArchlinuxDataSource',
'data_source_cfg': {
'archlinux_tracker_url': 'https://security.archlinux.org/json'
},
},
{
'name': 'debian',
'license': 'mit',
'last_run': None,
'data_source': 'DebianDataSource',
'data_source_cfg': {
'debian_tracker_url': 'https://security-tracker.debian.org/tracker/data/json'
},
},
# {
# 'name': 'safetydb',
# 'license': 'cc-by-nc-4.0',
# 'last_run': None,
# 'data_source': 'SafetyDbDataSource',
# 'data_source_cfg': {
# 'url': 'https://raw.githubusercontent.com/pyupio/safety-db/master/data/insecure_full.json', # nopep8
# 'etags': {}
# },
# },
{
'name': 'npm',
'license': 'mit',
'last_run': None,
'data_source': 'NpmDataSource',
'data_source_cfg': {
'repository_url': 'https://github.com/nodejs/security-wg.git'
},
},
{
'name': 'ruby',
'license': '',
'last_run': None,
'data_source': 'RubyDataSource',
'data_source_cfg': {
'repository_url': 'https://github.com/rubysec/ruby-advisory-db.git'
},
},
{
'name': 'ubuntu',
'license': 'gpl-2.0',
'last_run': None,
'data_source': 'UbuntuDataSource',
'data_source_cfg': {
'etags': {},
'releases': ['bionic', 'trusty', 'focal', 'eoan', 'xenial'],
},
},
{
'name': 'retiredotnet',
'license': 'mit',
'last_run': None,
'data_source': 'RetireDotnetDataSource',
'data_source_cfg': {
'repository_url': 'https://github.com/RetireNet/Packages.git'
},
},
{
'name': 'suse_backports',
'license': '',
'last_run': None,
'data_source': 'SUSEBackportsDataSource',
'data_source_cfg': {
'url': 'http://ftp.suse.com/pub/projects/security/yaml/',
'etags': {},
},
},
{
'name': 'debian_oval',
'license': '',
'last_run': None,
'data_source': 'DebianOvalDataSource',
'data_source_cfg': {
'etags': {},
'releases': ['wheezy', 'stretch', 'jessie', 'buster'],
},
},
{
'name': 'redhat',
'license': 'cc-by-4.0',
'last_run': None,
'data_source': 'RedhatDataSource',
'data_source_cfg': {},
},
{
'name': 'nvd',
'license': '',
'last_run': None,
'data_source': 'NVDDataSource',
'data_source_cfg': {
'etags': {},
},
},
{
'name': 'gentoo',
'license': '',
'last_run': None,
'data_source': 'GentooDataSource',
'data_source_cfg': {
'repository_url': 'https://anongit.gentoo.org/git/data/glsa.git'
},
},
{
'name': 'openssl',
'license': '',
'last_run': None,
'data_source': 'OpenSSLDataSource',
'data_source_cfg': {
'etags': {}
},
},
{
'name': 'ubuntu_usn',
'license': 'gpl-2.0',
'last_run': None,
'data_source': 'UbuntuUSNDataSource',
'data_source_cfg': {
'etags': {},
'db_url': 'https://usn.ubuntu.com/usn-db/database-all.json.bz2'
},
},
{
'name': 'github',
'license': '',
'last_run': None,
'data_source': 'GitHubAPIDataSource',
'data_source_cfg': {
'endpoint': 'https://api.github.com/graphql',
'ecosystems': ['MAVEN', 'NUGET', 'COMPOSER']
}
},
{
'name': 'msr2019',
'license': 'apache-2.0',
'last_run': None,
'data_source': 'ProjectKBMSRDataSource',
'data_source_cfg': {
'etag': {}
}
},
{
'name': 'apache_httpd',
'license': '',
'last_run': None,
'data_source': 'ApacheHTTPDDataSource',
'data_source_cfg': {
'etags': {}
},
},
{
'name': 'kaybee',
'license': 'apache-2.0',
'last_run': None,
'data_source': 'KaybeeDataSource',
'data_source_cfg': {
'repository_url': 'https://github.com/SAP/project-kb.git',
'branch': 'vulnerability-data'
},
},
{
'name': 'nginx',
'license': '',
'last_run': None,
'data_source': 'NginxDataSource',
'data_source_cfg': {
'etag': {}
},
},
{
'name': 'postgresql',
'license': '',
'last_run': None,
'data_source': 'PostgreSQLDataSource',
'data_source_cfg': {},
},
]
def load_importers():
for importer in IMPORTER_REGISTRY:
imp, created = Importer.objects.get_or_create(
name=importer['name'],
data_source=importer['data_source'],
license=importer['license'],
)
if created:
# Sets the dynamic fields equal to the default values
imp.data_source_cfg = importer['data_source_cfg']
imp.last_run = importer['last_run']
imp.save()