From cb0d5f4069ed639d4dd0a6030443aea8fdb49c08 Mon Sep 17 00:00:00 2001
From: Shivam Sandbhor
Date: Fri, 18 Dec 2020 16:20:20 +0530
Subject: [PATCH 1/2] Add tests for nginx importers
Signed-off-by: Shivam Sandbhor
---
vulnerabilities/importers/nginx.py | 2 +-
.../test_data/nginx/security_advisories.html | 28 +++
vulnerabilities/tests/test_nginx.py | 187 ++++++++++++++++++
3 files changed, 216 insertions(+), 1 deletion(-)
create mode 100644 vulnerabilities/tests/test_data/nginx/security_advisories.html
create mode 100644 vulnerabilities/tests/test_nginx.py
diff --git a/vulnerabilities/importers/nginx.py b/vulnerabilities/importers/nginx.py
index 0cc1cb7ed..0907b8854 100644
--- a/vulnerabilities/importers/nginx.py
+++ b/vulnerabilities/importers/nginx.py
@@ -51,7 +51,7 @@ def set_api(self):
self.version_api = GitHubTagsAPI()
asyncio.run(self.version_api.load_api(["nginx/nginx"]))
- # For some reason nginx tags it's releases in the form of `release-1.2.3`
+ # For some reason nginx tags it's releases are in the form of `release-1.2.3`
# Chop off the `release-` part here.
for index, version in enumerate(self.version_api.cache["nginx/nginx"]):
self.version_api.cache["nginx/nginx"][index] = version.replace("release-", "")
diff --git a/vulnerabilities/tests/test_data/nginx/security_advisories.html b/vulnerabilities/tests/test_data/nginx/security_advisories.html
new file mode 100644
index 000000000..58f76f064
--- /dev/null
+++ b/vulnerabilities/tests/test_data/nginx/security_advisories.html
@@ -0,0 +1,28 @@
+
+
+
+Patches are signed using one of the
+PGP public keys.
+
+
+
+Stack-based buffer overflow with specially crafted request
Severity: major
Advisory
CVE-2013-2028
Not vulnerable: 1.5.0+, 1.4.1+
Vulnerable: 1.3.9-1.4.0
The patch pgp
+
+
+Vulnerabilities with Windows directory aliases
Severity: medium
Advisory
CVE-2011-4963
Not vulnerable: 1.3.1+, 1.2.1+
Vulnerable: nginx/Windows 0.7.52-1.3.0
+
+
+
+Vulnerabilities with invalid UTF-8 sequence on Windows
Severity: major
CVE-2010-2266
Not vulnerable: 0.8.41+, 0.7.67+
Vulnerable: nginx/Windows 0.7.52-0.8.40
+
+
+
+An error log data are not sanitized
Severity: none
CVE-2009-4487
Not vulnerable: none
Vulnerable: all
+
+
+The renegotiation vulnerability in SSL protocol
Severity: major
VU#120541 CVE-2009-3555
Not vulnerable: 0.8.23+, 0.7.64+
Vulnerable: 0.1.0-0.8.22
The patch pgp
+
+Directory traversal vulnerability
Severity: minor
CVE-2009-3898
Not vulnerable: 0.8.17+, 0.7.63+
Vulnerable: 0.1.0-0.8.16
+/patch.null.pointer.txt">The patch pgp
+
+