Skip to content

Commit

Permalink
Merge pull request #1047 from luhring/osv-aliases-to-related
Browse files Browse the repository at this point in the history
fix(osv): move aliases to related field
  • Loading branch information
imjasonh authored Jul 9, 2024
2 parents 8d181a1 + 849daeb commit 17dc660
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 9 deletions.
7 changes: 4 additions & 3 deletions pkg/advisory/osv.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,9 @@ func BuildOSVDataset(_ context.Context, opts OSVOptions) error {
continue
}

// Note: The OSV data should include our advisory ID itself among the listed aliases.
aliases := append([]string{adv.ID}, adv.Aliases...)
// Note: The OSV data should include our advisory ID itself among the listed
// related vulnerability IDs.
related := append([]string{adv.ID}, adv.Aliases...)

affecteds := make([]models.Affected, 0, len(affectedPackages))
for _, pkg := range affectedPackages {
Expand All @@ -161,7 +162,7 @@ func BuildOSVDataset(_ context.Context, opts OSVOptions) error {

entry := models.Vulnerability{
ID: adv.ID,
Aliases: aliases,
Related: related,
Affected: affecteds,
Modified: advisoryLastUpdated,
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/advisory/testdata/osv/expected/CGA-37qj-pjrf-fmrw.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"modified": "2022-09-15T02:40:18Z",
"id": "CGA-37qj-pjrf-fmrw",
"aliases": [
"related": [
"CGA-37qj-pjrf-fmrw",
"CVE-2020-8927"
],
Expand Down
2 changes: 1 addition & 1 deletion pkg/advisory/testdata/osv/expected/CGA-5f5c-53mg-6p2v.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"modified": "2023-05-04T14:34:34Z",
"id": "CGA-5f5c-53mg-6p2v",
"aliases": [
"related": [
"CGA-5f5c-53mg-6p2v",
"GHSA-33pg-m6jh-5237"
],
Expand Down
2 changes: 1 addition & 1 deletion pkg/advisory/testdata/osv/expected/CGA-6mjr-v678-c6gm.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"modified": "2023-02-07T16:50:17Z",
"id": "CGA-6mjr-v678-c6gm",
"aliases": [
"related": [
"CGA-6mjr-v678-c6gm",
"CVE-2022-4450"
],
Expand Down
2 changes: 1 addition & 1 deletion pkg/advisory/testdata/osv/expected/CGA-gg4h-ppqq-vf35.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"modified": "2023-05-04T14:34:34Z",
"id": "CGA-gg4h-ppqq-vf35",
"aliases": [
"related": [
"CGA-gg4h-ppqq-vf35",
"GHSA-6wrf-mxfj-pf5p"
],
Expand Down
2 changes: 1 addition & 1 deletion pkg/advisory/testdata/osv/expected/CGA-mm7m-x6cw-5fg4.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"modified": "2023-04-08T16:32:54Z",
"id": "CGA-mm7m-x6cw-5fg4",
"aliases": [
"related": [
"CGA-mm7m-x6cw-5fg4",
"CVE-2023-0466"
],
Expand Down
2 changes: 1 addition & 1 deletion pkg/advisory/testdata/osv/expected/CGA-vj68-6p3f-8xmr.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"modified": "2023-03-28T14:54:27Z",
"id": "CGA-vj68-6p3f-8xmr",
"aliases": [
"related": [
"CGA-vj68-6p3f-8xmr",
"CVE-2023-0465"
],
Expand Down

0 comments on commit 17dc660

Please sign in to comment.