Skip to content

Commit f8ad4ee

Browse files
committed
Commit non-working will-not-fix code #970
Reference: #970 Signed-off-by: John M. Horan <[email protected]>
1 parent 03ff5ee commit f8ad4ee

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

vulnerabilities/importers/apache_tomcat.py

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from vulnerabilities.severity_systems import APACHE_TOMCAT
2727

2828
# For temporary data testing.
29-
PRINT = False
29+
PRINT = True
3030
TRACE = True
3131
record_of_all_affects_elements = []
3232
record_of_all_affected_versions = []
@@ -199,8 +199,17 @@ def extract_tomcat_advisory_data_from_page(apache_tomcat_advisory_html):
199199
# We're looking for headers -- one for each advisory -- like this:
200200
# <h3 id="Fixed_in_Apache_Tomcat_10.0.27"><span class="pull-right">2022-10-10</span> Fixed in Apache Tomcat 10.0.27</h3>
201201
pageh3s = page_soup.find_all("h3")
202+
# fixed_version_headings = [
203+
# heading for heading in pageh3s if "Fixed in Apache Tomcat" in heading.text
204+
# ]
205+
# 2023-01-09 Monday 10:31:29. Include the 2 groups of not-fixed advisories.
206+
fixed_header_substrings = (
207+
"Fixed in Apache Tomcat",
208+
"Will not be fixed in Apache Tomcat 4.1.x",
209+
"Not fixed in",
210+
)
202211
fixed_version_headings = [
203-
heading for heading in pageh3s if "Fixed in Apache Tomcat" in heading.text
212+
heading for heading in pageh3s if heading.text.startswith(fixed_header_substrings)
204213
]
205214

206215
for fixed_version_heading in fixed_version_headings:
@@ -209,7 +218,21 @@ def extract_tomcat_advisory_data_from_page(apache_tomcat_advisory_html):
209218
print("*** fixed_version_heading.text = {} ***".format(fixed_version_heading.text))
210219

211220
fixed_versions = []
212-
fixed_version = fixed_version_heading.text.split("Fixed in Apache Tomcat")[-1].strip()
221+
# fixed_version = fixed_version_heading.text.split("Fixed in Apache Tomcat")[-1].strip()
222+
# 2023-01-09 Monday 10:31:29. Include the 2 groups of not-fixed advisories.
223+
# We report no value for those that won't be fixed.
224+
if "Fixed in Apache Tomcat" in fixed_version_heading:
225+
fixed_version = fixed_version_heading.text.split("Fixed in Apache Tomcat")[-1].strip()
226+
else:
227+
fixed_version = "0.0"
228+
# elif "Will not be fixed in Apache Tomcat 4.1.x" in fixed_version_heading:
229+
# fixed_version = fixed_version_heading.text.split("Will not be fixed in Apache Tomcat")[
230+
# -1
231+
# ].strip()
232+
# elif "Not fixed in Apache Tomcat 3.x" in fixed_version_heading:
233+
# fixed_version = fixed_version_heading.text.split("Not fixed in Apache Tomcat")[
234+
# -1
235+
# ].strip()
213236

214237
# We want to handle the occasional "and" in the fixed version headers, e.g.,
215238
# <h3 id="Fixed_in_Apache_Tomcat_8.5.5_and_8.0.37"><span class="pull-right">5 September 2016</span> Fixed in Apache Tomcat 8.5.5 and 8.0.37</h3>
@@ -440,7 +463,12 @@ def to_version_ranges(versions_data, fixed_versions):
440463
# Need to check whether the inverted value is already in the `constraints` list.
441464
# This needs work -- as do the related tests.
442465
for fixed_item in fixed_versions:
466+
# 2023-01-09 Monday 10:54:10. We need to skip those with no fixed version.
467+
# if len(fixed_item) == 0:
468+
# continue
469+
443470
if "-" in fixed_item and not any([i.isalpha() for i in fixed_item]):
471+
# elif "-" in fixed_item and not any([i.isalpha() for i in fixed_item]):
444472
fixed_item_split = fixed_item.split(" ")
445473

446474
constraints.append(

0 commit comments

Comments
 (0)