ApacheTomcatImporterPipeline truncates milestone fixed versions (e.g. 11.0.0-M6 -> 11.0.0)

Đang mở Phù hợp với người mới
#2,533 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 5 ngày

@nikolya-ctrl đang làm issue này rồi.

Từ ngày 25/11/2026.

  • #2534 của @nikolya-ctrl — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
85/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
data-engineering

Hướng nghiên cứu

Bắt đầu từ vulnerabilities/pipelines/v2_importers/apache_tomcat_importer.py tại parse_tomcat_security, nơi biểu thức chính quy Tomcat\s+([\d\.]+) cắt ngắn các phiên bản tại -. Chạy script tái hiện từ issue với PYTHONPATH=. DJANGO_SETTINGS_MODULE=vulnerablecode.settings để xác nhận fixed_in là 11.0.0 thay vì 11.0.0-M6. Hoàn thành khi cả tiêu đề milestone lẫn tiêu đề phiên bản thông thường đều được phân tích đúng, kèm các kiểm thử bao phủ 11.0.0-M6 và một phiên bản phát hành hiện có.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

parse_tomcat_security in vulnerabilities/pipelines/v2_importers/apache_tomcat_importer.py extracts the fixed version from headings like "Fixed in Apache Tomcat 11.0.0-M6" with:

re.search(r"Tomcat\s+([\d\.]+)", header.get_text())

[\d\.]+ only matches digits and dots, so it stops at the - and milestone/pre-release fixed versions are truncated: 11.0.0-M6 becomes 11.0.0.

Reproduction
import django
django.setup()

from vulnerabilities.pipelines.v2_importers.apache_tomcat_importer import parse_tomcat_security

HTML = """
<h3 id="Fixed_in_Apache_Tomcat_11.0.0-M6">Fixed in Apache Tomcat 11.0.0-M6</h3>
<div class="text">
<p><strong>Important: Information disclosure</strong>
<a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-34981">CVE-2023-34981</a></p>
<p>Affects: 11.0.0-M5</p>
</div>
"""

for advisory in parse_tomcat_security(HTML):
    print("fixed_in:", advisory.fixed_in)

Run with PYTHONPATH=. DJANGO_SETTINGS_MODULE=vulnerablecode.settings python repro.py on current main.

Actual: fixed_in: 11.0.0
Expected: fixed_in: 11.0.0-M6

Impact

On https://tomcat.apache.org/security-11.html, 7 "Fixed in" headings use milestone versions (11.0.0-M3, M5, M6, M11, M12, M17, M21). All of them collapse to 11.0.0, which is also a real release heading on the same page. So these advisories get the wrong fixed version, and the fixed-version constraint ends up as !=11.0.0 instead of !=11.0.0-M6.

I noticed this while working on #2528 (PR #2531). I'd like to work on a fix with tests if that's okay.

Ngôn ngữ chính
Python
Star
722
Fork
364
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
3

Chuẩn bị môi trường

  • Có Dockerfile hoặc tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của aboutcode-org/vulnerablecode

Tất cả issue của aboutcode-org/vulnerablecode

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.