OSV v3 parser shares introduced/fixed commit patches across affected packages
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 84/100
Rechercherichtung
Beginne in vulnerabilities/pipes/osv_v2.py bei parse_advisory_data_v3, wo der Issue auf die Commit-Listen hinweist, die initialisiert und an jedes Paket übergeben werden. Führe die Regressionstests des echten Parsers für unterschiedliche Git-Blöcke und einen Block, der nur Versionen enthält, in beliebiger Reihenfolge aus; fertig ist es, wenn jedes Paket nur seine eigenen Commits und separate Listen erhält, während sich mehrere Git-Bereiche innerhalb eines Blocks weiterhin ansammeln.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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?
- Vorherrschende Sprache
- Python
- Sterne
- 717
- Forks
- 352
- Ø Merge
- 6 Std. 19 Min.
- Gemergte PRs (30 T.)
- 6
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Kein Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus aboutcode-org/vulnerablecode
-
OSV parser drops all crates.io affected entries because the ecosystem mapping uses cargoEvtl. vergeben @Ashutosh-Panda2004 hat das vor 7 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
aboutcode-org/vulnerablecode#2485 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Docker Compose setup fails on wait-for-it host web:8000 and missing runtime .envEvtl. vergeben @Anurag-S1ngh hat das vor 10 Tagen übernommen. Offen
Schwierigkeit 2/5 Ein halber Tag Anfängerfreundlichkeit 77/100
aboutcode-org/vulnerablecode#2477 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
OVAL parser corrupts version bounds when the epoch is 10, 20 or the version contains "0:"Evtl. vergeben @Ashutosh-Panda2004 hat das vor 8 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
aboutcode-org/vulnerablecode#2474 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Docker build fails on Apple Silicon (arm64) — only x86_64 wheels pinned for extractcode-7z, extractcode-libarchive, typecode-libmagicEvtl. wieder frei Ein Pull Request dazu wurde ohne Merge geschlossen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 86/100
aboutcode-org/vulnerablecode#2426 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Get NuGet package versions from federated PURL version data in https://github.com/aboutcode-data/Evtl. wieder frei @Anshi321 hat das vor 30 Tagen übernommen, und es ist kein Pull Request offen. Offenbug data-quality
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
aboutcode-org/vulnerablecode#2418 · 4 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in aboutcode-org/vulnerablecode
Ähnliche Issues
-
Backend issue lists report in-patch warnings and out-of-patch errors as not publishableEvtl. vergeben @RaphaelFakhri hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
mozilla/code-review#3794 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[oblt-aw][autodoc] Update docs that still describe the security registry as emptyEvtl. vergeben @github-actions hat das heute übernommen. Offen
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 85/100
Maintainer antworten meist innerhalb von 1 Tag
-
[Bug] adb backup script reports "Done" & exits 0 when the backup failsEvtl. vergeben @bhattmanthan hat das heute übernommen. Offenrequest-issue-assignment
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
OWASP/mastg#4034 · 5 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
agent-ui bug p2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
amd/gaia#6580 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
correction metadata
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 72/100
acl-org/acl-anthology#10768 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag