Skip to content

Name the introducing dependency in PR/MR security comments - #452

Open
lelia wants to merge 1 commit into
mainfrom
lelia/ce-495-prmr-security-comments-fix-alert-links
Open

lelia wants to merge 1 commit into
mainfrom
lelia/ce-495-prmr-security-comments-fix-alert-links

Conversation

@lelia

@lelia lelia commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Security and license alerts on a transitive dependency now name the direct dependency that introduced it, on a new line under the manifest link:

<p><strong>Source:</strong> <a href="…">Manifest File</a></p>
<p><strong>Introduced by:</strong> <code>npm/@acme/widgets@1.2.0</code></p>

The default comment showed only the manifest file; introduced_by was rendered only in the legacy table format.

  • Direct dependencies, and transitive ones whose ancestors aren't in the scan, get no line.
  • An ancestor declared in several manifests is listed once; more than five are shown as "… and N more".
  • Names are HTML-escaped like the other repository-controlled text in the comment.

Namespaces in ancestor labels

get_source_data built ancestor labels from type/name@version, dropping the npm scope or Maven group ID, so @acme/widgets rendered as npm/widgets@… and two same-named scoped roots collapsed into one. This carries the same fix as #405 so the new line is correct without waiting on that stack. Whichever lands second resolves a one-hunk conflict in get_source_data.

Overlap with open PRs

Testing

  • New cases in tests/unit/test_pr_comment_rendering.py covering transitive, direct and no-ancestor alerts, deduplication, the cap, escaping, the license row, HTML-block integrity, and namespaced npm and Maven ancestor labels.
  • uv run pytest tests: 762 passed. ruff check clean.

Bumps to 2.12.1.

Refs CE-495

@lelia
lelia requested a review from a team as a code owner November 14, 2026 01:56
@cursor

cursor Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Comment-only output and ancestor label formatting with HTML escaping and broad unit coverage; no auth, scan, or API behavior changes.

Overview
Release 2.12.1 adds an Introduced by: line to default GitHub/GitLab-style security and license alert details for transitive dependencies, placed under the manifest link. The line lists up to five deduplicated direct-dependency PURLs (with "and N more" when needed), skips direct deps and transients with no known ancestors, and escapes names like other repo-controlled comment text.

Ancestor labels used for that line are fixed in Core.get_source_data: scoped npm and Maven roots now render as type/namespace/name@version instead of dropping the scope or group ID.

Version bumps and changelog entries accompany new unit tests for rendering, caps, deduplication, escaping, and namespaced ancestors.

Reviewed by Cursor Bugbot for commit 84f06bc. Configure here.

@lelia

lelia commented Nov 14, 2026

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.

Security and license alerts on a transitive dependency now show the direct
dependency that introduced it, under the manifest link. The default comment
previously showed only the manifest file; introduced_by was rendered only in
the legacy table format. Ancestors are deduplicated and capped at five.

Keep the namespace in introducing package labels, so scoped npm packages
and Maven artifacts render as npm/@scope/name@version rather than losing
their scope or group ID.

Bump to 2.12.1.
@lelia
lelia force-pushed the lelia/ce-495-prmr-security-comments-fix-alert-links branch from 6f7abca to 84f06bc Compare November 14, 2026 02:21
@lelia
lelia deployed to socket-firewall November 14, 2026 02:21 — with GitHub Actions Active
@lelia

lelia commented Nov 14, 2026

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 84f06bc. Configure here.

This branch was successfully deployed

1 active deployment
socket-firewall — 84f06bc1 Deployed Nov 14, 2026 by lelia via python-sfw-smoke-enterprise #593
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.

1 participant