Skip to content

Commit f147907

Browse files
committed
Store issue details as JSON dump
Signed-off-by: Keshav Priyadarshi <[email protected]>
1 parent 8e91c32 commit f147907

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

vulnerabilities/pipelines/compute_advisory_todo.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ def compute_individual_advisory_todo(self):
8282
logger=self.log,
8383
)
8484

85+
self.log(
86+
f"Successfully created {new_todos_count} ToDos for missing summary, affected and fixed packages"
87+
)
88+
8589
def detect_conflicting_advisories(self):
8690
"""
8791
Create ToDos for advisories with conflicting opinions on fixed and affected
@@ -128,6 +132,10 @@ def detect_conflicting_advisories(self):
128132
logger=self.log,
129133
)
130134

135+
self.log(
136+
f"Successfully created {new_todos_count} ToDos for conflicting affected and fixed packages"
137+
)
138+
131139

132140
def check_missing_summary(
133141
advisory,
@@ -266,14 +274,14 @@ def check_conflicting_affected_and_fixed_by_packages_for_alias(
266274

267275
if len(unique_set_of_affected_vers) > 1:
268276
has_conflicting_affected_packages = True
269-
conflicting_affected = json.dumps(unique_set_of_affected_vers, default=list)
270277
messages.append(
271-
f"{cve}: {purl} with conflicting affected versions {conflicting_affected}"
278+
f"{cve}: {purl} with conflicting affected versions {unique_set_of_affected_vers}"
272279
)
273280
if len(unique_set_of_fixed_versions) > 1:
274281
has_conflicting_fixed_package = True
275-
conflicting_fixed = json.dumps(unique_set_of_fixed_versions, default=list)
276-
messages.append(f"{cve}: {purl} with conflicting fixed version {conflicting_fixed}")
282+
messages.append(
283+
f"{cve}: {purl} with conflicting fixed version {unique_set_of_fixed_versions}"
284+
)
277285

278286
if not has_conflicting_affected_packages and not has_conflicting_fixed_package:
279287
return
@@ -284,13 +292,16 @@ def check_conflicting_affected_and_fixed_by_packages_for_alias(
284292
elif not has_conflicting_affected_packages:
285293
issue_type = "CONFLICTING_FIXED_BY_PACKAGES"
286294

287-
messages.append("Comparison matrix:")
288-
messages.append(json.dumps(matrix, indent=2, default=list))
295+
issue_detail = {
296+
"Conflict summary": messages,
297+
"Conflict matrix": matrix,
298+
}
299+
289300
todo_id = advisories_checksum(advisories)
290301
todo = AdvisoryToDo(
291302
related_advisories_id=todo_id,
292303
issue_type=issue_type,
293-
issue_detail="\n".join(messages),
304+
issue_detail=json.dumps(issue_detail, default=list),
294305
)
295306
todo_to_create.append(todo)
296307
advisory_relation_to_create[todo_id] = list(advisories)

0 commit comments

Comments
 (0)