Skip to content

Commit d74d9fa

Browse files
committed
Fix tests
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
1 parent 1545ea0 commit d74d9fa

7 files changed

Lines changed: 33 additions & 33 deletions

File tree

vulnerabilities/importer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,8 @@ class AdvisoryData:
252252
def __post_init__(self):
253253
if self.date_published and not self.date_published.tzinfo:
254254
logger.warning(f"AdvisoryData with no tzinfo: {self!r}")
255-
self.summary = self.clean_summary(self.summary)
255+
if self.summary:
256+
self.summary = self.clean_summary(self.summary)
256257

257258
def clean_summary(self, summary):
258259
# https://nvd.nist.gov/vuln/detail/CVE-2013-4314

vulnerabilities/tests/test_data/elixir_security/elixir-expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"aliases": [
44
"CVE-2018-20301"
55
],
6-
"summary": "The Coherence library has \"Mass Assignment\"-like vulnerabilities.\n",
6+
"summary": "The Coherence library has \"Mass Assignment\"-like vulnerabilities.",
77
"affected_packages": [
88
{
99
"package": {

vulnerabilities/tests/test_data/elixir_security/elixir-improver-expected.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"CVE-2018-20301"
66
],
77
"confidence": 100,
8-
"summary": "The Coherence library has \"Mass Assignment\"-like vulnerabilities.\n",
8+
"summary": "The Coherence library has \"Mass Assignment\"-like vulnerabilities.",
99
"affected_purls": [
1010
{
1111
"type": "hex",
@@ -39,7 +39,7 @@
3939
"CVE-2018-20301"
4040
],
4141
"confidence": 100,
42-
"summary": "The Coherence library has \"Mass Assignment\"-like vulnerabilities.\n",
42+
"summary": "The Coherence library has \"Mass Assignment\"-like vulnerabilities.",
4343
"affected_purls": [],
4444
"fixed_purl": null,
4545
"references": [

vulnerabilities/tests/test_data/gentoo/gentoo-expected.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"aliases": [
44
"CVE-2017-9800"
55
],
6-
"summary": "A command injection vulnerability in Subversion may allow remote\n attackers to execute arbitrary code.\n ",
6+
"summary": "A command injection vulnerability in Subversion may allow remote\n attackers to execute arbitrary code.",
77
"affected_packages": [
88
{
99
"package": {

vulnerabilities/tests/test_data/github_api/npm-expected.json

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,6 @@
345345
],
346346
"date_published": "2022-11-28T22:06:24+00:00",
347347
"weaknesses": []
348-
349348
},
350349
{
351350
"aliases": [
@@ -584,7 +583,7 @@
584583
"CVE-2022-41940",
585584
"GHSA-r7qp-cfhv-p84w"
586585
],
587-
"summary": "Uncaught exception in engine.io ",
586+
"summary": "Uncaught exception in engine.io",
588587
"affected_packages": [
589588
{
590589
"package": {
@@ -646,7 +645,7 @@
646645
"CVE-2022-41940",
647646
"GHSA-r7qp-cfhv-p84w"
648647
],
649-
"summary": "Uncaught exception in engine.io ",
648+
"summary": "Uncaught exception in engine.io",
650649
"affected_packages": [
651650
{
652651
"package": {
@@ -708,7 +707,7 @@
708707
"CVE-2022-41919",
709708
"GHSA-3fjj-p79j-c9hh"
710709
],
711-
"summary": "Fastify: Incorrect Content-Type parsing can lead to CSRF attack ",
710+
"summary": "Fastify: Incorrect Content-Type parsing can lead to CSRF attack",
712711
"affected_packages": [
713712
{
714713
"package": {
@@ -770,7 +769,7 @@
770769
"CVE-2022-41919",
771770
"GHSA-3fjj-p79j-c9hh"
772771
],
773-
"summary": "Fastify: Incorrect Content-Type parsing can lead to CSRF attack ",
772+
"summary": "Fastify: Incorrect Content-Type parsing can lead to CSRF attack",
774773
"affected_packages": [
775774
{
776775
"package": {
@@ -1451,7 +1450,7 @@
14511450
"aliases": [
14521451
"GHSA-3qmc-2r76-4rqp"
14531452
],
1454-
"summary": "Redwood is vulnerable to account takeover via dbAuth \"forgot-password\" ",
1453+
"summary": "Redwood is vulnerable to account takeover via dbAuth \"forgot-password\"",
14551454
"affected_packages": [
14561455
{
14571456
"package": {
@@ -1517,7 +1516,7 @@
15171516
"aliases": [
15181517
"GHSA-3qmc-2r76-4rqp"
15191518
],
1520-
"summary": "Redwood is vulnerable to account takeover via dbAuth \"forgot-password\" ",
1519+
"summary": "Redwood is vulnerable to account takeover via dbAuth \"forgot-password\"",
15211520
"affected_packages": [
15221521
{
15231522
"package": {
@@ -4234,7 +4233,7 @@
42344233
"CVE-2022-25918",
42354234
"GHSA-cr84-xvw4-qx3c"
42364235
],
4237-
"summary": "Inefficient Regular Expression Complexity in shescape ",
4236+
"summary": "Inefficient Regular Expression Complexity in shescape",
42384237
"affected_packages": [
42394238
{
42404239
"package": {

vulnerabilities/tests/test_data/mozilla/expected-yml.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"aliases": [
44
"CVE-2022-22746"
55
],
6-
"summary": "A race condition could have allowed bypassing the fullscreen notification which could have lead to a fullscreen window spoof being unnoticed.*This bug only affects Firefox for Windows. Other operating systems are unaffected.*\n",
6+
"summary": "A race condition could have allowed bypassing the fullscreen notification which could have lead to a fullscreen window spoof being unnoticed.*This bug only affects Firefox for Windows. Other operating systems are unaffected.*",
77
"affected_packages": [
88
{
99
"package": {
@@ -38,7 +38,7 @@
3838
"aliases": [
3939
"CVE-2022-22743"
4040
],
41-
"summary": "When navigating from inside an iframe while requesting fullscreen access, an attacker-controlled tab could have made the browser unable to leave fullscreen mode.\n",
41+
"summary": "When navigating from inside an iframe while requesting fullscreen access, an attacker-controlled tab could have made the browser unable to leave fullscreen mode.",
4242
"affected_packages": [],
4343
"references": [
4444
{
@@ -60,7 +60,7 @@
6060
"aliases": [
6161
"CVE-2022-22742"
6262
],
63-
"summary": "When inserting text while in edit mode, some characters might have lead to out-of-bounds memory access causing a potentially exploitable crash.\n",
63+
"summary": "When inserting text while in edit mode, some characters might have lead to out-of-bounds memory access causing a potentially exploitable crash.",
6464
"affected_packages": [],
6565
"references": [
6666
{
@@ -82,7 +82,7 @@
8282
"aliases": [
8383
"CVE-2022-22741"
8484
],
85-
"summary": "When resizing a popup while requesting fullscreen access, the popup would have become unable to leave fullscreen mode.\n",
85+
"summary": "When resizing a popup while requesting fullscreen access, the popup would have become unable to leave fullscreen mode.",
8686
"affected_packages": [],
8787
"references": [
8888
{
@@ -104,7 +104,7 @@
104104
"aliases": [
105105
"CVE-2022-22740"
106106
],
107-
"summary": "Certain network request objects were freed too early when releasing a network request handle. This could have lead to a use-after-free causing a potentially exploitable crash.\n",
107+
"summary": "Certain network request objects were freed too early when releasing a network request handle. This could have lead to a use-after-free causing a potentially exploitable crash.",
108108
"affected_packages": [],
109109
"references": [
110110
{
@@ -126,7 +126,7 @@
126126
"aliases": [
127127
"CVE-2022-22738"
128128
],
129-
"summary": "Applying a CSS filter effect could have accessed out of bounds memory. This could have lead to a heap-buffer-overflow causing a potentially exploitable crash.\n",
129+
"summary": "Applying a CSS filter effect could have accessed out of bounds memory. This could have lead to a heap-buffer-overflow causing a potentially exploitable crash.",
130130
"affected_packages": [],
131131
"references": [
132132
{
@@ -148,7 +148,7 @@
148148
"aliases": [
149149
"CVE-2022-22737"
150150
],
151-
"summary": "Constructing audio sinks could have lead to a race condition when playing audio files and closing windows. This could have lead to a use-after-free causing a potentially exploitable crash.\n",
151+
"summary": "Constructing audio sinks could have lead to a race condition when playing audio files and closing windows. This could have lead to a use-after-free causing a potentially exploitable crash.",
152152
"affected_packages": [],
153153
"references": [
154154
{
@@ -170,7 +170,7 @@
170170
"aliases": [
171171
"CVE-2021-4140"
172172
],
173-
"summary": "It was possible to construct specific XSLT markup that would be able to bypass an iframe sandbox.\n",
173+
"summary": "It was possible to construct specific XSLT markup that would be able to bypass an iframe sandbox.",
174174
"affected_packages": [],
175175
"references": [
176176
{
@@ -192,7 +192,7 @@
192192
"aliases": [
193193
"CVE-2022-22750"
194194
],
195-
"summary": "By generally accepting and passing resource handles across processes, a compromised content process might have confused higher privileged processes to interact with handles that the unprivileged process should not have access to.*This bug only affects Firefox for Windows and MacOS. Other operating systems are unaffected.*\n",
195+
"summary": "By generally accepting and passing resource handles across processes, a compromised content process might have confused higher privileged processes to interact with handles that the unprivileged process should not have access to.*This bug only affects Firefox for Windows and MacOS. Other operating systems are unaffected.*",
196196
"affected_packages": [],
197197
"references": [
198198
{
@@ -214,7 +214,7 @@
214214
"aliases": [
215215
"CVE-2022-22749"
216216
],
217-
"summary": "When scanning QR codes, Firefox for Android would have allowed navigation to some URLs that do not point to web content.*This bug only affects Firefox for Android. Other operating systems are unaffected.*\n",
217+
"summary": "When scanning QR codes, Firefox for Android would have allowed navigation to some URLs that do not point to web content.*This bug only affects Firefox for Android. Other operating systems are unaffected.*",
218218
"affected_packages": [],
219219
"references": [
220220
{
@@ -236,7 +236,7 @@
236236
"aliases": [
237237
"CVE-2022-22748"
238238
],
239-
"summary": "Malicious websites could have confused Firefox into showing the wrong origin when asking to launch a program and handling an external URL protocol.\n",
239+
"summary": "Malicious websites could have confused Firefox into showing the wrong origin when asking to launch a program and handling an external URL protocol.",
240240
"affected_packages": [],
241241
"references": [
242242
{
@@ -258,7 +258,7 @@
258258
"aliases": [
259259
"CVE-2022-22745"
260260
],
261-
"summary": "Securitypolicyviolation events could have leaked cross-origin information for frame-ancestors violations\n",
261+
"summary": "Securitypolicyviolation events could have leaked cross-origin information for frame-ancestors violations",
262262
"affected_packages": [],
263263
"references": [
264264
{
@@ -280,7 +280,7 @@
280280
"aliases": [
281281
"CVE-2022-22744"
282282
],
283-
"summary": "The constructed curl command from the \"Copy as curl\" feature in DevTools was not properly escaped for PowerShell. This could have lead to command injection if pasted into a Powershell prompt.*This bug only affects Firefox for Windows. Other operating systems are unaffected.*\n",
283+
"summary": "The constructed curl command from the \"Copy as curl\" feature in DevTools was not properly escaped for PowerShell. This could have lead to command injection if pasted into a Powershell prompt.*This bug only affects Firefox for Windows. Other operating systems are unaffected.*",
284284
"affected_packages": [],
285285
"references": [
286286
{
@@ -302,7 +302,7 @@
302302
"aliases": [
303303
"CVE-2022-22763"
304304
],
305-
"summary": "When a worker is shutdown, it was possible to cause script to run late in the lifecycle, at a point after where it should not be possible.\n",
305+
"summary": "When a worker is shutdown, it was possible to cause script to run late in the lifecycle, at a point after where it should not be possible.",
306306
"affected_packages": [],
307307
"references": [
308308
{
@@ -324,7 +324,7 @@
324324
"aliases": [
325325
"CVE-2022-22747"
326326
],
327-
"summary": "After accepting an untrusted certificate, handling an empty pkcs7 sequence as part of the certificate data could have lead to a crash. This crash is believed to be unexploitable.\n",
327+
"summary": "After accepting an untrusted certificate, handling an empty pkcs7 sequence as part of the certificate data could have lead to a crash. This crash is believed to be unexploitable.",
328328
"affected_packages": [],
329329
"references": [
330330
{
@@ -346,7 +346,7 @@
346346
"aliases": [
347347
"CVE-2022-22736"
348348
],
349-
"summary": "If Firefox was installed to a world-writable directory, a local privilege escalation could occur when Firefox searched the current directory for system libraries. However the install directory is not world-writable by default.*This bug only affects Firefox for Windows in a non-default installation. Other operating systems are unaffected.*\n",
349+
"summary": "If Firefox was installed to a world-writable directory, a local privilege escalation could occur when Firefox searched the current directory for system libraries. However the install directory is not world-writable by default.*This bug only affects Firefox for Windows in a non-default installation. Other operating systems are unaffected.*",
350350
"affected_packages": [],
351351
"references": [
352352
{
@@ -368,7 +368,7 @@
368368
"aliases": [
369369
"CVE-2022-22739"
370370
],
371-
"summary": "Malicious websites could have tricked users into accepting launching a program to handle an external URL protocol.\n",
371+
"summary": "Malicious websites could have tricked users into accepting launching a program to handle an external URL protocol.",
372372
"affected_packages": [],
373373
"references": [
374374
{
@@ -390,7 +390,7 @@
390390
"aliases": [
391391
"CVE-2022-22751"
392392
],
393-
"summary": "Mozilla developers Calixte Denizet, Kershaw Chang, Christian Holler, Jason Kratzer, Gabriele Svelto, Tyson Smith, Simon Giesecke, and Steve Fink reported memory safety bugs present in Firefox 95 and Firefox ESR 91.4. Some of these bugs showed evidence of memory corruption and we presume that with enough effort some of these could have been exploited to run arbitrary code.\n",
393+
"summary": "Mozilla developers Calixte Denizet, Kershaw Chang, Christian Holler, Jason Kratzer, Gabriele Svelto, Tyson Smith, Simon Giesecke, and Steve Fink reported memory safety bugs present in Firefox 95 and Firefox ESR 91.4. Some of these bugs showed evidence of memory corruption and we presume that with enough effort some of these could have been exploited to run arbitrary code.",
394394
"affected_packages": [],
395395
"references": [
396396
{
@@ -412,7 +412,7 @@
412412
"aliases": [
413413
"CVE-2022-22752"
414414
],
415-
"summary": "Mozilla developers Christian Holler and Jason Kratzer reported memory safety bugs present in Firefox 95. Some of these bugs showed evidence of memory corruption and we presume that with enough effort some of these could have been exploited to run arbitrary code.\n",
415+
"summary": "Mozilla developers Christian Holler and Jason Kratzer reported memory safety bugs present in Firefox 95. Some of these bugs showed evidence of memory corruption and we presume that with enough effort some of these could have been exploited to run arbitrary code.",
416416
"affected_packages": [],
417417
"references": [
418418
{

vulnerabilities/tests/test_import_runner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,4 @@ def test_advisory_summary_clean_up():
105105
adv = AdvisoryData(
106106
summary="The X509Extension in pyOpenSSL before 0.13.1 does not properly handle a '\x00' character in a domain name in the Subject Alternative Name field of an X.509 certificate, which allows man-in-the-middle attackers to spoof arbitrary SSL servers via a crafted certificate issued by a legitimate Certification Authority."
107107
)
108-
assert '\x00' not in adv.summary
108+
assert "\x00" not in adv.summary

0 commit comments

Comments
 (0)