Skip to content

Commit 6e322a3

Browse files
committed
all: add lint rule to catch redundant CVE/GHSA links
The references section of a report doesn't need to include links to GitHub/MITRE/NIST for advisories listed as aliases, since we'll generate those links from the alias information. Add a lint rule to fund these redundant references. Allow ADVISORY links to these destinations, which indicate that the source is the canonical advisory for a vuln. Allow links to CVEs/GHSAs not listed as aliases, since it's legitimate to link to a related vulnerability for further information. Change-Id: Ibdc103a3ef76f306c2e9ddac7f839f3b94d8467f Reviewed-on: https://go-review.googlesource.com/c/vulndb/+/432975 Run-TryBot: Damien Neil <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Tatiana Bradley <[email protected]>
1 parent c5eaaec commit 6e322a3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+51
-106
lines changed

data/osv/GO-2020-0016.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@
5252
{
5353
"type": "WEB",
5454
"url": "https://github.com/ulikunitz/xz/issues/35"
55-
},
56-
{
57-
"type": "WEB",
58-
"url": "https://github.com/ulikunitz/xz/security/advisories/GHSA-25xm-hr59-7c27"
5955
}
6056
]
6157
}

data/osv/GO-2020-0050.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@
5050
{
5151
"type": "FIX",
5252
"url": "https://github.com/russellhaering/goxmldsig/commit/f6188febf0c29d7ffe26a0436212b19cb9615e64"
53-
},
54-
{
55-
"type": "WEB",
56-
"url": "https://github.com/russellhaering/goxmldsig/security/advisories/GHSA-q547-gmf8-8jr7"
5753
}
5854
]
5955
}

data/osv/GO-2021-0060.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@
4949
{
5050
"type": "FIX",
5151
"url": "https://github.com/russellhaering/gosaml2/commit/42606dafba60c58c458f14f75c4c230459672ab9"
52-
},
53-
{
54-
"type": "WEB",
55-
"url": "https://github.com/russellhaering/gosaml2/security/advisories/GHSA-xhqq-x44f-9fgg"
5652
}
5753
]
5854
}

data/osv/GO-2021-0095.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@
4949
{
5050
"type": "FIX",
5151
"url": "https://github.com/google/go-tpm/commit/d7806cce857a1a020190c03348e5361725d8f141"
52-
},
53-
{
54-
"type": "WEB",
55-
"url": "https://github.com/google/go-tpm/security/advisories/GHSA-5x29-3hr9-6wpw"
5652
}
5753
]
5854
}

data/osv/GO-2021-0098.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@
7676
{
7777
"type": "FIX",
7878
"url": "https://github.com/git-lfs/git-lfs/commit/fc664697ed2c2081ee9633010de0a7f9debea72a"
79-
},
80-
{
81-
"type": "WEB",
82-
"url": "https://github.com/git-lfs/git-lfs/security/advisories/GHSA-cx3w-xqmc-84g5"
8379
}
8480
]
8581
}

data/osv/GO-2021-0099.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@
4646
{
4747
"type": "FIX",
4848
"url": "https://github.com/deislabs/oras/commit/96cd90423303f1bb42bd043cb4c36085e6e91e8e"
49-
},
50-
{
51-
"type": "WEB",
52-
"url": "https://github.com/deislabs/oras/security/advisories/GHSA-g5v4-5x39-vwhx"
5349
}
5450
]
5551
}

data/osv/GO-2021-0103.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,6 @@
5555
{
5656
"type": "FIX",
5757
"url": "https://github.com/holiman/uint256/commit/6785da6e3eea403260a5760029e722aa4ff1716d"
58-
},
59-
{
60-
"type": "WEB",
61-
"url": "https://github.com/ethereum/go-ethereum/security/advisories/GHSA-jm5c-rv3w-w83m"
6258
}
6359
]
6460
}

data/osv/GO-2021-0110.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@
4747
{
4848
"type": "FIX",
4949
"url": "https://github.com/ory/fosite/commit/0c9e0f6d654913ad57c507dd9a36631e1858a3e9"
50-
},
51-
{
52-
"type": "WEB",
53-
"url": "https://github.com/ory/fosite/security/advisories/GHSA-v3q9-2p3m-7g43"
5450
}
5551
]
5652
}

data/osv/GO-2021-0237.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@
4949
{
5050
"type": "FIX",
5151
"url": "https://github.com/AndrewBurian/powermux/commit/5e60a8a0372b35a898796c2697c40e8daabed8e9"
52-
},
53-
{
54-
"type": "WEB",
55-
"url": "https://github.com/AndrewBurian/powermux/security/advisories/GHSA-mj9r-wwm8-7q52"
5652
}
5753
]
5854
}

data/osv/GO-2021-0258.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@
5151
{
5252
"type": "FIX",
5353
"url": "https://github.com/pomerium/pomerium/commit/f20542c4bf2cc691e4c324f7ec79e02e46d95511"
54-
},
55-
{
56-
"type": "WEB",
57-
"url": "https://github.com/pomerium/pomerium/security/advisories/GHSA-j6wp-3859-vxfg"
5854
}
5955
]
6056
}

data/osv/GO-2021-0412.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@
5353
{
5454
"type": "WEB",
5555
"url": "https://github.com/containerd/imgcrypt/releases/tag/v1.1.4"
56-
},
57-
{
58-
"type": "WEB",
59-
"url": "https://github.com/containerd/imgcrypt/security/advisories/GHSA-8v99-48m9-c8pm"
6056
}
6157
]
6258
}

data/osv/GO-2022-0246.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@
5050
{
5151
"type": "FIX",
5252
"url": "https://github.com/cloudflare/cfrpki/commit/a8db4e009ef217484598ba1fd1c595b54e0f6422"
53-
},
54-
{
55-
"type": "WEB",
56-
"url": "https://github.com/cloudflare/cfrpki/security/advisories/GHSA-c8xp-8mf3-62h9"
5753
}
5854
]
5955
}

data/osv/GO-2022-0462.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@
5454
{
5555
"type": "FIX",
5656
"url": "https://github.com/pion/dtls/commit/d2f797183a9f044ce976e6df6f362662ca722412"
57-
},
58-
{
59-
"type": "WEB",
60-
"url": "https://github.com/pion/dtls/security/advisories/GHSA-w45j-f832-hxvh"
6157
}
6258
]
6359
}

data/osv/GO-2022-0470.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@
9191
{
9292
"type": "FIX",
9393
"url": "https://github.com/blevesearch/bleve/commit/1c7509d6a17d36f265c90b4e8f4e3a3182fe79ff"
94-
},
95-
{
96-
"type": "WEB",
97-
"url": "https://github.com/blevesearch/bleve/security/advisories/GHSA-9w9f-6mg8-jp7w"
9894
}
9995
]
10096
}

data/osv/GO-2022-0621.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@
4646
{
4747
"type": "FIX",
4848
"url": "https://github.com/kubernetes/kube-state-metrics/commit/03122fe3e2df49a9a7298b8af921d3c37c430f7f"
49-
},
50-
{
51-
"type": "WEB",
52-
"url": "https://github.com/advisories/GHSA-2v6x-frw8-7r7f"
5349
}
5450
]
5551
}

data/osv/GO-2022-0629.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@
6363
{
6464
"type": "FIX",
6565
"url": "https://github.com/kubernetes-sigs/secrets-store-csi-driver/commit/c2cbb19e2eef16638fa0523383788a4bc22231fd"
66-
},
67-
{
68-
"type": "WEB",
69-
"url": "https://github.com/advisories/GHSA-5cgx-vhfp-6cf9"
7066
}
7167
]
7268
}

data/osv/GO-2022-0643.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@
5050
{
5151
"type": "FIX",
5252
"url": "https://github.com/elastic/beats/commit/aeca65779d573976981587ca1d1461399e1b59dd"
53-
},
54-
{
55-
"type": "WEB",
56-
"url": "https://github.com/advisories/GHSA-9q3g-m353-cp4p"
5753
}
5854
]
5955
}

data/osv/GO-2022-0646.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,6 @@
4646
"type": "ADVISORY",
4747
"url": "https://aws.amazon.com/blogs/developer/updates-to-the-amazon-s3-encryption-client/?s=09"
4848
},
49-
{
50-
"type": "WEB",
51-
"url": "https://github.com/advisories/GHSA-7f33-f4f5-xwgw"
52-
},
53-
{
54-
"type": "WEB",
55-
"url": "https://github.com/advisories/GHSA-f5pg-7wfw-84q9"
56-
},
5749
{
5850
"type": "FIX",
5951
"url": "https://github.com/aws/aws-sdk-go/pull/3403"

data/osv/GO-2022-0701.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,6 @@
8080
{
8181
"type": "FIX",
8282
"url": "https://github.com/kubernetes/kubernetes/commit/37f730f68c7f06e060f90714439bfb0dbb2df5e7"
83-
},
84-
{
85-
"type": "WEB",
86-
"url": "https://github.com/advisories/GHSA-jp32-vmm6-3vf5"
8783
}
8884
]
8985
}

data/osv/GO-2022-0706.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@
5151
{
5252
"type": "FIX",
5353
"url": "https://github.com/elastic/apm-agent-go/commit/dd3e8c593580e7b80a98b57e1cc6e017e56747b4"
54-
},
55-
{
56-
"type": "WEB",
57-
"url": "https://github.com/advisories/GHSA-qqc5-rgcc-cjqh"
5854
}
5955
]
6056
}

data/reports/GO-2020-0016.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,3 @@ credit: '@0xdecaf'
2424
references:
2525
- fix: https://github.com/ulikunitz/xz/commit/69c6093c7b2397b923acf82cb378f55ab2652b9b
2626
- web: https://github.com/ulikunitz/xz/issues/35
27-
- web: https://github.com/ulikunitz/xz/security/advisories/GHSA-25xm-hr59-7c27

data/reports/GO-2020-0050.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,3 @@ ghsas:
2525
credit: '@jupenur'
2626
references:
2727
- fix: https://github.com/russellhaering/goxmldsig/commit/f6188febf0c29d7ffe26a0436212b19cb9615e64
28-
- web: https://github.com/russellhaering/goxmldsig/security/advisories/GHSA-q547-gmf8-8jr7

data/reports/GO-2021-0060.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,3 @@ ghsas:
2323
credit: Juho Nurminen
2424
references:
2525
- fix: https://github.com/russellhaering/gosaml2/commit/42606dafba60c58c458f14f75c4c230459672ab9
26-
- web: https://github.com/russellhaering/gosaml2/security/advisories/GHSA-xhqq-x44f-9fgg

data/reports/GO-2021-0095.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ credit: Chris Fenner
1919
references:
2020
- fix: https://github.com/google/go-tpm/pull/195
2121
- fix: https://github.com/google/go-tpm/commit/d7806cce857a1a020190c03348e5361725d8f141
22-
- web: https://github.com/google/go-tpm/security/advisories/GHSA-5x29-3hr9-6wpw

data/reports/GO-2021-0098.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,3 @@ ghsas:
3535
credit: '@Ry0taK'
3636
references:
3737
- fix: https://github.com/git-lfs/git-lfs/commit/fc664697ed2c2081ee9633010de0a7f9debea72a
38-
- web: https://github.com/git-lfs/git-lfs/security/advisories/GHSA-cx3w-xqmc-84g5

data/reports/GO-2021-0099.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@ ghsas:
2020
credit: Chris Smowton
2121
references:
2222
- fix: https://github.com/deislabs/oras/commit/96cd90423303f1bb42bd043cb4c36085e6e91e8e
23-
- web: https://github.com/deislabs/oras/security/advisories/GHSA-g5v4-5x39-vwhx

data/reports/GO-2021-0103.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,3 @@ credit: Dima Stebaev
2727
references:
2828
- fix: https://github.com/holiman/uint256/pull/80
2929
- fix: https://github.com/holiman/uint256/commit/6785da6e3eea403260a5760029e722aa4ff1716d
30-
- web: https://github.com/ethereum/go-ethereum/security/advisories/GHSA-jm5c-rv3w-w83m

data/reports/GO-2021-0110.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ ghsas:
1919
- GHSA-v3q9-2p3m-7g43
2020
references:
2121
- fix: https://github.com/ory/fosite/commit/0c9e0f6d654913ad57c507dd9a36631e1858a3e9
22-
- web: https://github.com/ory/fosite/security/advisories/GHSA-v3q9-2p3m-7g43

data/reports/GO-2021-0237.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ ghsas:
1919
references:
2020
- fix: https://github.com/AndrewBurian/powermux/pull/42
2121
- fix: https://github.com/AndrewBurian/powermux/commit/5e60a8a0372b35a898796c2697c40e8daabed8e9
22-
- web: https://github.com/AndrewBurian/powermux/security/advisories/GHSA-mj9r-wwm8-7q52

data/reports/GO-2021-0258.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,3 @@ ghsas:
2727
references:
2828
- fix: https://github.com/pomerium/pomerium/pull/2724
2929
- fix: https://github.com/pomerium/pomerium/commit/f20542c4bf2cc691e4c324f7ec79e02e46d95511
30-
- web: https://github.com/pomerium/pomerium/security/advisories/GHSA-j6wp-3859-vxfg

data/reports/GO-2021-0412.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,3 @@ references:
3737
- fix: https://github.com/containerd/imgcrypt/commit/6fdd9818a4d8142107b7ecd767d839c9707700d9
3838
- web: https://github.com/containerd/imgcrypt/issues/69
3939
- web: https://github.com/containerd/imgcrypt/releases/tag/v1.1.4
40-
- web: https://github.com/containerd/imgcrypt/security/advisories/GHSA-8v99-48m9-c8pm

data/reports/GO-2022-0246.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,3 @@ credit: Job Snijders
2121
references:
2222
- fix: https://github.com/cloudflare/cfrpki/pull/90
2323
- fix: https://github.com/cloudflare/cfrpki/commit/a8db4e009ef217484598ba1fd1c595b54e0f6422
24-
- web: https://github.com/cloudflare/cfrpki/security/advisories/GHSA-c8xp-8mf3-62h9

data/reports/GO-2022-0462.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,3 @@ ghsas:
3232
- GHSA-w45j-f832-hxvh
3333
references:
3434
- fix: https://github.com/pion/dtls/commit/d2f797183a9f044ce976e6df6f362662ca722412
35-
- web: https://github.com/pion/dtls/security/advisories/GHSA-w45j-f832-hxvh

data/reports/GO-2022-0470.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,3 @@ ghsas:
4545
- GHSA-9w9f-6mg8-jp7w
4646
references:
4747
- fix: https://github.com/blevesearch/bleve/commit/1c7509d6a17d36f265c90b4e8f4e3a3182fe79ff
48-
- web: https://github.com/blevesearch/bleve/security/advisories/GHSA-9w9f-6mg8-jp7w

data/reports/GO-2022-0621.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,3 @@ ghsas:
2525
credit: Moritz S.
2626
references:
2727
- fix: https://github.com/kubernetes/kube-state-metrics/commit/03122fe3e2df49a9a7298b8af921d3c37c430f7f
28-
- web: https://github.com/advisories/GHSA-2v6x-frw8-7r7f

data/reports/GO-2022-0629.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,3 @@ credit: tam7t (Tommy Murphy)
3535
references:
3636
- fix: https://github.com/kubernetes-sigs/secrets-store-csi-driver/pull/371
3737
- fix: https://github.com/kubernetes-sigs/secrets-store-csi-driver/commit/c2cbb19e2eef16638fa0523383788a4bc22231fd
38-
- web: https://github.com/advisories/GHSA-5cgx-vhfp-6cf9

data/reports/GO-2022-0643.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@ ghsas:
2020
references:
2121
- fix: https://github.com/elastic/beats/pull/5457
2222
- fix: https://github.com/elastic/beats/commit/aeca65779d573976981587ca1d1461399e1b59dd
23-
- web: https://github.com/advisories/GHSA-9q3g-m353-cp4p

data/reports/GO-2022-0646.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,5 @@ ghsas:
2525
credit: Sophie Schmieg from the Google ISE team
2626
references:
2727
- advisory: https://aws.amazon.com/blogs/developer/updates-to-the-amazon-s3-encryption-client/?s=09
28-
- web: https://github.com/advisories/GHSA-7f33-f4f5-xwgw
29-
- web: https://github.com/advisories/GHSA-f5pg-7wfw-84q9
3028
- fix: https://github.com/aws/aws-sdk-go/pull/3403
3129
- fix: https://github.com/aws/aws-sdk-go/commit/ae9b9fd92af132cfd8d879809d8611825ba135f4

data/reports/GO-2022-0701.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,3 @@ credit: liggitt (Jordan Liggitt)
3838
references:
3939
- fix: https://github.com/kubernetes/kubernetes/pull/16381
4040
- fix: https://github.com/kubernetes/kubernetes/commit/37f730f68c7f06e060f90714439bfb0dbb2df5e7
41-
- web: https://github.com/advisories/GHSA-jp32-vmm6-3vf5

data/reports/GO-2022-0706.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,3 @@ ghsas:
2121
references:
2222
- fix: https://github.com/elastic/apm-agent-go/pull/888
2323
- fix: https://github.com/elastic/apm-agent-go/commit/dd3e8c593580e7b80a98b57e1cc6e017e56747b4
24-
- web: https://github.com/advisories/GHSA-qqc5-rgcc-cjqh

internal/report/lint.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,16 @@ func (r *Report) lintLineLength(field, content string, addIssue func(string)) {
264264
}
265265
}
266266

267-
// Regex patterns for standard library links.
267+
// Regex patterns for standard links.
268268
var (
269269
prRegex = regexp.MustCompile(`https://go.dev/cl/\d+`)
270270
commitRegex = regexp.MustCompile(`https://go.googlesource.com/[^/]+/\+/([^/]+)`)
271271
issueRegex = regexp.MustCompile(`https://go.dev/issue/\d+`)
272272
announceRegex = regexp.MustCompile(`https://groups.google.com/g/golang-(announce|dev|nuts)/c/([^/]+)`)
273+
274+
nistRegex = regexp.MustCompile(`^https://nvd.nist.gov/vuln/detail/(CVE-.*)$`)
275+
ghsaRegex = regexp.MustCompile(`^https://github.com/.*/(GHSA-[^/]+)$`)
276+
mitreRegex = regexp.MustCompile(`^https://cve.mitre.org/.*(CVE-[\d\-]+)$`)
273277
)
274278

275279
// Checks that the "links" section of a Report for a package in the
@@ -329,6 +333,24 @@ func (r *Report) lintLinks(addIssue func(string)) {
329333
if ref.Type == ReferenceTypeAdvisory {
330334
advisoryCount++
331335
}
336+
if ref.Type != ReferenceTypeAdvisory {
337+
// An ADVISORY reference to a CVE/GHSA indicates that it
338+
// is the canonical source of information on this vuln.
339+
//
340+
// A reference to a CVE/GHSA that is not an alias of this
341+
// report indicates that it may contain related information.
342+
//
343+
// A reference to a CVE/GHSA that appears in the CVEs/GHSAs
344+
// aliases is redundant.
345+
for _, re := range []*regexp.Regexp{nistRegex, mitreRegex, ghsaRegex} {
346+
if m := re.FindStringSubmatch(ref.URL); len(m) > 0 {
347+
id := m[1]
348+
if slices.Contains(r.CVEs, id) || slices.Contains(r.GHSAs, id) {
349+
addIssue(fmt.Sprintf("redundant non-advisory reference to %v", id))
350+
}
351+
}
352+
}
353+
}
332354
}
333355
if advisoryCount > 1 {
334356
addIssue("references should contain at most one advisory link")

0 commit comments

Comments
 (0)