OSV v3 parser shares introduced/fixed commit patches across affected packages
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 84/100
Research direction
Start in vulnerabilities/pipes/osv_v2.py at parse_advisory_data_v3, where the issue identifies the commit lists being initialized and passed to each package. Run the real-parser regression tests for distinct Git blocks and a version-only block in either order; done means each package gets only its own commits, separate lists, while multiple Git ranges within one block still accumulate.
Written by the indexing model from the issue text.
Description
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?
- Dominant language
- Python
- Stars
- 719
- Forks
- 359
- Avg merge
- 11h 59m
- Merged PRs (30d)
- 2
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from aboutcode-org/vulnerablecode
-
Pipeline run pages return 500 for a schedule whose pipeline is not registeredPossibly taken @sanchit955 claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
aboutcode-org/vulnerablecode#2505 ·
Maintainers usually reply within 1 day
-
Affected-by-advisories v2 page returns 500 for a purl with no matching packagePossibly taken @sanchit955 claimed this 2 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
aboutcode-org/vulnerablecode#2501 ·
Maintainers usually reply within 1 day
-
OSV parser drops all crates.io affected entries because the ecosystem mapping uses cargoPossibly taken @Ashutosh-Panda2004 claimed this 22 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
aboutcode-org/vulnerablecode#2485 · 1 comment ·
Maintainers usually reply within 1 day
-
Docker Compose setup fails on wait-for-it host web:8000 and missing runtime .envPossibly taken @Anurag-S1ngh claimed this 25 days ago. Open
Difficulty 2/5 Half a day Newbie friendliness 77/100
aboutcode-org/vulnerablecode#2477 · 1 comment ·
Maintainers usually reply within 1 day
-
OVAL parser corrupts version bounds when the epoch is 10, 20 or the version contains "0:"Possibly taken @Ashutosh-Panda2004 claimed this 23 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
aboutcode-org/vulnerablecode#2474 · 1 comment ·
Maintainers usually reply within 1 day
All issues in aboutcode-org/vulnerablecode
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
GoogleCloudPlatform/professional-services-data-validator#1899 ·
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mohanraj00/entelos#200 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
sweep
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
bketelsen/truenas-mcp#77 ·
Maintainers usually reply within 1 day
-
Console writes URL credentials to the local log, though AGENTS.md says secrets never reach diskOpen
Difficulty 1/5 Under an hour Newbie friendliness 86/100
sandbox-quantum/switch#2163 ·
Maintainers usually reply within 1 day