Merge ~pfsmorigo/ubuntu-cve-tracker:pfsmorigo/publish_cves_fix_esm-apps_status into ubuntu-cve-tracker:master

Proposed by Paulo Flabiano Smorigo
Status: Merged
Merged at revision: 5267b30ee030f56105511b15830014b01e64b16f
Proposed branch: ~pfsmorigo/ubuntu-cve-tracker:pfsmorigo/publish_cves_fix_esm-apps_status
Merge into: ubuntu-cve-tracker:master
Diff against target: 88 lines (+57/-5)
3 files modified
scripts/publish-cves-to-website-api.py (+7/-5)
test/website_api/use_esm_status_if_esm_release (+24/-0)
test/website_api/use_esm_status_if_esm_release.json (+26/-0)
Reviewer Review Type Date Requested Status
Alex Murray Approve
Review via email: mp+444054@code.launchpad.net

Description of the change

I found a bug in the publish-cves scripts that ignored "released" status when it's esm-apps and the release is not EOL (focal on). The reason is that it was checking status == "released" but since status is a tuple the correct would be to check status[0] == "released".

I'm adding a test specifically for this case and planning to add more cases in the future.

Also, I took the opportunity to change the code a little bit in order to use in my future PR to add the pocket field.

Meanwhile, I'm checking all the CVEs we have esm-apps releases and will refresh the web page to fix the status.

To post a comment you must log in.
Revision history for this message
Alex Murray (alexmurray) wrote :

LGTM, thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/scripts/publish-cves-to-website-api.py b/scripts/publish-cves-to-website-api.py
2index 46331df..99c95b9 100755
3--- a/scripts/publish-cves-to-website-api.py
4+++ b/scripts/publish-cves-to-website-api.py
5@@ -119,14 +119,16 @@ def post_single_cve(cve_filename):
6 if codename in cve_data["pkgs"][pkg]:
7 status = cve_data["pkgs"][pkg][codename]
8
9- # If the release is EOL or there is an ESM update for it use ESM status
10 if status and status[0] != "released" and codename in cve_lib.get_active_releases_with_esm():
11+ # Check for possible product statuses
12 for release in [codename + "/esm", "esm-infra/" + codename,
13 "esm-apps/" + codename, "ros-esm/" + codename, codename]:
14- if release in cve_data["pkgs"][pkg] and \
15- (codename in cve_lib.eol_releases or cve_data["pkgs"][pkg][release] == "released"):
16- status = cve_data["pkgs"][pkg][release]
17- break
18+ if release in cve_data["pkgs"][pkg]:
19+ esm_status = cve_data["pkgs"][pkg][release]
20+ # Use the ESM status if there is an ESM release or release is EOL
21+ if esm_status[0] == "released" or codename in cve_lib.eol_releases:
22+ status = esm_status
23+ break
24
25 if status:
26 statuses.append(
27diff --git a/test/website_api/use_esm_status_if_esm_release b/test/website_api/use_esm_status_if_esm_release
28new file mode 100644
29index 0000000..9281cbb
30--- /dev/null
31+++ b/test/website_api/use_esm_status_if_esm_release
32@@ -0,0 +1,24 @@
33+PublicDateAtUSN: 2020-08-04 17:00:00 UTC
34+Candidate: CVE-2020-1234
35+CRD: 2020-08-04 17:00:00 UTC
36+PublicDate: 2020-08-04 17:00:00 UTC
37+References:
38+ https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-1234
39+Description:
40+ Publish CVEs to Website API tests
41+Ubuntu-Description:
42+Notes:
43+Mitigation:
44+Bugs:
45+Priority: medium
46+Discovered-by:
47+Assigned-to:
48+CVSS:
49+
50+
51+Patches_package:
52+upstream_package: needs-triage
53+focal_package: needs-triage
54+esm-apps/focal_package: released (1.2.3~esm1)
55+jammy_package: needed
56+esm-apps/jammy_package: released (1.2.4~esm1)
57diff --git a/test/website_api/use_esm_status_if_esm_release.json b/test/website_api/use_esm_status_if_esm_release.json
58new file mode 100644
59index 0000000..b198bd5
60--- /dev/null
61+++ b/test/website_api/use_esm_status_if_esm_release.json
62@@ -0,0 +1,26 @@
63+[{"bugs": [""],
64+ "cvss3": null,
65+ "description": "\nPublish CVEs to Website API tests",
66+ "id": "CVE-2020-1234",
67+ "mitigation": "",
68+ "notes": [],
69+ "packages": [{"debian": "https://tracker.debian.org/pkg/package",
70+ "name": "package",
71+ "source": "https://launchpad.net/ubuntu/+source/package",
72+ "statuses": [{"description": "1.2.3~esm1",
73+ "release_codename": "focal",
74+ "status": "released"},
75+ {"description": "1.2.4~esm1",
76+ "release_codename": "jammy",
77+ "status": "released"},
78+ {"description": "",
79+ "release_codename": "upstream",
80+ "status": "needs-triage"}],
81+ "ubuntu": "https://packages.ubuntu.com/search?suite=all&section=all&arch=any&searchon=sourcenames&keywords=package"}],
82+ "patches": {"package": []},
83+ "priority": "medium",
84+ "published": "2020-08-04 17:00:00 UTC",
85+ "references": ["https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-1234"],
86+ "status": "active",
87+ "tags": {},
88+ "ubuntu_description": ""}]

Subscribers

People subscribed via source and target branches