Skip to content

Commit fbd194b

Browse files
authored
Merge pull request #117 from robert-cronin/fix/multiple-cves-single-issue
Handle multiple CVEs per issue in official CVE feed
2 parents 6f2202c + 84bb15a commit fbd194b

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

sig-security-tooling/cve-feed/hack/fetch-official-cve-feed.py

+14-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17+
import copy
1718
import json
1819
import requests
1920
from datetime import datetime
@@ -91,10 +92,19 @@ def getCVEStatus(state, state_reason):
9192
if len(title) > 0:
9293
cve['summary'] = title[-1]
9394
if len(title) > 1:
94-
cve_id = title[0]
95-
cve['id'] = cve_id
96-
cve['external_url'] = f'https://www.cve.org/cverecord?id={cve_id}'
97-
cve['_kubernetes_io']['google_group_url'] = f'https://groups.google.com/g/kubernetes-announce/search?q={cve_id}'
95+
cve_ids = [cve_id.strip() for cve_id in title[0].split(',')]
96+
first_cve_id = cve_ids[0]
97+
cve['id'] = first_cve_id
98+
cve['external_url'] = f'https://www.cve.org/cverecord?id={first_cve_id}'
99+
cve['_kubernetes_io']['google_group_url'] = f'https://groups.google.com/g/kubernetes-announce/search?q={first_cve_id}'
100+
101+
# Add additional entries for any remaining CVE IDs
102+
for additional_cve_id in cve_ids[1:]:
103+
additional_cve = copy.deepcopy(cve)
104+
additional_cve['id'] = additional_cve_id
105+
additional_cve['external_url'] = f'https://www.cve.org/cverecord?id={additional_cve_id}'
106+
additional_cve['_kubernetes_io']['google_group_url'] = f'https://groups.google.com/g/kubernetes-announce/search?q={additional_cve_id}'
107+
cve_list.append(additional_cve)
98108
cve_list.append(cve)
99109

100110
feed_envelope['items'] = cve_list

0 commit comments

Comments
 (0)