Normalize Slack issue severity, and stage the SDK v3.6.0 bump - #331
Conversation
Every severity lookup in the Slack reachability formatter is keyed on "medium", but "middle" is what the API sends. A mid-severity finding missed all of them at once: uncounted in the summary, excluded from total_findings so the "and N more" count can go negative, and sorted at the default order of 4 -- below "low" -- so it was truncated out of the message first. Normalized at the point the alert is read rather than by adding a parallel key to each dict, so one canonical spelling flows downstream. The GitLab severity map and the PR comment path already accept both forms; this formatter did not. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
socketdev v3.6.0 bump
socketdev v3.6.0 bumpv3.6.0 bump
Eric Hibbs (flowstate)
left a comment
There was a problem hiding this comment.
[agent] Verified the bug mechanically rather than just trusting the description: on main, SEVERITY_ORDER/SEVERITY_EMOJI/severity_counts all key on 'medium' with no 'middle' entry, so a mid-severity finding (which is what the API actually sends, matching the SDK's SocketIssueSeverity) misses the count, defaults to sort order 4 (below 'low' at 3), and gets the fallback emoji -- exactly the three symptoms described. The one-line normalization at the read site matches the pattern already used in Messages.map_socket_severity_to_gitlab. All 7 new regression tests pass.
Approving the fix itself. The socketdev 3.6.0 version-bump checklist in the description is correctly left undone and unchecked pending that release, so this stays unmerged until then -- nothing for me to act on there.
🚨 NOTE: NOT READY TO MERGE UNTIL SocketDev/socket-sdk-python#107 SHIPS
Summary
Every severity lookup in the Slack reachability formatter is keyed on
medium, butmiddleis what the API sends — it is the value in the OpenAPI spec'sSocketIssueSeverityand in the SDK enum. A mid-severity finding therefore missed all of them at once:severity_countshas nomiddlekey and the increment is guarded byif ... in severity_counts, so the summary always readMedium: 0.total_findings. Sinceomitted_count = total_findings - len(selected_vulnerabilities), a batch of mid-severity findings can drive the "and N more" line negative.low.SEVERITY_ORDER.get(severity, 4)returned the default of 4 againstlow's 3, so mid-severity findings sank to the bottom and were the first truncated at the block limit.The findings themselves were always listed —
purl_groupsdrives that, not the counts — so this is a wrong summary and wrong ordering rather than a missing finding or a false all-clear.Fixed by normalizing to one spelling where the alert is read, rather than adding a parallel
middlekey to four dicts.Messages.map_socket_severity_to_gitlaband the GitLab severity map already accept both forms with a comment callingmiddlethe older format; this formatter never got the same treatment. Worth noting the live spec still listsmiddle, so it is the current value rather than a legacy one.Seven regression tests; five of them fail without the one-line change.
Blocked: the socketdev 3.6.0 bump
Waiting on SocketDev/socket-sdk-python#107 to merge and 3.6.0 to publish. Since the pin is exact,
socketdev==3.6.0cannot land here until the package is actually on PyPI.socketdev==3.5.0→==3.6.0inpyproject.toml, re-runuv lockThat bump needs no other CLI change. Verified by installing the 3.6.0 branch and running this suite: 392 passed, 2 skipped, no failures. The CLI imports none of the SDK's enum types, and every severity lookup already has a default, so the new fallback members cannot reach an unguarded branch. The gain is that ten purl types —
vscode,chrome,edge-extension,firefox-extensionand others — stop being reported asunknown.Note
Low Risk
Small, localized formatter change with regression tests; no auth, API, or scan-blocking behavior.
Overview
Release 2.6.13 fixes how mid-severity alerts appear in Slack reachability notifications when the API sends severity as
middle(OpenAPI/SDK spelling) while the Slack formatter only keyed lookups onmedium.In
_extract_alert_info,middleis now mapped tomediumat read time (same idea asMessages.map_socket_severity_to_gitlab), so Medium counts,total_findings, sort order, emoji, and block-limit truncation behave correctly instead of treating mid findings as unknown/low-priority. Findings were still listed; the bug was summary math and ordering.Adds unit tests in
test_slack_severity_normalization.pyand updates the changelog and package version (2.6.12→2.6.13).Reviewed by Cursor Bugbot for commit 794ce00. Configure here.