Skip to content

fix: group security alerts by normalized name and link to GHSA pages#15

Merged
albertotb merged 1 commit into
mainfrom
fix/security-update-casing-and-links
Jun 19, 2026
Merged

fix: group security alerts by normalized name and link to GHSA pages#15
albertotb merged 1 commit into
mainfrom
fix/security-update-casing-and-links

Conversation

@albertotb

Copy link
Copy Markdown
Member

Problem

Investigated odd output from the security workflow in python-template#90. Two independent bugs:

1. Casing → split grouping → upgrade-then-downgrade (security correctness)

fetch_alerts() grouped Dependabot alerts by the raw package name. GitHub's advisory database reports the same package under inconsistent casing across advisories (e.g. starlette and Starlette), so it split into two VulnerablePackage entries with different fix versions:

  • starlette (3 CVEs) → fix 1.3.1
  • Starlette (1 CVE) → fix 1.3.0

upgrade_packages() then processed both sequentially: upgraded to 1.3.1, then downgraded to 1.3.0. The lockfile ended on 1.3.0, leaving the three 1.3.1 CVEs unfixed even though the PR claimed to address them — plus two confusingly-cased rows.

2. Broken vulnerability links

Advisory.markdown_link() preferred NVD CVE links. Freshly-assigned CVE-2026-* ids are still RESERVED and return "CVE ID Not Found" on NVD, so the links were dead.

Fix

  • Group alerts by the PEP 503 normalized name so all advisories for a package merge and the highest fix version wins (1.3.1). Single upgrade, single row, lockfile lands on the correct fixed version.
  • Prefer the GHSA advisory URL (always exists for a Dependabot alert) over NVD, showing the CVE id as the link text when present.

Verified both changes with an inline test against the real functions.

https://claude.ai/code/session_01VFS7dXstJqCtX4zYF9Gp3x

Dependabot reports the same package under inconsistent casing across
advisories (e.g. "starlette" and "Starlette"). Grouping by the raw name
split it into two packages with different fix versions, so the second
upgrade downgraded what the first one fixed, leaving the lockfile on a
still-vulnerable version. Group by the PEP 503 normalized name so all
advisories merge and the highest fix version wins.

Also prefer the GHSA advisory URL over NVD for vulnerability links:
freshly-assigned CVEs are often still RESERVED and 404 on NVD, while the
GHSA page always exists for a Dependabot alert.

Claude-Session: https://claude.ai/code/session_01VFS7dXstJqCtX4zYF9Gp3x
@albertotb albertotb merged commit 1b2992d into main Jun 19, 2026
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