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

未關閉 適合新手
#2,533 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 5 天內回覆

@nikolya-ctrl 已經在處理了。

開始於 2026年11月25日。

  • #2534 來自 @nikolya-ctrl —— 未關閉

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
85/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
python

研究方向

從 vulnerabilities/pipelines/v2_importers/apache_tomcat_importer.py 中的 parse_tomcat_security 開始,其中正規表示式 Tomcat\s+([\d\.]+) 會在 - 處截斷版本號。使用 PYTHONPATH=. DJANGO_SETTINGS_MODULE=vulnerablecode.settings 執行 issue 中的重現腳本,確認 fixed_in 為 11.0.0 而非 11.0.0-M6。完成標準是里程碑版本與一般版本標題都能正確解析,且測試涵蓋 11.0.0-M6 與一個既有的發布版本。

由索引模型根據 Issue 內容生成。

描述

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.

主要語言
Python
星號
722
分支
364
平均合併
1 天 23 小時
30 天內合併 PR
3

環境準備

  • 提供 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 沒有貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

aboutcode-org/vulnerablecode 的其他 Issue

查看 aboutcode-org/vulnerablecode 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。