Commit 1d77fd3
committed
fix: align osv-sync with ADR-0001 §OSV data conventions
Two fixes derived from the alignment audit against ADR-0001 (Joana's
oss-packages living ADR, merged in PR #4151):
1. Lowercase ecosystem ('Maven' -> 'maven')
ADR-0001 §OSV "Ecosystem normalization" stores ecosystems lowercase
('npm' and 'maven', not 'Maven'). The OSV worker preserved OSV's
titlecase 'Maven' on the way in, leaving 7,957 Maven rows in
advisory_packages that would never join correctly against a
lowercase-storing packages table.
Changes:
- parseOsvRecord lowercases the ecosystem at the OSV boundary before
allowlist check, splitName, and storage. Allowlist set is lowercase
in env (OSV_ECOSYSTEMS=npm,maven) and in tests.
- splitName branches on 'maven' instead of 'Maven'.
- deriveCriticalFlag.ts catch-up SQL CASE expression uses 'maven'.
- New migration V1779951727 backfills existing Maven rows in
advisory_packages (and packages, which is empty today but reads
cheaply).
2. Populate advisories.source and source_url
The consolidated initial schema has two columns the upsert path didn't
set: source ('OSV' for everything this worker writes; granular GHSA /
NVD / NSWG attribution belongs to the future deps.dev BQ worker) and
source_url (canonical OSV URL: https://osv.dev/vulnerability/<id>).
Changes:
- NormalizedAdvisory grew source: string and sourceUrl: string | null.
- parseOsvRecord sets source: 'OSV' and sourceUrl: osvSourceUrl(id).
- upsertAdvisory INSERT and ON CONFLICT UPDATE include both columns.
All 68 unit tests still pass; migration applied locally and confirmed
the existing Maven rows backfilled to maven without unique-index
collisions.
Signed-off-by: Joan Reyero <joan@reyero.io>1 parent 1cc4758 commit 1d77fd3
8 files changed
Lines changed: 33 additions & 8 deletions
File tree
- backend
- src/osspckgs/migrations
- services/apps/packages_worker/src/osv
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
| 189 | + | |
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
73 | 78 | | |
74 | 79 | | |
75 | 80 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
| 34 | + | |
34 | 35 | | |
35 | | - | |
36 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
37 | 39 | | |
| 40 | + | |
| 41 | + | |
38 | 42 | | |
39 | 43 | | |
40 | 44 | | |
| |||
0 commit comments