Repository navigation
Keep milestone suffix in Tomcat fixed versions - #2534
nikolya-ctrl wants to merge 2 commits into
Conversation
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 -<suffix> (e.g. -M6, -RC1) in the regex. Add a test. Fixes aboutcode-org#2533 Signed-off-by: Nikolya Fernando <238961989+nikolya-ctrl@users.noreply.github.com>
|
Checked together with #2531: with both changes, |
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>
|
Small follow-up: while checking https://tomcat.apache.org/security-9.html I noticed Tomcat 9 writes milestones with a dot (e.g. "Fixed in Apache Tomcat 9.0.0.M22"), and some older entries use a dash. The previous regex truncated the dot style to I updated the regex to |
Fixes #2533
Problem
parse_tomcat_securityextracted the fixed version withTomcat\s+([\d\.]+), which only matches digits and dots. Milestone/pre-release fixed versions were truncated at the-, e.g. "Fixed in Apache Tomcat 11.0.0-M6" was parsed as11.0.0. On https://tomcat.apache.org/security-11.html this affects 7 headings (11.0.0-M3 through M21), which all collapsed to11.0.0.Fix
Allow an optional
-<suffix>after the numeric part:Tomcat\s+([\d\.]+(?:-[A-Za-z0-9]+)?). Normal versions like10.1.9are unchanged.Tests
Added
test_parse_tomcat_security_keeps_milestone_fixed_version. All 5 tests intest_apache_tomcat_importer_pipeline.pypass locally (Python 3.13, WSL Ubuntu); the existing tests already cover plain versions like10.1.9and9.0.76.Before / after (reproduction script from #2533)
Before:
fixed_in: 11.0.0After:
fixed_in: 11.0.0-M6Note
This is independent of #2531 (which fixes the "Affects" parsing for #2528). Both touch
apache_tomcat_importer.pybut different functions, so they can be merged in either order.I found and reported this bug, reproduced it, implemented the fix with a test, and verified everything locally. I used an AI assistant as a learning aid while getting familiar with the codebase and to help word this description.