OSV v3 parser shares introduced/fixed commit patches across affected packages
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
vulnerabilities/pipes/osv_v2.py の parse_advisory_data_v3 から始めます。ここで issue は、初期化され各パッケージに渡されるコミットリストを指摘しています。順序を問わず、異なる Git ブロックとバージョンのみのブロックを対象に、実際のパーサーの回帰テストを実行します。各パッケージがそれぞれのコミットのみを別々のリストで受け取り、1つのブロック内に複数の Git 範囲がある場合は引き続き蓄積されることを確認できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
When an OSV advisory contains multiple affected blocks, parse_advisory_data_v3 puts all collected Git commits into each parsed package. Packages with only version ranges inherit commits too.
Reproduced on current main, commit 8af2bd39510f909c852c5cc086e9b56addc8c50a, with Python 3.12.14, univers==32.0.1, and packageurl-python==0.17.6.
Reproduction
Run this in the project's configured Django shell. The package names, repositories and hashes below are synthetic. Parsing these GitHub URLs does not fetch any repositories.
python manage.py shell
from vulnerabilities.pipes.osv_v2 import parse_advisory_data_v3
raw = {
"id": "x_REPRO-OSV-COMMIT-SCOPE",
"modified": "2026-11-03T00:00:00Z",
"affected": [
{
"package": {"ecosystem": "PyPI", "name": f"demo-{suffix}"},
"ranges": [{
"type": "GIT",
"repo": f"https://github.com/example/repo-{suffix}",
"events": [{"introduced": intro * 40}, {"fixed": fixed * 40}],
}],
}
for suffix, intro, fixed in [("a", "a", "b"), ("b", "c", "d")]
],
}
advisory = parse_advisory_data_v3(
raw, ["pypi"], "https://example.org/advisory", ""
)
first, second = advisory.affected_packages
for package in advisory.affected_packages:
print(package.package, len(package.introduced_by_commit_patches),
len(package.fixed_by_commit_patches))
print(first.introduced_by_commit_patches is second.introduced_by_commit_patches)
print(first.fixed_by_commit_patches is second.fixed_by_commit_patches)
Actual output:
pkg:pypi/demo-a 2 2
pkg:pypi/demo-b 2 2
True
True
Each package contains both repositories' introduced and fixed commits. Expected output is 1 1 for each package and separate lists: demo-a should only have repo-a commits and demo-b only repo-b commits.
With a Git block and a version-only block in the same advisory, the version-only package receives the Git block's introduced and fixed patches in either order.
Cause
The parser initializes the two commit lists before the affected-package loop and passes them unchanged to every AffectedPackageV2. The constructor validates the lists without copying them, so the parsed advisory associates packages with other packages' commits.
The lists should be initialized for each affected block, alongside its version constraints. Multiple Git ranges within the same block should still accumulate into that block's lists.
I checked existing OSV issues and PRs, including #2080, #2066, #2116 and the current parser PRs, and found no report of this attribution bug. Tests using the real parser and classifier fail for two distinct Git blocks and for a version-only block in either order. The control with multiple Git ranges in one block passes.
I'd like to work on the fix. Would you welcome a PR that scopes the lists to each affected block and adds these regression tests?
- 主要言語
- Python
- スター
- 717
- フォーク
- 352
- 平均マージ
- 6時間 19分
- マージ済み PR(30日)
- 6
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
aboutcode-org/vulnerablecode のほかの issue
-
OSV parser drops all crates.io affected entries because the ecosystem mapping uses cargo対応中かも @Ashutosh-Panda2004 が 7 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
aboutcode-org/vulnerablecode#2485 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Docker Compose setup fails on wait-for-it host web:8000 and missing runtime .env対応中かも @Anurag-S1ngh が 10 日前に担当しました。 オープン
難易度 2/5 半日 初心者へのやさしさ 77/100
aboutcode-org/vulnerablecode#2477 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
OVAL parser corrupts version bounds when the epoch is 10, 20 or the version contains "0:"対応中かも @Ashutosh-Panda2004 が 8 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
aboutcode-org/vulnerablecode#2474 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Docker build fails on Apple Silicon (arm64) — only x86_64 wheels pinned for extractcode-7z, extractcode-libarchive, typecode-libmagic再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
aboutcode-org/vulnerablecode#2426 ·
メンテナーはふだん 1 日以内に返信
-
Get NuGet package versions from federated PURL version data in https://github.com/aboutcode-data/再び着手できるかも @Anshi321 が 30 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンbug data-quality
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
aboutcode-org/vulnerablecode#2418 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
aboutcode-org/vulnerablecode の issue をすべて見る
似ている issue
-
bump patch
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
autowarefoundation/autoware_carla_scenario#1321 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 78/100
QuantConnect/Documentation#2838 ·
メンテナーはふだん 1 日以内に返信
-
get_all_subclasses must deduplicate by class identity対応中かも @Gambit-Checkmate が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 15 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
awslabs/route53-dynamic-dns-with-lambda#67 · コメント 1 件 ·