Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CVE identifier to Vulnerability class #308

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions safety/safety.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


class Vulnerability(namedtuple("Vulnerability",
["name", "spec", "version", "advisory", "vuln_id"])):
["name", "spec", "version", "advisory", "vuln_id", "cve"])):
pass


Expand Down Expand Up @@ -156,7 +156,8 @@ def check(packages, key, db_mirror, cached, ignore_ids, proxy):
spec=specifier,
version=pkg.version,
advisory=data.get("advisory"),
vuln_id=vuln_id
vuln_id=vuln_id,
cve=data.get("cve")
)
)
return vulnerable
Expand All @@ -171,6 +172,7 @@ def review(vulnerabilities):
"version": vuln[2],
"advisory": vuln[3],
"vuln_id": vuln[4],
"cve": vuln[5],
}
vulnerable.append(
Vulnerability(**current_vuln)
Expand Down
9 changes: 6 additions & 3 deletions tests/test_db/example_report.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@
"<1.2.7",
"1.2.2",
"django.contrib.sessions in Django before 1.2.7 and 1.3.x before 1.3.1, when session data is stored in the cache, uses the root namespace for both session identifiers and application-data keys, which allows remote attackers to modify a session by triggering use of a key that is equal to that session's identifier.",
"33063"
"33063",
"CVE-2011-4136"
],
[
"django",
"<1.2.7",
"1.2.2",
"The verify_exists functionality in the URLField implementation in Django before 1.2.7 and 1.3.x before 1.3.1 relies on Python libraries that attempt access to an arbitrary URL with no timeout, which allows remote attackers to cause a denial of service (resource consumption) via a URL associated with (1) a slow response, (2) a completed TCP connection with no application data sent, or (3) a large amount of application data, a related issue to CVE-2011-1521.",
"33064"
"33064",
"CVE-2011-4137"
],
[
"django",
"<1.2.7",
"1.2.2",
"The verify_exists functionality in the URLField implementation in Django before 1.2.7 and 1.3.x before 1.3.1 originally tests a URL's validity through a HEAD request, but then uses a GET request for the new target URL in the case of a redirect, which might allow remote attackers to trigger arbitrary GET requests with an unintended source IP address via a crafted Location header.",
"33065"
"33065",
"CVE-2011-4138"
]
]
1 change: 1 addition & 0 deletions tests/test_safety.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ def test_full_report(self):
+ ' blah' * 15 + '.\r\n\r\n'
+ 'All users are urged to upgrade please.\r\n',
vuln_id=1234,
cve="CVE-1234-5678"
),
]
full_report = formatter.SheetReport.render(
Expand Down