Skip to content

Report and enforce existing alerts under --strict-blocking - #459

Merged
lelia merged 10 commits into
mainfrom
fix/strict-blocking-keep-each-existing-advisory
Nov 24, 2026
Merged

lelia merged 10 commits into
mainfrom
fix/strict-blocking-keep-each-existing-advisory

Conversation

@dc-larsen

@dc-larsen David Larsen (dc-larsen) commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

--strict-blocking counts distinct advisories on unchanged dependencies and checks findings that persist after a dependency version change. The Existing alerts table lists these findings at the current package version.

  • Socket Python SDK 3.6.4 keeps same-severity advisories separate and uses the strongest policy action when it merges duplicate sightings of one advisory. See Keep each advisory when merging duplicate alerts socket-sdk-python#134.
  • The cached comparison can omit existing findings. The CLI reads them from the current full scan and uses the comparison to identify new findings.
  • Advisory counts can increase in full-scan JSON, SARIF, and GitLab security reports and in the existing findings shown in GitLab security and FOSSA diff reports.

Verification

  • 1,010 CLI unit and core tests passed with Socket Python SDK 3.6.4. Ruff, package builds, and twine check passed.
  • Regression tests exercise the SDK parser and cover same-severity advisories, policy actions, version changes returned as added or updated, first scans, and missing scan data.
Test organization results for SDK advisory deduplication

These runs compared the original CLI and the SDK fix on PR branches with no dependency changes. Raw counts come from the current full-scan response. Repeating the runs with the fix produced the same results.

Project Build Exit Alerts loaded Existing blockers (CLI) Blockers (raw API) Existing rows in PR comment
npm: lodash 4.17.11 + handlebars 4.0.11 stock 1 49 3 8 3
patched x2 1 68 8 8 8 (6 handlebars rows, each with its own GHSA)
npm: minimist, node-forge, jsonwebtoken, axios, ejs, underscore (old versions) stock 1 61 4 4 4
patched x2 1 117 4 4 4
PyPI: Django 2.2, Jinja2 2.10, requests 2.19.0, PyYAML 5.3, urllib3 1.24.1, Pillow 6.2.0 stock 1 56 3 20 5
patched x2 1 189 20 20 22 (20 Block + 2 Warn)
Public MERN app, 1,545 packages stock 1 2,744 17 22 17
patched x2 1 2,879 22 22 22
npm: vm2 3.9.11, first-listed Critical CVE resolved (ignore) stock x2 0 19 0 34 none
patched x2 1 73 34 34 34

The summary and exit status use all findings. If the GitHub comment reaches its size limit, it links to the complete report.

Public Changelog

--strict-blocking counts distinct advisories on unchanged dependencies and checks Block findings that persist after a dependency version change.


Fixes: CE-511
Fixes: CE-514

Refs: ASK-631

Existing alerts for --strict-blocking are read from the new full scan
through socketdev's fullscans.stream(). socketdev 3.6.2 merged alerts that
share a type and severity on a package, so only the first CVE of each
severity reached the CLI. The Existing alerts table and the EXISTING
blocking issues count undercounted (3 instead of 8 in the repro), and when
the first CVE of a group was resolved or triaged to monitor or ignore, the
Block CVEs behind it were dropped and the run passed.

socketdev 3.6.3 keys merged alerts on the advisory ID and keeps the most
severe action. Pin it. The CLI's own consolidation already keeps the
advisory ID (Issue.consolidation_key) and filters on error/warn before it
dedupes, so no CLI logic changes.

The new tests run the real FullScans.stream() over a canned response, so
they fail if the pinned SDK collapses advisories again.

Bumps the version to 2.13.1. uv.lock needs `uv lock` once socketdev 3.6.3
is published.
@lelia lelia self-assigned this Nov 20, 2026
@lelia lelia changed the title List every existing advisory under --strict-blocking List every existing advisory under --strict-blocking Nov 20, 2026
Full-scan mode with --enable-json, --enable-sarif or --enable-gitlab-security
reads alerts through the same SDK stream, so those reports now list every
advisory on a package too. Diff mode's existing alerts in the GitLab and
FOSSA-format output change the same way.
socketdev 3.6.3 was released without the advisory dedupe fix, which now
ships as 3.6.4. uv.lock still needs `uv lock` once 3.6.4 is published.
…eep-each-existing-advisory

# Conflicts:
#	CHANGELOG.md
#	pyproject.toml
…eep-each-existing-advisory

# Conflicts:
#	CHANGELOG.md
2.13.2 was released from main, so this change needs the next patch version.
Load current alerts for added and updated packages in strict diff
mode. Report findings omitted by the comparison as existing so a Block
advisory that survives a version change still fails the run.
@lelia lelia changed the title List every existing advisory under --strict-blocking Report and enforce existing alerts under --strict-blocking Nov 24, 2026
@lelia
lelia marked this pull request as ready for review November 24, 2026 02:09
@lelia
lelia requested a review from a team as a code owner November 24, 2026 02:09
@cursor

cursor Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes CI pass/fail behavior and report cardinality under --strict-blocking and full-scan outputs; pipelines that previously under-counted advisories may start failing or show more findings.

Overview
Release 2.13.3 pins socketdev 3.6.4, which keeps same-severity advisories separate and prefers Block over Warn when merging duplicate sightings. Advisory counts in full-scan JSON, SARIF, GitLab, and FOSSA-style diff output can rise as a result.

--strict-blocking now evaluates distinct advisories on unchanged dependencies and treats blocking findings that survive a dependency version change as existing violations (listed in Existing alerts at the new version). The CLI loads those alerts from the current full scan when the comparison omits them, including for added/updated packages tied to baseline or replaced entries, while still skipping the extra fetch for net-new dependencies.

Alert consolidation moves into _consolidate_reportable_alerts, which reclassifies persisted findings without double-counting new vs existing. Diff-scope SARIF embeds advisory IDs in rule IDs and descriptions so multiple CVEs/GHSAs on the same package and manifest stay distinct.

Docs and tests cover policy-action precedence, GitLab vs JSON/SARIF population, and regression cases for version bumps, transitive introductions, and missing full-scan packages.

Reviewed by Cursor Bugbot for commit 0bf1e33. Configure here.

@socket-security

socket-security Bot commented Nov 24, 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.6.3 ⏵ 3.6.498 +1100100100100

View full report

@socket-security-staging

socket-security-staging Bot commented Nov 24, 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.6.3 ⏵ 3.6.498 +1100100100100

View full report

@lelia
lelia temporarily deployed to socket-firewall November 24, 2026 02:09 — with GitHub Actions Inactive
@lelia

lelia commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread socketsecurity/core/__init__.py Resolved
Comment thread CHANGELOG.md Resolved
@lelia
lelia temporarily deployed to socket-firewall November 24, 2026 02:20 — with GitHub Actions Inactive
@lelia

lelia commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 0bf1e33. Configure here.

@lelia
lelia merged commit 4e28391 into main Nov 24, 2026
34 checks passed

This branch was previously deployed

1 inactive deployment
socket-firewall — 0bf1e330 Deployed Nov 24, 2026 by lelia via python-sfw-smoke-enterprise #674
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