Skip to content

Commit 0b1b934

Browse files
committed
check_patches: Print CVE ids that are missing in the tracker
1 parent 4a41c27 commit 0b1b934

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

check_patches.py

+19-3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ def parse_patches_from_tracker():
3030
def find_missing_patches(patches, patches_dir):
3131

3232
missing_patches = {}
33+
missing_tracker_cves = []
3334

3435
subdirs = [node for node in os.listdir(patches_dir)
3536
if os.path.isdir(os.path.join(patches_dir, node))]
@@ -43,7 +44,17 @@ def find_missing_patches(patches, patches_dir):
4344
missing.append(patch)
4445
missing_patches[subdir] = missing
4546

46-
return missing_patches
47+
our_cves = []
48+
for subdir in subdirs:
49+
patch_dir = os.path.join(patches_dir, subdir)
50+
subdir_patches = [os.path.splitext(node)[0] for node in os.listdir(patch_dir)]
51+
our_cves.extend(subdir_patches)
52+
53+
for cve in our_cves:
54+
if cve not in patches:
55+
missing_tracker_cves.append(cve)
56+
57+
return (missing_patches, missing_tracker_cves)
4758

4859

4960
"""
@@ -90,15 +101,20 @@ def main():
90101

91102
# query CVE list from Lineage tracker
92103
patches = parse_patches_from_tracker()
93-
missing_patches = find_missing_patches(patches, patches_dir)
104+
(missing_patches, missing_tracker_cves) = find_missing_patches(patches, patches_dir)
94105

95-
print("missing patchfiles:\n")
106+
print("missing patchfiles for this tool:\n")
96107
for subdir in missing_patches:
97108
print(subdir)
98109
for patch in missing_patches[subdir]:
99110
print("\t" + patch)
100111
print("")
101112

113+
print("missing CVEs in the tracker:\n")
114+
for cve_id in missing_tracker_cves:
115+
print("\t" + cve_id)
116+
print("")
117+
102118

103119
if __name__ == "__main__":
104120
main()

0 commit comments

Comments
 (0)