SARIF file output and reachability filtering#165
Merged
Conversation
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>
|
🚀 Preview package published! Install with: pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple socketsecurity==2.2.76.dev6Docker image: |
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>
Signed-off-by: lelia <lelia@socket.dev>
Signed-off-by: lelia <lelia@socket.dev>
…-reach flag Signed-off-by: lelia <lelia@socket.dev>
Signed-off-by: lelia <lelia@socket.dev>
Signed-off-by: lelia <lelia@socket.dev>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Signed-off-by: lelia <lelia@socket.dev>
…lus other test fixes Signed-off-by: lelia <lelia@socket.dev>
dacoburn
approved these changes
Mar 4, 2026
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.
Summary
Adds two new SARIF output flags and improves Slack bot mode debug logging:
--sarif-file <path>— saves SARIF output to a file for upload to GitHub Code Scanning, SonarQube, VS Code, etc.--sarif-reachable-only— filters SARIF output to reachable (blocking) findings only (requires--reach)--enable-debuglogging in Slack bot mode to surface silent failures when reachability alerts aren't being sentChanges
--sarif-file: added config field + CLI flag; implies--enable-sarifso users don't need to pass both--sarif-reachable-only: added config field + CLI flag; exits with a clear error if passed without--reachoutput.py:output_console_sarifnow writes to the specified filepath in addition tostdout, and pre-filters alerts when--sarif-reachable-onlyis set--sarif-reachable-onlyconfig validation; addedUnit TestsCI workflow; extended e2e tests to validate--sarif-fileoutput and assert reachable-only is a subset of unfiltered resultsreturnpaths in_send_bot_reachability_alertsto error-level loggingTesting
socketcli --sarif-file results.sarifagainst a representative reporesults.sariffile was output with valid syntaxPreview
Representative preview of what
results.sarifoutput looks like:{ "$schema": "https://json.schemastore.org/sarif-2.1.0.json", "version": "2.1.0", "runs": [ { "tool": { "driver": { "name": "Socket Security", "informationUri": "https://socket.dev", "rules": [ { "id": "lodash==4.17.20 (package.json)", "name": "Alert lodash==4.17.20 (package.json)", "shortDescription": { "text": "Alert lodash==4.17.20 (package.json)" }, "fullDescription": { "text": "Prototype Pollution - test" }, "helpUri": "https://socket.dev/npm/package/lodash/alerts/4.17.20", "defaultConfiguration": { "level": "error" } } ] } }, "results": [ { "ruleId": "lodash==4.17.20 (package.json)", "message": { "text": "<br/><br/>Suggested Action:<br/><br/><a href=\"https://socket.dev/npm/package/lodash/alerts/4.17.20\">https://socket.dev/npm/package/lodash/alerts/4.17.20</a>" }, "locations": [ { "physicalLocation": { "artifactLocation": { "uri": "package.json" }, "region": { "startLine": 1, "snippet": { "text": "package.json not found" } } } } ] } ] } ] }