Skip to content

generate-cve-json: warn when a credit line joins several names by comma - #1741

Merged
potiuk merged 2 commits into
apache:mainfrom
srijavuppala:fix/credit-comma-joined-names
Nov 5, 2026
Merged

potiuk merged 2 commits into
apache:mainfrom
srijavuppala:fix/credit-comma-joined-names

Conversation

@srijavuppala

Copy link
Copy Markdown
Contributor

Summary

  • parse_credits_from_field splits the "Reporter credited as" / "Remediation developer" fields on newlines only (not commas), so a line like "Name A, Name B, Name C" is silently recorded as one joined credit with no warning.
  • Add a heuristic check, run inline where each credit line is parsed: when a line's comma-separated parts contain two or more that read as a person's name (capitalised multi-word, no affiliation-ish word), print a warning: to stderr naming the line, so the operator can split it before the push. The documented Full Name, Affiliation one-comma shape (e.g. Jed Cunningham, Astronomer) is unaffected and does not warn.
  • Parsing behaviour itself is unchanged — the line is still carried through as a single credit either way; this only adds the missing warning signal.

Type of change

  • Python package (tools/*/ with pyproject.toml)

Test plan

  • prek run --all-files passes — could not verify end-to-end in my sandbox: the whole-workspace ruff/mypy/pytest hooks shell out via uv run across all 48 members, and in this environment that fails for two reasons unrelated to this change: (1) the local uv version mis-parses this repo's exclude-newer = "7 days" and re-resolves uv.lock on every invocation, which pre-commit reports as "files modified"; (2) one unrelated member's test (skill-token-count) needs to download a tokenizer file from openaipublic.blob.core.windows.net, which my sandbox's network policy denies outright (403). I skipped workspace-ruff-check, workspace-ruff-format, workspace-mypy, workspace-pytest locally for exactly those reasons (see Notes below) — every other prek hook ran and passed normally.
  • For Python packages touched: uv run pytest / ruff check / mypy passes — ran directly against tools/cve-tool-vulnogram/generate-cve-json: pytest 419 passed, ruff check all checks passed, mypy no issues found in 11 source files. Added 4 new tests covering the warning (joined names, the documented name+affiliation exception, an independent-researcher affiliation phrase, and a plain two-name case).

RFC-AI-0004 compliance

None of these rows apply: no new mutation, no new network/host access, no new placeholder-bearing prose, no agentic-override surface, no outbound messages, no privacy-LLM-routed content. This is a local, deterministic heuristic added to an existing pure-function parser.

Linked issues

Fixes #1737

Notes for reviewers

  • Generative-AI disclosure: this PR was drafted by an AI coding agent (Claude Sonnet 5) on behalf of @srijavuppala, who reviews it before it is marked ready for review.
  • Why a heuristic instead of a hard split: the issue itself notes a comma can't simply be split on (the one-comma Name, Affiliation shape is intentionally one credit), so this only adds a warning, never changes what's parsed. The name-vs-affiliation heuristic (_looks_like_a_persons_name) is deliberately conservative — a missed warning is harmless (today's unchanged behaviour), so the affiliation-word list errs toward flagging a part as not name-like rather than risk a false "these are N names" claim.
  • Locally skipped hooks: SKIP=workspace-ruff-check,workspace-ruff-format,workspace-mypy,workspace-pytest — see Test plan above for why; happy to re-run any of them if there's a way around the sandbox's network/uv constraints that I'm missing.

@github-actions github-actions Bot added family:tools tools/* contract:cve-authority Tool capability: CVE allocation / record management / publication labels Oct 21, 2026
@potiuk
potiuk marked this pull request as ready for review October 27, 2026 23:43
@potiuk
potiuk marked this pull request as draft October 28, 2026 00:08

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking up #1737, @srijavuppala, and for the clear write-up of why this warns rather than splits. The heuristic is a reasonable start; the main point is where the signal lands, since the operator it is meant for never sees stderr.

flagging a single-line value with two or more name-like comma-separated parts in needs_decision (or normalisation_changes) (tools/cve-tool-vulnogram/generate-cve-json/src/generate_cve_json/cve_json.py:733)

Suggest flagging a single-line value with two or more name-like comma-separated parts in needs_decision (or normalisation_changes) so the operator splits it before the push.

print(
    f"warning: credit line {line!r} looks like {name_like} names "
    ...
    file=sys.stderr,
)

The skills that run the generator act on its --report-json file only: security-issue-sync (apply-and-push.md:268-272) and security-cve-allocate (tracker-updates.md:58) route a non-empty normalisation_changes, missing_required or needs_decision through outcomes/cve-json-fallback.md, and nothing reads stderr. So the operator the issue is about never sees this warning. Record it in the report instead. needs_decision makes the tool exit 2 with no record, which is too strong for a heuristic, so a non-blocking entry fits: write_report keeps to field names, line numbers and kinds, never body text, so the entry would be something like {field: "Reporter credited as", line: N, kind: "joined-credits"}. Then cve-json-fallback.md needs a line telling the skill to show it to the user.

Smaller observations

  • tools/cve-tool-vulnogram/generate-cve-json/src/generate_cve_json/cve_json.py — The prek job fails because check-family-plugins regenerates the plugin's vendored copy, plugins/magpie-security-tools/tools/cve-tool-vulnogram/generate-cve-json/src/generate_cve_json/cve_json.py, which the PR did not commit. prek run check-family-plugins --all-files needs no network; run it and commit the regenerated file. On the local uv trouble in the test plan: exclude-newer = "7 days" needs a recent uv, so upgrading uv should stop it re-resolving uv.lock.
  • See inline comments on tools/cve-tool-vulnogram/generate-cve-json/src/generate_cve_json/cve_json.py:769, tools/cve-tool-vulnogram/generate-cve-json/src/generate_cve_json/cve_json.py:704.

This review was drafted by an AI-assisted tool and
confirmed by an Apache Magpie maintainer. The findings
below are observations, not blockers; an Apache Magpie
maintainer — a real person — will take the next look at the
PR. If you think a finding is mis-applied, please reply on
the PR and a maintainer will weigh in.

More on how Apache Magpie handles maintainer review:
Contributing guide.

@potiuk
potiuk marked this pull request as ready for review October 31, 2026 21:18

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs fixes r=that I pointed out

@srijavuppala

srijavuppala commented Nov 1, 2026 via email

Copy link
Copy Markdown
Contributor Author

`parse_credits_from_field` splits the "Reporter credited as" field on
newlines only, so the documented `Full Name, Affiliation` shape stays
one credit. That same rule silently swallows "Name A, Name B, Name C"
into one credit too, with no warning, because a comma cannot simply be
split on without breaking the affiliation case.

Add a heuristic check: when a line's comma-separated parts contain two
or more that read as a person's name (capitalised multi-word, no
affiliation-ish word), print a warning naming the line and suggesting
each person go on their own line. Parsing itself does not change;
the line is still carried through as one credit, so an operator who
means "name + affiliation" can ignore the warning.

Generated-by: Claude Sonnet 5
@potiuk
potiuk force-pushed the fix/credit-comma-joined-names branch from a0ca353 to 7264459 Compare November 4, 2026 23:39
@potiuk

potiuk commented Nov 4, 2026

Copy link
Copy Markdown
Member

I rebased this onto main and force-pushed, so please pull before pushing again. There were no conflicts. I added one file: main now ships a plugin copy of cve_json.py, so your change is mirrored into plugins/magpie-security-tools/ by check-family-plugins. My review comments still stand.

The stderr warning never reached the operator: the skills act only on
--report-json. It also ran inside a parser called several times per
generation, so one line warned repeatedly.

- Check each credit field once in main(), and keep
  parse_credits_from_field pure.
- Add a non-blocking joined-credits entry to normalisation_changes,
  with the field and line number and no body text.
- Tell cve-json-fallback to show the entry to the user as a possible
  false alarm, since a multi-word company reads like a name.
- Cover the Red Hat, Trend Micro and Palo Alto Networks lines in tests.

Generated-by: Claude Opus 5
@github-actions github-actions Bot added family:security security-* skills family:docs Docs, MISSION.md, READMEs capability:intake Import external signal + sync tracker state labels Nov 5, 2026

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, and for the patience. I've pushed a fixup on top of your commit so this can land now, instead of asking for another round.

  • cve_json.py: the check now runs once per field in main(), so parse_credits_from_field stays pure and a line is no longer reported several times.
  • cve_json.py: a line that may join names adds a non-blocking joined-credits entry to normalisation_changes, because the skills read --report-json and not stderr. The stderr warning stays for anyone running the tool by hand.
  • cve-json-fallback.md: the skill now shows that entry to the user and says it may be a false alarm, since a multi-word company reads like a name.
  • Tests now cover Jane Doe, Red Hat, Alice Smith, Trend Micro and Bob Lee, Palo Alto Networks, plus the report entry.

Please pull before pushing again.


This review was drafted by an AI-assisted tool and
confirmed by an Apache Magpie maintainer. The maintainer
approving this PR has read the findings and signed off. If
something feels off, please reply on the PR and a maintainer
will follow up.

More on how Apache Magpie handles maintainer review:
Contributing guide.

@potiuk
potiuk merged commit d54e733 into apache:main Nov 5, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

capability:intake Import external signal + sync tracker state contract:cve-authority Tool capability: CVE allocation / record management / publication family:docs Docs, MISSION.md, READMEs family:security security-* skills family:tools tools/*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

generate-cve-json: comma-separated names in credit fields become one joined credit silently

3 participants