Repository navigation
Link advisory IDs in PR and MR security comments - #477
David Larsen (dc-larsen) wants to merge 2 commits into
Conversation
PR SummaryLow Risk Overview 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. Reviewed by Cursor Bugbot for commit 3f3be31. Configure here. |
|
bugbot run |
There was a problem hiding this comment.
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.0changelog: “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.
7ec9f6d to
3f3be31
Compare
|
bugbot run |
There was a problem hiding this comment.
✅ 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.
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.
Behavior
Issue.advisory_ids()returns every distinct GHSA and CVE ID on an alert, GHSA first, from the same props asadvisory_id()(ghsaId,ghsa_id,cveId,cve_id,cve, string or list), in the API's spelling.Messages.alert_title_html()escapes the title and links each ID: GHSA tohttps://github.com/advisories/, CVE tohttps://nvd.nist.gov/vuln/detail/, the same sites the GitLab security report links. An ID the title already names in full is linked in place; the remaining IDs are appended once in parentheses. IDs match only in full, soCVE-2021-2333is not hidden byCVE-2021-23337in the title. Only canonical GHSA and CVE shapes become links; anything else stays escaped text.--branchand--commit-shabefore marking scan as default branch #478. The version lines are identical to Check--branchand--commit-shabefore marking scan as default branch #478's, so Version Check passes before Check--branchand--commit-shabefore marking scan as default branch #478 lands and the two merge without conflict on them; only the## 2.16.0CHANGELOG heading needs combining.Finding identity
advisory_id()andconsolidation_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
GITHUB_ACTORset.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 unrelatedCVE-2021-23337becomes a GitHub link as well.POST https://gitlab.com/api/v4/markdownreturns 401 without a token, so it needs a check in a GitLab MR.Public Changelog
PR and MR security comments link available GHSA and CVE IDs to their public advisory pages.
Refs: CE-532