Repository navigation
Description
When importing an OSV advisory whose affected entry specifies events: [{"introduced": "0"}] without a fixed or last_affected event or an explicit versions list (for example GHSA-wj6h-64fc-37mp for PyPI ecdsa in github/advisory-database, or GO-2020-0036 for github.com/go-yaml/yaml in golang/vulndb), parse_advisory_data_v3() drops the AffectedPackageV2 entry and stores the advisory with no ImpactedPackage rows.
Reproduction
From a vulnerablecode checkout with dependencies installed:
mkdir -p /tmp/osv-repro/advisories/github-reviewed/2024/01/GHSA-wj6h-64fc-37mp \
/tmp/osv-repro/advisories/github-reviewed/2024/06/GHSA-jwcg-wv5x-vg3g
curl -fsSL https://raw.githubusercontent.com/github/advisory-database/main/advisories/github-reviewed/2024/01/GHSA-wj6h-64fc-37mp/GHSA-wj6h-64fc-37mp.json \
-o /tmp/osv-repro/advisories/github-reviewed/2024/01/GHSA-wj6h-64fc-37mp/GHSA-wj6h-64fc-37mp.json
curl -fsSL https://raw.githubusercontent.com/github/advisory-database/main/advisories/github-reviewed/2024/06/GHSA-jwcg-wv5x-vg3g/GHSA-jwcg-wv5x-vg3g.json \
-o /tmp/osv-repro/advisories/github-reviewed/2024/06/GHSA-jwcg-wv5x-vg3g/GHSA-jwcg-wv5x-vg3g.json
DJANGO_SETTINGS_MODULE=vulnerablecode.settings \
SECRET_KEY=test ALTCHA_HMAC_KEY=test \
VULNERABLECODE_DB_ENGINE=django.db.backends.sqlite3 \
VULNERABLECODE_DB_NAME=/tmp/osv-repro/vc.sqlite3 \
python - << 'PY'
import django
django.setup()
from django.apps import apps
from django.conf import settings
settings.MIGRATION_MODULES = {app.label: None for app in apps.get_app_configs()}
from types import SimpleNamespace
from unittest.mock import patch
from django.core.management import call_command
from vulnerabilities.models import AdvisoryV2
call_command("migrate", "--run-syncdb", verbosity=0)
with patch(
"vulnerabilities.pipelines.v2_importers.github_osv_importer.fetch_via_vcs",
return_value=SimpleNamespace(dest_dir="/tmp/osv-repro", delete=lambda: None),
):
call_command("import", "github_osv_importer_v2")
for adv_id in ("GHSA-wj6h-64fc-37mp", "GHSA-jwcg-wv5x-vg3g"):
adv = AdvisoryV2.objects.get(advisory_id=adv_id)
impacts = list(adv.impacted_packages.values_list("base_purl", "affecting_vers", "fixed_vers"))
print(adv_id, impacts)
PY
rm -rf /tmp/osv-reproActual vs Expected
Actual output (trimmed log lines):
Importing data using github_osv_importer_v2
GHSA-wj6h-64fc-37mp []
GHSA-jwcg-wv5x-vg3g [('pkg:maven/org.apache.submarine/submarine-commons-utils', 'vers:maven/<=0.8.0', None), ('pkg:pypi/apache-submarine', 'vers:pypi/>=0.8.0', None)]
Expected: Per the OSV schema, {"introduced": "0"} with no fixed or last_affected event means every version of the package is affected, so GHSA-wj6h-64fc-37mp should retain an ImpactedPackage row for pkg:pypi/ecdsa covering all versions (just as GHSA-jwcg-wv5x-vg3g, whose PyPI entry has events: [{"introduced": "0.8.0"}] and no fix, retains ('pkg:pypi/apache-submarine', 'vers:pypi/>=0.8.0', None)).
Versions
vulnerablecode:v40.2.0(910df628cf485e8d58c61b0a7c8c1a64b0964a14) andmain(9a9c9b3e8ff7d173bf8d2d04b4587c445a6d96b3)univers:32.0.1packageurl-python:0.17.6- Python
3.14.10, Debian Linux x86_64
Root Cause
In vulnerabilities/pipes/osv_v2.py, get_version_ranges_constraints() unconditionally skips {"introduced": "0"} (if event_value == "0": continue at lines 521-523 on main, lines 482-484 on v40.2.0), which simplifies bounded ranges like [{"introduced": "0"}, {"fixed": "1.0"}] to <1.0 (#2080) but leaves affected_constraints empty when no fixed or last_affected event is present, causing parse_advisory_data_v3() to emit no AffectedPackageV2 when explicit versions are also absent.
Found with a differential-testing tool; the report was drafted with AI assistance and reviewed and edited by me.
Credit: https://ucsbplse.github.io/
Activity
VinayKhandia commentedon Nov 27, 2026
Hi @trackoor — thanks for the detailed bug report and minimal reproduction
Tagging @keshav-space and @TG1999 for visibility as well.
I'd love to pick this up and open a PR if no one is actively working on it.
Proposed Approach
In
vulnerabilities/pipes/osv_v2.py,get_version_ranges_constraints()currently drops{"introduced": "0"}unconditionally so that bounded ranges like[{"introduced": "0"}, {"fixed": "1.0"}]stay simplified as<1.0. When a non-GIT(ECOSYSTEM/SEMVER) range has{"introduced": "0"}with nofixedorlast_affectedevent in that range (and no explicitversionsfallback),affected_constraintsends up empty and theAffectedPackageV2is dropped.My plan is to:
<fixed/<=last_affectedbehavior whenever upper-bound events are present in the range (so existing ranges and tests remain unchanged).{"introduced": "0"}is the only bound in anECOSYSTEM/SEMVERrange (e.g.,>=0, producingvers:pypi/>=0/vers:golang/>=0), while keepingGITranges untouched.vulnerabilities/tests/pipes/test_osv_v2.pycovering{"introduced": "0"}-only ranges for bothECOSYSTEMandSEMVER, as well as existing bounded cases.One quick design check for maintainers before I open the PR:
Would you prefer representing this unbounded range as
>=0(vers:<ecosystem>/>=0) or*(vers:<ecosystem>/*)? I noticedUnfurlVersionRangePipelinecurrently skips ranges without<,>, or!inaffecting_vers, so>=0works out of the box with unfurling (though pre-releases like0.0.0-alphasort below0in SemVer/PEP 440), whereas*would also require updatingunfurl_version_range.py.Happy to go with whichever convention you prefer