You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
golang_vulndb importer stores two advisories per Go vulnerability (OSV and report share one avid) #2520
GolangVulndbImporterPipeline.collect_advisories() imports each Go vulnerability twice under the same avid: once from data/osv/GO-*.json and once from data/reports/GO-*.yaml. In golang/vulndb the OSV files are generated from the YAML reports, so the two sets cover the same vulnerabilities. Today both directories hold the same 4,885 GO- IDs.
Both records get advisory_id = GO-…, so both map to avid = golang_vulndb/GO-…, but their content differs. insert_advisory_v2 keys get_or_create on unique_content_id, so it stores two AdvisoryV2 rows per vulnerability. Each newly created row flips is_latest off the other.
I ran the pipeline's own to_advisory_data_from_osv and to_advisory_data_from_report on three current vulndb files, plus compute_content_id_v2 (on main):
ID
same avid
same content id
differences
GO-2022-0969
yes
no
summary; references 3 vs 4
GO-2023-1840
yes
no
summary; references 3 vs 4; weaknesses [] vs [642]
GO-2024-2687
yes
no
summary; references 3 vs 4; weaknesses [] vs [400]
What this leads to:
About 4,885 extra AdvisoryV2 rows (plus their impacts) for one datasource, each a near-copy of another advisory.
Which of the two is is_latest depends on insertion order, not on which data is newer. On a first import the report row wins, because the YAML loop runs after the OSV loop. Later, if only an OSV file changes upstream, the new OSV row is created and becomes latest, even though it lacks the CWE and the pkg.go.dev reference the report row has.
(The CVE 5.0 records in data/cve/v5 are keyed by CVE ID, so they don't collide with these. I've left them out here.)
Possible fixes:
Import only data/reports. It carries the CWE (cve_metadata.cwe) and adds the pkg.go.dev/vuln/GO-… reference, and the OSV files are derived from it anyway.
Import only data/osv, and pull the CWE from the matching report.
Merge the two into one AdvisoryDataV2 per ID before storing.
1 looks like the smallest change. @TG1999, which would you prefer? I can open a PR with a test that runs collect_advisories() on a small fixture tree containing both files for one ID and checks that one advisory comes out.
One more data point that affects which source to keep. I ran the three converters over the whole of golang/vulndb (c06cc6a, 23 Nov):
source
records
date_published set
data/osv
4,879
249
data/reports
4,879
249
data/cve/v5
272
0
That isn't a parsing bug. In the repository, 4,633 OSV files carry the placeholder "published": "0001-01-01T00:00:00Z" (which to_advisory_data_from_osv rightly drops), and the matching reports have no published field at all. The published database at vuln.go.dev does have the real dates for the same IDs, for example:
ID
repo data/osv
https://vuln.go.dev/ID/<id>.json
GO-2022-0231
0001-01-01T00:00:00Z
2024-08-21T14:30:26Z
GO-2024-2687
0001-01-01T00:00:00Z
2024-04-03T21:12:01Z
GO-2026-4602
0001-01-01T00:00:00Z
2026-03-06T21:03:42Z
So whichever of the two you keep, about 95% of Go advisories will have no publish date as long as the importer reads the repo. If dates matter here, reading the OSV records from vuln.go.dev (it has an index at /index/vulns.json with the same 4,885 IDs) would fix both this and the duplicates. I'd leave that choice to you, @TG1999, since it changes where the data comes from.
Activity
Jean-Regis-M commentedon Nov 24, 2026
One more data point that affects which source to keep. I ran the three converters over the whole of golang/vulndb (
c06cc6a, 23 Nov):date_publishedsetdata/osvdata/reportsdata/cve/v5That isn't a parsing bug. In the repository, 4,633 OSV files carry the placeholder
"published": "0001-01-01T00:00:00Z"(whichto_advisory_data_from_osvrightly drops), and the matching reports have nopublishedfield at all. The published database at vuln.go.dev does have the real dates for the same IDs, for example:data/osvhttps://vuln.go.dev/ID/<id>.json0001-01-01T00:00:00Z2024-08-21T14:30:26Z0001-01-01T00:00:00Z2024-04-03T21:12:01Z0001-01-01T00:00:00Z2026-03-06T21:03:42ZSo whichever of the two you keep, about 95% of Go advisories will have no publish date as long as the importer reads the repo. If dates matter here, reading the OSV records from vuln.go.dev (it has an index at
/index/vulns.jsonwith the same 4,885 IDs) would fix both this and the duplicates. I'd leave that choice to you, @TG1999, since it changes where the data comes from.