more changes
This commit is contained in:
1 parent
a8241fa648
commit
8a5c712ef0
3 files changed
+26
-21
No files matched your search
@@ -854,7 +854,7 @@ def build_body(
|
||||
|
||||
|
||||
MAX_NOTIFICATION_CHARS = 2500
|
||||
DISCORD_MAX_NOTIFICATION_CHARS = 1800
|
||||
DISCORD_MAX_NOTIFICATION_CHARS = 1500
|
||||
|
||||
|
||||
def uses_discord(settings: Settings) -> bool:
|
||||
@@ -973,12 +973,19 @@ def build_important_body(
|
||||
entries = cve_entries(result, severity_rank(min_severity))
|
||||
total, fixable, unfixable = split_counts(entries)
|
||||
counts = severity_counts(entries)
|
||||
fixable_counts = {severity: 0 for severity in REPORTED_SEVERITIES}
|
||||
for entry in entries:
|
||||
if entry.fixable:
|
||||
fixable_counts[entry.severity] += 1
|
||||
|
||||
lines = [
|
||||
f"Image: {target.image}",
|
||||
f"Container: {container}",
|
||||
" | ".join(f"{name.title()}: {counts[name]}" for name in REPORTED_SEVERITIES),
|
||||
f"Total: {total} (fixable: {fixable}, unfixable: {unfixable})",
|
||||
" | ".join(
|
||||
f"{name[0]} {fixable_counts[name]}/{counts[name]}"
|
||||
for name in REPORTED_SEVERITIES
|
||||
),
|
||||
f"Total: {fixable}/{total} (fixable/total)",
|
||||
"",
|
||||
"CVEs:",
|
||||
]
|
||||
@@ -1000,15 +1007,10 @@ def build_other_containers_body(
|
||||
Each row is ``(image, container, total, fixable, unfixable)``.
|
||||
"""
|
||||
lines = ["Other containers with findings:", ""]
|
||||
total_all = 0
|
||||
for image, container, total, fixable, unfixable in rows:
|
||||
total_all += total
|
||||
label = f"{image} [{container}]" if container else image
|
||||
lines.append(
|
||||
f"* {label}: {total} total "
|
||||
f"({fixable} fixable, {unfixable} unfixable)"
|
||||
)
|
||||
lines += ["", f"Total: {total_all} CVE(s) in {len(rows)} container(s)"]
|
||||
lines.append(f"* {label}: {fixable}/{total} (fixable/total)")
|
||||
lines += ["", f"Total: {sum(row[2] for row in rows)} CVE(s) in {len(rows)} container(s)"]
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user