Skip to content

Fix reachability filtering, add config file support#169

Merged
lelia merged 18 commits intomainfrom
lelia/fix-reachability-filtering
Mar 12, 2026
Merged

Fix reachability filtering, add config file support#169
lelia merged 18 commits intomainfrom
lelia/fix-reachability-filtering

Conversation

@lelia
Copy link
Contributor

@lelia lelia commented Mar 10, 2026

Summary

This PR aligns reachability alert selection behavior across diff-based output channels and improves config/documentation ergonomics.

Previously, selection behavior diverged by channel (Console/JSON/SARIF/Slack), especially around --strict-blocking and reachability-only filtering. This PR introduces a shared selection path and updates tests/docs accordingly.

Major Changes

  • Shared alert selection module

    • Added socketsecurity/core/alert_selection.py.
    • Centralizes:
      • diff alert selection (new vs new + unchanged with strict mode),
      • reachability filtering against .socket.facts.json,
      • fallback behavior when facts are unavailable.
  • Output consistency updates

    • OutputHandler now uses shared selection for:
      • Console table output,
      • JSON output,
      • diff-scope SARIF generation.
    • In strict diff mode, selected diff alerts include unchanged findings for output paths that render diff alerts.
  • Slack consistency updates

    • Slack diff notifications now use the same diff selection rules.
    • reachability_alerts_only now uses reachability facts when available (with fallback preserved), rather than relying solely on blocking status heuristics.
  • Config/docs improvements

    • Added ability to load a config file rather than pass all params as CLI flags.
    • Generated JSON and TOML sample configs for reference (in examples/config).
    • Updated README/docs with:
      • “Choose your mode” guidance,
      • explicit dashboard-vs-CLI count caveats,
      • updated strict/reachability behavior notes.

Testing

Added/updated unit coverage for:

  • shared selection behavior matrix,
  • strict mode inclusion of unchanged alerts in diff outputs,
  • Slack reachability-only filtering behavior,
  • SARIF reachability filtering behavior and regressions.

Also performed manual verifications by running the CLI against a representative repository and comparing various scoped/grouped results in SARIF and console outputs.

⚠️ Note: Exact dashboard count parity may still vary due to API/UI consolidation/grouping differences; docs now call this out explicitly.

lelia added 5 commits March 10, 2026 19:05
Signed-off-by: lelia <lelia@socket.dev>
Signed-off-by: lelia <lelia@socket.dev>
Signed-off-by: lelia <lelia@socket.dev>
…I/CD guides

Signed-off-by: lelia <lelia@socket.dev>
Signed-off-by: lelia <lelia@socket.dev>
@lelia lelia requested a review from a team as a code owner March 10, 2026 23:19
@github-actions
Copy link

github-actions bot commented Mar 10, 2026

🚀 Preview package published!

Install with:

pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple socketsecurity==2.2.78.dev3

Docker image: socketdev/cli:pr-169

@lelia lelia marked this pull request as draft March 11, 2026 00:08
@lelia lelia changed the title Fix SARIF reachability mismatch, add config support [DRAFT] Fix reachability filtering for Slack + SARIF output, add config file support Mar 11, 2026
@lelia lelia changed the title [DRAFT] Fix reachability filtering for Slack + SARIF output, add config file support [DRAFT] Fix reachability filtering, add config file support Mar 11, 2026
lelia added 10 commits March 11, 2026 17:39
Signed-off-by: lelia <lelia@socket.dev>
Signed-off-by: lelia <lelia@socket.dev>
…s-aware reachable filtering

Signed-off-by: lelia <lelia@socket.dev>
Signed-off-by: lelia <lelia@socket.dev>
Signed-off-by: lelia <lelia@socket.dev>
Signed-off-by: lelia <lelia@socket.dev>
Signed-off-by: lelia <lelia@socket.dev>
Signed-off-by: lelia <lelia@socket.dev>
…D usage

Signed-off-by: lelia <lelia@socket.dev>
Signed-off-by: lelia <lelia@socket.dev>
@lelia lelia changed the title [DRAFT] Fix reachability filtering, add config file support Fix reachability filtering, add config file support Mar 11, 2026
@lelia lelia marked this pull request as ready for review March 11, 2026 22:32
lelia added 3 commits March 11, 2026 18:36
Signed-off-by: lelia <lelia@socket.dev>
Signed-off-by: lelia <lelia@socket.dev>
… assertions

Signed-off-by: lelia <lelia@socket.dev>
@lelia lelia merged commit 637eda7 into main Mar 12, 2026
10 checks passed
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