Skip to content

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

Open
David Larsen (dc-larsen) wants to merge 3 commits into
dl/tracked-branch-pending-headfrom
david/ask-634-pr-comment-cve-links
Open

David Larsen (dc-larsen) wants to merge 3 commits into
dl/tracked-branch-pending-headfrom
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

PR and MR security comments link available GHSA and CVE IDs to GitHub Advisories and NVD. When the title already contains a complete ID, the ID links in place. The row appends the remaining IDs once. Finding identity, SARIF rule IDs, and GitLab finding IDs are preserved.

Stacked on #479 so the advisory links share the 2.16.0 version and changelog section.

Verification

  • Unit and core suite passes with locked dependencies, including tests for whole-ID matching, in-place links, duplicates, and escaped malformed values.
  • Verified the generated comment through GitHub's Markdown API. GitLab MR rendering verification is pending.

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
User-facing HTML comment formatting only, with strict ID shape checks before linking; finding identity and blocking logic are untouched.

Overview
PR and MR security comment rows now turn canonical GHSA and CVE IDs into links (GitHub Advisories and NVD), while plain-text paths still list every distinct ID with GHSA first via new Issue.advisory_ids().

HTML titles use alert_title_html: IDs already spelled out in the alert title are linked in place (no duplicate suffix); any remaining IDs are appended once in parentheses. Non-canonical or malicious ID shapes are escaped and never become arbitrary URLs. Row summaries switched from escaped plain text to this HTML helper; advisory_id() and consolidation keys are unchanged.

Changelog updated for 2.16.0; existing and new tests cover linking, deduplication, whole-ID matching, and HTML escaping.

Reviewed by Cursor Bugbot for commit 97ceb80. 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.

Stale Bugbot comment from a previous run.

@lelia
lelia changed the base branch from main to dl/tracked-branch-pending-head December 4, 2026 19:00
@lelia
lelia deployed to socket-firewall December 4, 2026 19:00 — with GitHub Actions Active
@lelia

lelia commented Dec 4, 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.

✅ 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 97ceb80. Configure here.

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

🐳 Docker preview published: socketdev/cli:pr-477

This mutable tag is only created when a Docker preview is explicitly requested.

This branch was successfully deployed

1 active deployment
socket-firewall — 97ceb80d Deployed Dec 4, 2026 by lelia via python-sfw-smoke-enterprise #745
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