From 44a844bd67b8284ccceac89142ca12067c898989 Mon Sep 17 00:00:00 2001 From: Nikolya Fernando <238961989+nikolya-ctrl@users.noreply.github.com> Date: Wed, 25 Nov 2026 17:13:25 +0530 Subject: [PATCH 1/2] Keep milestone suffix in Tomcat fixed versions parse_tomcat_security matched only digits and dots, so 'Fixed in Apache Tomcat 11.0.0-M6' was parsed as 11.0.0. Allow an optional - (e.g. -M6, -RC1) in the regex. Add a test. Fixes #2533 Signed-off-by: Nikolya Fernando <238961989+nikolya-ctrl@users.noreply.github.com> --- .../v2_importers/apache_tomcat_importer.py | 2 +- .../test_apache_tomcat_importer_pipeline.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/vulnerabilities/pipelines/v2_importers/apache_tomcat_importer.py b/vulnerabilities/pipelines/v2_importers/apache_tomcat_importer.py index cf47b9799..3c736f160 100644 --- a/vulnerabilities/pipelines/v2_importers/apache_tomcat_importer.py +++ b/vulnerabilities/pipelines/v2_importers/apache_tomcat_importer.py @@ -269,7 +269,7 @@ def parse_tomcat_security(html_content): results = [] for header in soup.find_all("h3", id=re.compile(r"Fixed_in_Apache_Tomcat")): - m = re.search(r"Tomcat\s+([\d\.]+)", header.get_text()) + m = re.search(r"Tomcat\s+([\d\.]+(?:-[A-Za-z0-9]+)?)", header.get_text()) if not m: continue fixed_in = m.group(1) diff --git a/vulnerabilities/tests/pipelines/v2_importers/test_apache_tomcat_importer_pipeline.py b/vulnerabilities/tests/pipelines/v2_importers/test_apache_tomcat_importer_pipeline.py index 84ab9db0c..79e58da64 100644 --- a/vulnerabilities/tests/pipelines/v2_importers/test_apache_tomcat_importer_pipeline.py +++ b/vulnerabilities/tests/pipelines/v2_importers/test_apache_tomcat_importer_pipeline.py @@ -143,3 +143,16 @@ def test_apache_and_maven_version_ranges_created(mock_get): for r in maven_ranges: assert isinstance(r, MavenVersionRange) + + +def test_parse_tomcat_security_keeps_milestone_fixed_version(): + html = """ +

Fixed in Apache Tomcat 11.0.0-M6

+
+

Important: Information disclosure + CVE-2023-34981

+

Affects: 11.0.0-M5

+
+ """ + advisories = parse_tomcat_security(html) + assert advisories[0].fixed_in == "11.0.0-M6" From 2b85dfeda0a6fce3ba5c82b357f03831d0c573c4 Mon Sep 17 00:00:00 2001 From: Nikolya Fernando <238961989+nikolya-ctrl@users.noreply.github.com> Date: Wed, 25 Nov 2026 21:54:30 +0530 Subject: [PATCH 2/2] Also keep dot-style milestone fixed versions (e.g. 9.0.0.M22) Tomcat 9 headings use 9.0.0.M22 rather than 9.0.0-M22, which the previous regex truncated to '9.0.0.'. Match numeric parts separately and allow a '.' or '-' before the suffix. Add a test. Signed-off-by: Nikolya Fernando <238961989+nikolya-ctrl@users.noreply.github.com> --- .../v2_importers/apache_tomcat_importer.py | 2 +- .../test_apache_tomcat_importer_pipeline.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/vulnerabilities/pipelines/v2_importers/apache_tomcat_importer.py b/vulnerabilities/pipelines/v2_importers/apache_tomcat_importer.py index 3c736f160..76e3c80e2 100644 --- a/vulnerabilities/pipelines/v2_importers/apache_tomcat_importer.py +++ b/vulnerabilities/pipelines/v2_importers/apache_tomcat_importer.py @@ -269,7 +269,7 @@ def parse_tomcat_security(html_content): results = [] for header in soup.find_all("h3", id=re.compile(r"Fixed_in_Apache_Tomcat")): - m = re.search(r"Tomcat\s+([\d\.]+(?:-[A-Za-z0-9]+)?)", header.get_text()) + m = re.search(r"Tomcat\s+(\d+(?:\.\d+)*(?:[.-][A-Za-z]+\d*)?)", header.get_text()) if not m: continue fixed_in = m.group(1) diff --git a/vulnerabilities/tests/pipelines/v2_importers/test_apache_tomcat_importer_pipeline.py b/vulnerabilities/tests/pipelines/v2_importers/test_apache_tomcat_importer_pipeline.py index 79e58da64..6768c1c57 100644 --- a/vulnerabilities/tests/pipelines/v2_importers/test_apache_tomcat_importer_pipeline.py +++ b/vulnerabilities/tests/pipelines/v2_importers/test_apache_tomcat_importer_pipeline.py @@ -156,3 +156,16 @@ def test_parse_tomcat_security_keeps_milestone_fixed_version(): """ advisories = parse_tomcat_security(html) assert advisories[0].fixed_in == "11.0.0-M6" + + +def test_parse_tomcat_security_keeps_dot_style_milestone_fixed_version(): + html = """ +

Fixed in Apache Tomcat 9.0.0.M22

+
+

Low: Example + CVE-2017-1000001

+

Affects: 9.0.0.M1 to 9.0.0.M21

+
+ """ + advisories = parse_tomcat_security(html) + assert advisories[0].fixed_in == "9.0.0.M22"