Repository navigation
Link "This package" in PR/MR comments to the package page - #465
Draft
David Larsen (dc-larsen) wants to merge 5 commits into
Draft
David Larsen (dc-larsen) wants to merge 5 commits into
David Larsen (dc-larsen) wants to merge 5 commits into
Conversation
Each security comment row linked "This package" to the bare package coordinate (alert.purl, e.g. handlebars@4.0.11), so GitHub and GitLab resolved it as a relative link to a page that does not exist. The alert rows have done this since the HTML comment template was introduced, and license rows since they were added; the --strict-blocking existing-alerts table reuses both templates. Both rows now use alert.url, the package overview URL that Package.socket_url builds with the namespace (npm scope, Maven groupId, Go module path). The Markdown, Slack and Jira outputs already link the package with that URL.
David Larsen (dc-larsen)
deployed
to
socket-firewall
November 20, 2026 22:15 — with
GitHub Actions
Active
…inks # Conflicts: # CHANGELOG.md
This was referenced Nov 20, 2026
…inks # Conflicts: # CHANGELOG.md # socketsecurity/core/messages.py
2.13.2 was released from main, so this change needs the next patch version.
David Larsen (dc-larsen)
deployed
to
socket-firewall
November 20, 2026 23:11 — with
GitHub Actions
Active
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every row of the PR/MR security comment has a "Read more on: This package" link whose
hrefis the bare package coordinate:GitHub and GitLab treat that as a relative link, so it opens
.../pull/handlebars@4.0.11(a 404) instead of the package page. Since #453,--strict-blockingcomments also list existing alerts with the same row templates, so the broken link shows on existing-alert rows too. Found while verifying 2.13.0 against real pull request scans: on a test pull request all 38 rows had a relative link.Root Cause
Messages.security_alert_rowandMessages.license_group_rowrenderhref="{alert.purl}". In the CLI,Issue.purlis the bare coordinate ([namespace/]name@version, set inCore.update_package_values), not a URL. The alert row has done this since the HTML comment template was added (#79), and the license row since license groups were added (#111). #453 did not introduce it; it reuses both templates for the existing-alerts table.Fix
Both rows now link "This package" to
alert.url, the package overview URL thatPackage.socket_urlalready builds:https://socket.dev/<ecosystem>/package/<namespace>/<name>/overview/<version>, with the namespace as its own path segment (npm scope, Maven groupId, Go module path). It is the same URL the Markdown, Slack and Jira outputs already use for the package link, and it goes throughMessages.html_attras before. GitHub and GitLab post the same rendered comment, so both are fixed.Overlap, for a maintainer call:
hrefchange as part of a larger link rework. It also replaces "This alert" and the fixed "What is known malware?" link with a per-type "About this alert type" link. This PR is only the two-line fix againstmainso it can ship with 2.13.3. If Correct package and alert information links #406 lands first, this one is redundant.alert.url, so after this change both links open the same package page. Pointing "This alert" at the alert itself is what Correct package and alert information links #406 does; this PR leaves it alone.maininto this branch kept that line and this PR'shrefchange: the alert row merged cleanly, and the license row needed a one-line resolution.Tests
tests/unit/test_comment_package_links.py(new, 21 cases). Each case starts from a diff artifact as the API returns it and goes throughPackage.from_diff_artifact,Core.update_package_valuesandCore.add_package_alerts_to_collectionto the rendered comment. Alert rows and license rows for npm, scoped npm (@babel/traverse), PyPI, Maven (org.apache.logging.log4j/log4j-core), Go (github.com/gin-gonic/gin), NuGet, RubyGems and Cargo link to the expectedhttps://socket.dev/...URL; the existing-alerts table does the same; no row on either SCM has a relative link; a hostile package name stays attribute-escaped. All 21 fail onmain.uv run pytest -q tests/unit/ tests/core/: 1022 passed (1001 onmain).uv run ruff check,uv lock --locked --offline,git diff --checkanduv buildpass.--scm github --strict-blocking. 2.13.0 from PyPI posted the comment, then this branch updated it. Thehrefs come from the comment body, and the rendered links from the API'sbody_html:href(38 rows: 35 vm2, 3 existing)vm2@3.9.11,handlebars@4.0.11,lodash@4.17.11,minimist@0.0.10https://socket.dev/npm/package/vm2/overview/3.9.11,.../handlebars/overview/4.0.11,.../lodash/overview/4.17.11,.../minimist/overview/0.0.10rel="nofollow"Other open 2.13.x fixes
2.13.1 and 2.13.2 were released from
mainon 2026-11-20, so this branch mergesmainatv2.13.2and bumps to2.13.3inpyproject.toml,socketsecurity/__init__.pyanduv.lock, with its CHANGELOG entries under a new## 2.13.3heading. #459, #460, #461, #462, #463, #464 and #465 all make the same bump, so the version files merge cleanly between them, and once one merges the rest ride main's unreleased2.13.3(Version Check accepts a version equal to main's while it is above the latest PyPI release). Merging a second one conflicts only inCHANGELOG.md: keep one## 2.13.3heading and combine the bullets under its subsections (Upgrade notes, Changed, Fixed, Documentation, in that order). There are no code conflicts between them. Ifmainreleases 2.13.3 before this merges, bump to the next patch again.Public Changelog
The "This package" link in PR/MR security comments opens the package's page on socket.dev. It used to be a broken relative link.