Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

OVAL parser corrupts version bounds when the epoch is 10, 20 or the version contains "0:"

未关闭 适合新手
#2,474 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@Ashutosh-Panda2004 已经在做这个了。

开始于 2026年10月26日。

  • #2483 来自 @Ashutosh-Panda2004 —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
backend, security

调研方向

从 vulnerabilities/oval_parser.py 中的 get_version_range_from_state 入手,追踪它如何根据 OVAL 状态文本构建版本范围。为列出的 epoch 情况添加回归测试,包括 10:、20: 和嵌入其中的 0:,然后运行相关的解析器测试。完成标准是只移除开头默认的 0:,其余版本内容保持不变。

由索引模型根据 Issue 内容生成。

描述

Description

I found a data corruption bug in the OVAL parser while investigating how version ranges are built from OVAL states.

In vulnerabilities/oval_parser.py, get_version_range_from_state strips the default epoch using a plain string replacement:

version_range = version_range.replace("0:", "")

This removes every occurrence of 0: from the entire range string, rather than removing it only when it appears at the beginning of a version.

Steps to Reproduce

Feed version state texts through OvalParser using the Debian translations.

The following transformations occur:

Input version Result Status
0:4.14-1.1 <4.14-1.1 Correct
1:4.14-1.1 <1:4.14-1.1 Correct
10:4.14-1.1 <14.14-1.1 Incorrect
20:4.14-1.1 <24.14-1.1 Incorrect
0:10:2.0-1 <12.0-1 Incorrect

Expected Behavior

The parser should remove an explicit leading 0: only when it represents the default version epoch. All other parts of the version string, including nonzero epochs and version components containing 0:, should remain unchanged.

Actual Behavior

The unrestricted string replacement corrupts version ranges by removing 0: wherever it occurs, potentially changing version ordering and causing affected packages to be incorrectly reported as not vulnerable.

For example, with univers:

10:3.0-1 < 10:4.14-1.1  # True10:3.0-1 < 14.14-1.1   # False

The corrupted upper bound therefore causes an affected build to be reported as not affected.

Additional Context

This issue affects the Debian, Ubuntu, and SUSE OVAL importers because they all parse through OvalParser.

A potential fix is to strip the epoch only at the beginning of the version range. Since epoch 0 is the default, removing an explicit leading 0: preserves the version's meaning while leaving the rest of the version string untouched.

主要语言
Python
星标
716
派生
347
平均合并
12 小时 15 分钟
30 天内合并 PR
9

环境准备

  • 提供 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 摘要。