Skip to content

Normalize Slack issue severity and bump SDK to v3.6.0 - #331

Merged
lelia merged 4 commits into
mainfrom
chore/slack-severity-normalization
Sep 9, 2026
Merged

Normalize Slack issue severity and bump SDK to v3.6.0#331
lelia merged 4 commits into
mainfrom
chore/slack-severity-normalization

Conversation

@lelia

@lelia lelia commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Every severity lookup in the Slack reachability formatter is keyed on medium, but middle is what the API sends — it is the value in the OpenAPI spec's SocketIssueSeverity and in the SDK enum. A mid-severity finding therefore missed all of them at once:

  • Not counted. severity_counts has no middle key and the increment is guarded by if ... in severity_counts, so the summary always read Medium: 0.
  • Excluded from total_findings. Since omitted_count = total_findings - len(selected_vulnerabilities), a batch of mid-severity findings can drive the "and N more" line negative.
  • Sorted below low. SEVERITY_ORDER.get(severity, 4) returned the default of 4 against low's 3, so mid-severity findings sank to the bottom and were the first truncated at the block limit.
  • Wrong emoji, which is the least of it.

The findings themselves were always listed — purl_groups drives 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 middle key to four dicts. Messages.map_socket_severity_to_gitlab and the GitLab severity map already accept both forms with a comment calling middle the older format; this formatter never got the same treatment. Worth noting the live spec still lists middle, so it is the current value rather than a legacy one.

Seven regression tests; five of them fail without the one-line change.


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 on medium.

In _extract_alert_info, middle is now mapped to medium at read time (same idea as Messages.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.py and updates the changelog and package version (2.6.122.6.13).

Reviewed by Cursor Bugbot for commit 794ce00. Configure here.

@lelia
lelia deployed to socket-firewall September 2, 2026 22:47 — with GitHub Actions Active
@lelia lelia changed the title Normalize Slack severity, and stage the socketdev 3.6.0 bump Normalize Slack issue severity, and stage the socketdev v3.6.0 bump Sep 2, 2026
@lelia lelia changed the title Normalize Slack issue severity, and stage the socketdev v3.6.0 bump Normalize Slack issue severity, and stage the SDK v3.6.0 bump Sep 2, 2026
@lelia
lelia marked this pull request as ready for review September 3, 2026 17:58
@lelia
lelia requested a review from a team as a code owner September 3, 2026 17:58

@flowstate Eric Hibbs (flowstate) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

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>
@lelia lelia changed the title Normalize Slack issue severity, and stage the SDK v3.6.0 bump Normalize Slack issue severity and bump SDK to v3.6.0 Sep 9, 2026
@lelia
lelia force-pushed the chore/slack-severity-normalization branch from 794ce00 to 781a054 Compare September 9, 2026 22:54
Unblocks the pin now that 3.6.0 is on PyPI. SocketPURL_Type gained ten
members -- alpm, chrome, clawhub, edge-extension, firefox-extension, qpkg,
socket, swid, vscode and vscode-extension -- and removed none, so artifacts
of those types stop falling back to "unknown".

No other CLI change is needed: none of the SDK's enum types are imported
here, and every severity and type lookup already has a default, so the new
members cannot reach an unguarded branch.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@lelia
lelia deployed to socket-firewall September 9, 2026 22:57 — with GitHub Actions Active
@socket-security

socket-security Bot commented Sep 9, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedpypi/​socketdev@​3.5.0 ⏵ 3.6.098 +1100100100100

View full report

@socket-security-staging

socket-security-staging Bot commented Sep 9, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedpypi/​socketdev@​3.5.0 ⏵ 3.6.098 +1100100100100

View full report

The check required the PR version to exceed both main and PyPI. Comparing
against main forbids the legitimate case where several PRs ship under one
unreleased version: the first bumps main, and the rest ride it without
bumping again so they stay under a single changelog header. Every such PR
failed, and the only way to green it was a throwaway bump that would strand
a changelog header on a version that never ships.

PyPI is now the floor, since the real invariant is that a release cannot
reuse a published version. Main is still a floor in the one direction that
matters: a PR may leave the version alone or move it forwards, never back.
Every genuine failure the old check caught -- forgetting to bump, reusing a
published version, branching from a stale base -- still fails.

Also added this workflow to its own paths filter so a change to the check is
exercised by the PR that makes it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@lelia
lelia deployed to socket-firewall September 9, 2026 23:02 — with GitHub Actions Active
The version lives as two hand-maintained literals with nothing deriving one
from the other: pyproject.toml is what gets published, and __init__.py is
what the CLI reports as its User-Agent. Every comparison in this job read
only __init__.py, so bumping that alone passed the check and then published
under the old number -- surfacing late, as twine rejecting an existing file,
after the merge.

Both are now required to match before any other comparison runs. uv.lock
carries a third copy, but uv derives it and `uv lock --locked` in
python-tests already fails when it drifts, so it needs no check here.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@lelia
lelia deployed to socket-firewall September 9, 2026 23:35 — with GitHub Actions Active
@lelia
lelia merged commit 860b8ea into main Sep 9, 2026
31 checks passed
lelia added a commit that referenced this pull request Sep 10, 2026
#331 added this workflow to its own paths filter so an edit to the check gets
exercised by the PR making it. That had the side effect of demanding a version
bump from CI-only PRs, and now that 2.8.0 is published it fails outright: a PR
touching only version-check.yml sits at the published version with nothing to
bump, and is told to bump it.

The bump is now enforced only when the PR touches socketsecurity/,
pyproject.toml or uv.lock. The comparison still runs and reports its verdict
either way, so the check stays exercised without dictating a release. Matches
the gating already on socket-sdk-python.

This branch predates #331, so the file is taken from main -- picking up the
PyPI-only floor and the pyproject/__init__ consistency assertion -- with this
branch's own tweak reapplied on top: the version literal is stripped of both
quote styles, since ruff format rewrites __init__.py to double quotes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

2 participants