fix: fail closed on incomplete weekly image and CVE surveys
This commit is contained in:
@@ -234,6 +234,8 @@ def _registry_urls(recipe: str):
|
||||
urls = []
|
||||
for u in re.findall(r"https?://[^\s)|\]]+", text):
|
||||
u = u.rstrip("`'\"*.,;:>)")
|
||||
if "…" in u or "..." in u:
|
||||
continue
|
||||
if u and u not in urls:
|
||||
urls.append(u)
|
||||
return urls, path
|
||||
@@ -272,21 +274,23 @@ def main() -> int:
|
||||
blind_recipes, noisy = [], 0
|
||||
for r in recipes:
|
||||
rows = security_source_audit(r)
|
||||
feeds = [x for x in rows if x["kind"] == "advisory-feed" and x["cves"] > 0]
|
||||
logs = [x for x in rows if x["kind"] == "changelog"]
|
||||
feeds = [x for x in rows if x["kind"] == "advisory-feed" and x["cves"] > 0
|
||||
and x["status"] == "ok"]
|
||||
logs = [x for x in rows if x["kind"] == "changelog" and x["status"] == "ok"]
|
||||
unattr = [x for x in rows if x["kind"] == "unattributable"]
|
||||
failed = [x for x in rows if x["status"].startswith("error:")]
|
||||
noisy += len(unattr)
|
||||
usable = len(feeds) + len(logs)
|
||||
if usable == 0:
|
||||
blind_recipes.append(r)
|
||||
print(f"!! {r}: NO USABLE CVE SOURCE — {len(unattr)} unparseable page(s), "
|
||||
f"0 advisory feeds, 0 attributable changelogs")
|
||||
print(f"!! {r}: NO VERIFIED CVE SOURCE — {len(unattr)} unparseable page(s), "
|
||||
f"0 populated advisory feeds, 0 attributable changelogs, {len(failed)} failed source(s)")
|
||||
for x in rows:
|
||||
print(f" {x['kind']:15} {x['source'][:64]} ({x['cves']} CVEs)")
|
||||
print(f" {x['kind']:15} {x['source'][:64]} ({x['cves']} CVEs; {x['status']})")
|
||||
else:
|
||||
print(f"OK {r}: {len(feeds)} advisory-feed(s), {len(logs)} changelog(s)"
|
||||
+ (f", {len(unattr)} unparseable page(s) (redundant — covered by a feed)"
|
||||
if unattr else ""))
|
||||
+ (f", {len(unattr)} unparseable page(s)" if unattr else "")
|
||||
+ (f", {len(failed)} failed source(s) — counts incomplete" if failed else ""))
|
||||
for x in logs:
|
||||
print(f" changelog {x['source'][:62]} ({x['usable']}/{x['cves']})")
|
||||
print(f"\n{len(recipes)} recipes · {len(blind_recipes)} with NO usable CVE source"
|
||||
|
||||
Reference in New Issue
Block a user