Skip to content

Link advisory IDs in PR and MR security comments - #477

Open
David Larsen (dc-larsen) wants to merge 2 commits into
mainfrom
david/ask-634-pr-comment-cve-links
Open

David Larsen (dc-larsen) wants to merge 2 commits into
mainfrom
david/ask-634-pr-comment-cve-links

Conversation

@dc-larsen

@dc-larsen David Larsen (dc-larsen) commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Each alert in a PR/MR security comment now links every GHSA and CVE ID it carries to its public advisory page, instead of showing one unlinked ID.

Before: lodash@4.17.20 - Critical CVE (GHSA-35JH-R3H4-6JHM)
After:  lodash@4.17.20 - Critical CVE (GHSA-35jh-r3h4-6jhm, CVE-2021-23337)
                                       └ github.com/advisories  └ nvd.nist.gov

Behavior

Finding identity

advisory_id() and consolidation_key() are unchanged, so de-duplication, SARIF rule IDs and GitLab finding IDs don't move. A test pins that adding a CVE to a GHSA alert keeps its consolidation key.

Rendering checks

  • Tests cover both IDs, GHSA only, CVE only, older and snake_case spellings with duplicates, an ID linked in place (with the title's spelling and the API's ID as the target), escaping around an in-place link, the prefix case, a malformed ID (escaped, not linked), and alerts with no ID. Full suite: 1,176 passed, also with GITHUB_ACTOR set.
  • GitHub: a comment rendered by the CLI through POST /markdown (mode=gfm) keeps every link inside each <summary>, including the in-place link. GitHub also auto-links a bare CVE ID left as plain text to its own advisory page, so in the prefix case the title's unrelated CVE-2021-23337 becomes a GitHub link as well.
  • GitLab: not verified. POST https://gitlab.com/api/v4/markdown returns 401 without a token, so it needs a check in a GitLab MR.
  • The GitHub Advisories and NVD targets return 200.

Public Changelog

PR and MR security comments link available GHSA and CVE IDs to their public advisory pages.


Refs: CE-532

@dc-larsen
David Larsen (dc-larsen) requested a review from a team as a code owner December 1, 2026 18:52
@cursor

cursor Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Comment HTML rendering and display-only advisory listing; deduplication and blocking identity are explicitly preserved and covered by tests.

Overview
Release 2.16.0 changes how PR/MR security comment rows show vulnerability identifiers. Instead of appending one plain-text advisory ID, alert titles now use Issue.advisory_ids() to list every distinct GHSA and CVE (GHSA first) and Messages.alert_title_html() to render them as links—GHSA to GitHub Advisories and CVE to NVD—matching the GitLab report targets.

IDs already present in the title are linked in place without duplicating them in parentheses; non-canonical ID shapes stay escaped text rather than becoming links. advisory_id() and consolidation_key() are unchanged, so deduplication and SARIF/GitLab finding identity stay the same. Plain-text alert_title_with_advisory() now lists multiple IDs when needed.

Reviewed by Cursor Bugbot for commit 3f3be31. Configure here.

@lelia

lelia commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@lelia lelia self-assigned this Dec 2, 2026

@lelia lelia left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

David Larsen (@dc-larsen), please fix one rendering edge case before this lands.

Advisory IDs in alert titles

In advisory_ids_for_title(), an ID already in the title is excluded from the linked list, so it stays plain text. The substring check can also hide a different CVE whose ID is a prefix of one in the title. Link a complete ID in place and append links for the remaining IDs once. Add tests for both cases and keep the escaping and finding-identity coverage. Please verify the links render in a GitLab MR as well as GitHub.

PR and release notes

  • Suggested title: Link advisory IDs in PR and MR security comments. Keep the before/after example. Trim the body to the behavior, identity compatibility, and rendering checks. Shorten the rendering docstring to its escaping and link contract.
  • Put a single entry under Changed in the shared 2.16.0 changelog: “PR and MR security comments link available GHSA and CVE IDs to their public advisory pages.” Use the same sentence in the PR’s Public Changelog block. The existing CLI reference and README are sufficient for this presentation change.
  • Please fold this into 2.16.0. #478 should set the version because it adds a supported CLI flag. Drop the independent 2.15.7 bump and rerun CI and Bugbot on the final head.

Each security comment row showed one advisory ID, the GHSA when the alert
had one and the CVE otherwise, as plain text. Alerts from the API usually
carry both, so the CVE was dropped from the row, and developers who only
see the PR comment had no link to the advisory.

Rows now list every advisory ID on the alert, GHSA first, each linked to
its public page (github.com/advisories for GHSA, nvd.nist.gov for CVE),
the same two sites the GitLab security report already links. Only IDs in
the canonical GHSA or CVE shape are linked; anything else renders as
escaped text. IDs keep the API's spelling instead of being upper-cased.

Issue.advisory_ids() is new and used only for display. advisory_id() and
consolidation_key() are unchanged, so de-duplication, SARIF rule IDs and
GitLab finding IDs stay the same.

Shares the 2.16.0 version set in #478.
An ID the title already named was dropped from the linked list and stayed
plain text, and the substring check also hid a different CVE whose ID is a
prefix of one in the title (CVE-2021-2333 inside CVE-2021-23337).

IDs now match only in full. An ID the title names is linked in place, keeping
the title's spelling and linking the API's ID, and the remaining IDs are
appended once. The plain-text title uses the same full-ID match.
@dc-larsen
David Larsen (dc-larsen) force-pushed the david/ask-634-pr-comment-cve-links branch from 7ec9f6d to 3f3be31 Compare December 2, 2026 15:44
@dc-larsen David Larsen (dc-larsen) changed the title Link the GHSA and CVE ID on each PR/MR comment alert Link advisory IDs in PR and MR security comments Dec 2, 2026
@dc-larsen

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 3f3be31. Configure here.

This branch was previously deployed

1 inactive deployment
socket-firewall — 3f3be315 Deployed Dec 2, 2026 by dc-larsen via python-sfw-smoke-enterprise #723
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants