You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SARIF file output and reachability filtering (#165)
* Add support for SARIF file output
Signed-off-by: lelia <lelia@socket.dev>
* Ignore SARIF results
Signed-off-by: lelia <lelia@socket.dev>
* Add test for new SARIF output functionality
Signed-off-by: lelia <lelia@socket.dev>
* Document new CLI output flag and clarify intended usage
Signed-off-by: lelia <lelia@socket.dev>
* Bump version to prep for release
Signed-off-by: lelia <lelia@socket.dev>
* Bump version to account for new release
Signed-off-by: lelia <lelia@socket.dev>
* Add workflow for running unittests
Signed-off-by: lelia <lelia@socket.dev>
* Tweak workflow name
Signed-off-by: lelia <lelia@socket.dev>
* Install dev dependencies for testing
Signed-off-by: lelia <lelia@socket.dev>
* Update lockfile
Signed-off-by: lelia <lelia@socket.dev>
* Add configurable option for reachabilty filtering with SARIF
Signed-off-by: lelia <lelia@socket.dev>
* Implement reachabilty logic for SARIF output
Signed-off-by: lelia <lelia@socket.dev>
* Add unittests to cover new reachability filtering functionality
Signed-off-by: lelia <lelia@socket.dev>
* Update README to document new filtering options and required use of --reach flag
Signed-off-by: lelia <lelia@socket.dev>
* Update e2e tests to include SARIF workflow
Signed-off-by: lelia <lelia@socket.dev>
* Impove Slack bot mode debug logging to surface failures
Signed-off-by: lelia <lelia@socket.dev>
* Skip gitlab tests that pass incorrect mock client to constructor
Signed-off-by: lelia <lelia@socket.dev>
* Update old constructor to use current Mock(spec=CliConfig) pattern, plus other test fixes
Signed-off-by: lelia <lelia@socket.dev>
---------
Signed-off-by: lelia <lelia@socket.dev>
Copy file name to clipboardExpand all lines: README.md
+18-7Lines changed: 18 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,18 +94,27 @@ This will:
94
94
- Save to `gl-dependency-scanning-report.json`
95
95
- Include all actionable security alerts (error/warn level)
96
96
97
+
**Save SARIF report to file (e.g. for GitHub Code Scanning, SonarQube, or VS Code):**
98
+
```bash
99
+
socketcli --sarif-file results.sarif \
100
+
--repo owner/repo \
101
+
--target-path .
102
+
```
103
+
97
104
**Multiple output formats:**
98
105
```bash
99
106
socketcli --enable-json \
100
-
--enable-sarif \
107
+
--sarif-file results.sarif \
101
108
--enable-gitlab-security \
102
109
--repo owner/repo
103
110
```
104
111
105
112
This will simultaneously generate:
106
113
- JSON output to console
107
-
- SARIF format to console
108
-
- GitLab Security Dashboard report to file
114
+
- SARIF report to `results.sarif` (and stdout)
115
+
- GitLab Security Dashboard report to `gl-dependency-scanning-report.json`
116
+
117
+
> **Note:**`--enable-sarif` prints SARIF to stdout only. Use `--sarif-file <path>` to save to a file (this also implies `--enable-sarif`). Add `--sarif-reachable-only` (requires `--reach`) to filter results down to only reachable findings — useful for uploading to GitHub Code Scanning without noisy alerts on unreachable vulns. These flags are independent from `--enable-gitlab-security`, which produces a separate GitLab-specific Dependency Scanning report.
| --enable-json | False | False | Output in JSON format |
192
-
| --enable-sarif | False | False | Enable SARIF output of results instead of table or JSON format |
201
+
| --enable-sarif | False | False | Enable SARIF output of results instead of table or JSON format (prints to stdout) |
202
+
| --sarif-file | False | | Output file path for SARIF report (implies --enable-sarif). Use this to save SARIF output to a file for upload to GitHub Code Scanning, SonarQube, VS Code, or other SARIF-compatible tools |
203
+
| --sarif-reachable-only | False | False | Filter SARIF output to only include reachable findings (requires --reach) |
0 commit comments