fix(core): fall back to humanized title for unmapped alert types#208
Merged
Conversation
|
🚀 Preview package published! Install with: pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple socketsecurity==2.2.92.dev2Docker image: |
Resolves CUS2-2: gptDidYouMean and any future alert type without SDK metadata previously rendered as a blank Alert column in the CLI output table, SARIF report, and PR/security comments. Title resolution now falls back through an explicit override map and a generic humanizer.
#199 landed on main between the original 2.2.91 bump and this PR opening, so 2.2.91 ties main and fails check_version. Bump to 2.2.92.
508154e to
57138a7
Compare
lelia
approved these changes
May 29, 2026
5 tasks
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.
Fixes CE-207. Webflow's CI was blocking on
is-typed-array@1.1.15via Socket CLI 2.2.86, but the Alert column for that row rendered blank. The API returns a singlegptDidYouMeanalert; the bundledsocketdevSDK had no class for that type, soalert.titlewas empty and the table rendered nothing for that row.Root Cause
socket-python-cliresolves alert titles via thesocketdevSDK'sAllIssuesregistry. When the API emits an alert type that has no corresponding class onAllIssues—gptDidYouMeanbeing the case Webflow hit —alert.titleis empty and every downstream consumer (the CLI's console table, SARIF report, PR/security comments) renders blank. There was no fallback.The upstream cause is that
socket-sdk-python'sAllIssuesis hand-maintained and never gotgptDidYouMeanadded. That's tracked in CE-206 (in progress) and is the proper long-term fix.Fix
Title resolution in
Core.add_package_alerts_to_collectionis now a four-step ladder:props.title) if non-empty_ALERT_TYPE_TITLE_OVERRIDES) — currently mapsgptDidYouMean→"Possible typosquat attack (GPT)"licenseSpdxDisjspecial-case (unchanged)_humanize_alert_type) — any future unknown alert type at least renders something legible instead of blankPurely additive: every alert type already covered by the SDK's
AllIssueskeeps its current title.The override map is load-bearing until CE-206 ships. Once
gptDidYouMeanlands insocketdev/core/issues.pyand the CLI'ssocketdevfloor is bumped to include it, the override entry can be removed in a follow-up. The generic humanizer fallback stays as belt-and-suspenders for any future unknown alert types.Test plan:
pytest tests/— green; 8 new tests covergptDidYouMean, an arbitrary unknown type, a regression guard forlicenseSpdxDisj, and the humanizer helper (camelCase, PascalCase, single-word, empty input, acronym preservation). Original test count on author's machine at handoff time: 201 passed, 2 skipped (the two skips are pre-existing gitlab tests onmain).gptDidYouMeanalert; Alert column reads"Possible typosquat attack (GPT)"instead of blank.Public Changelog
CLI now falls back to a humanized alert label for any alert type without an SDK-provided title, so the Alert column never renders blank. Adds an explicit label for
gptDidYouMean("Possible typosquat attack (GPT)") which previously rendered empty for customers on socketdev SDK versions without that alert class.