You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@magpie.apache.org by po...@apache.org on 2026/10/08 11:13:33 UTC
(magpie) branch main updated: generate-cve-json: warn when the public summary is empty or a placeholder (#1559)
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/magpie.git
The following commit(s) were added to refs/heads/main by this push:
new 7065c495 generate-cve-json: warn when the public summary is empty or a placeholder (#1559)
7065c495 is described below
commit 7065c49538ee2c9b2de02e633d1cdf477c6c9aab
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Thu Oct 8 13:13:27 2026 +0200
generate-cve-json: warn when the public summary is empty or a placeholder (#1559)
Co-authored-by: Copilot <22...@users.noreply.github.com>
---
.../generate-cve-json/src/generate_cve_json/cve_json.py | 12 ++++++++++++
tools/cve-tool-vulnogram/generate-cve-json/tests/test_cli.py | 9 +++++++++
2 files changed, 21 insertions(+)
diff --git a/tools/cve-tool-vulnogram/generate-cve-json/src/generate_cve_json/cve_json.py b/tools/cve-tool-vulnogram/generate-cve-json/src/generate_cve_json/cve_json.py
index efb01f73..3a56afd3 100644
--- a/tools/cve-tool-vulnogram/generate-cve-json/src/generate_cve_json/cve_json.py
+++ b/tools/cve-tool-vulnogram/generate-cve-json/src/generate_cve_json/cve_json.py
@@ -147,6 +147,10 @@ _CONFIG_PATH_ENV = "CVE_JSON_CONFIG"
_CONFIG: dict | None = None
+# Below this, the summary is a placeholder rather than a description.
+MIN_SUMMARY_CHARS = 40
+
+
def _resolve_config_path(config_path: Path | str | None = None) -> tuple[Path, bool]:
"""Resolve the config file path following the documented order.
@@ -2454,6 +2458,14 @@ def main(argv: list[str] | None = None) -> int:
cve_id = args.cve_id or parse_cve_id(cve_tool)
title = resolve_title(issue_title, summary, args.title)
description = summary or title
+ if len((summary or "").strip()) < MIN_SUMMARY_CHARS:
+ print(
+ f"warning: `Short public summary for publish` is "
+ f"{'empty' if not summary else 'only ' + str(len(summary.strip())) + ' characters'}; "
+ f"the published CVE description would be {description!r}. "
+ f"Fill the field before publishing.",
+ file=sys.stderr,
+ )
# Advisory URLs come from two sources: the body's "Public advisory URL"
# field (populated by the release manager / security-issue-sync skill
diff --git a/tools/cve-tool-vulnogram/generate-cve-json/tests/test_cli.py b/tools/cve-tool-vulnogram/generate-cve-json/tests/test_cli.py
index 0b683fd5..bd9d8441 100644
--- a/tools/cve-tool-vulnogram/generate-cve-json/tests/test_cli.py
+++ b/tools/cve-tool-vulnogram/generate-cve-json/tests/test_cli.py
@@ -496,6 +496,15 @@ class TestMainHappyPath:
assert "title" in record
assert "affected" in record
+ def test_short_summary_warns_on_stderr(self, monkeypatch, capsys):
+ body = _issue_body()
+ assert "Short public summary for publish" in body
+ monkeypatch.setattr("sys.stdin", io.StringIO(body))
+ monkeypatch.setattr(cve_json, "MIN_SUMMARY_CHARS", 10_000)
+ rc = cve_json.main(["--stdin"])
+ assert rc == 0
+ assert "`Short public summary for publish` is" in capsys.readouterr().err
+
def test_output_to_file(self, monkeypatch, tmp_path, capsys):
monkeypatch.setattr("sys.stdin", io.StringIO(_issue_body()))
out_file = tmp_path / "cve.json"