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
{{ message }}
Repository navigation
Commit 5a6a3f8
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+22-7Lines changed: 22 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -240,14 +240,12 @@ error, so the supervisor's exit status (commonly 124 or 137) takes precedence.
240
240
The two flags that affect exit codes can cancel each other out, so the order of
241
241
precedence matters:
242
242
243
-
- **`--disable-blocking` wins for every run that gets past flag parsing.** It
244
-
forces exit `0` for security findings, infrastructure errors and interrupts.
245
-
If you set it, `--exit-code-on-api-error` has no effect (you'll always get `0`).
246
-
It does not apply to usage errors (`2`): a run with invalid flags never scanned
247
-
anything, so it always fails.
243
+
- **`--disable-blocking` forces exit `0` for findings, infrastructure errors and
244
+
interrupts.** It takes precedence over `--exit-code-on-api-error` and
245
+
`--strict-blocking`. Usage errors still exit `2`.
248
246
- **`--exit-code-on-api-error` only applies when `--disable-blocking` is *not*
249
-
set.** It changes the infra-error code (and the generic-error code); it never
250
-
touches the security-finding code (`1`).
247
+
set.** It changes the infrastructure-error code, including unexpected runtime
248
+
failures. Findings (`1`), usage errors (`2`) and Ctrl+C (`130`) keep their codes.
251
249
252
250
So for the common "don't let Socket outages block my pipeline, but still fail on
253
251
real findings" goal, use `--exit-code-on-api-error` **without** `--disable-blocking`:
@@ -266,6 +264,23 @@ scan exit `0` on *both* findings and outages — the `soft_fail: 100` rule would
266
264
never match, and real findings would stop blocking. That's usually not what you
267
265
want.
268
266
267
+
### Upgrading to 2.13.0
268
+
269
+
Update pipeline rules and wrapper scripts that match specific exit codes:
270
+
271
+
| Outcome | Before 2.13.0 | From 2.13.0 |
272
+
|---------|---------------|-------------|
273
+
| Invalid flags or configuration | CLI validation: `1`; argparse: `2` | `2` for both; never suppressed by `--disable-blocking` |
274
+
| Ctrl+C | `2` | `130`, or `0` with `--disable-blocking` |
275
+
| Missing token or other setup failure | Fixed `2` or `3`, depending on the failure | Infrastructure-error code (`3` by default); both exit-code flags now apply |
276
+
277
+
Blocking findings still exit `1`. With `--strict-blocking`, existing blocking
278
+
alerts can now fail jobs that previously passed. GitLab report findings also get
279
+
new IDs once; see the [release notes](CHANGELOG.md#2130).
280
+
281
+
For a compact comparison of failure-handling policies, see
282
+
[Exit codes in CI](docs/ci-cd.md#exit-codes-in-ci).
283
+
269
284
## Common gotchas
270
285
271
286
See [`docs/troubleshooting.md`](https://github.com/SocketDev/socket-python-cli/blob/main/docs/troubleshooting.md#common-gotchas).
Combining the flags gives `--disable-blocking` precedence. Avoid blanket shell
82
+
`|| true` or job-wide `continue-on-error` when only API failures should be allowed:
83
+
they also hide findings and usage errors. Even with exit `0`, a setup/API failure
84
+
does not mean a clean scan; check the logs for a completed report.
85
+
86
+
Findings block only when a [diff comparison runs](#scan-type-by-pipeline).
87
+
`--strict-blocking`also checks existing blocking alerts; an incomplete comparison
88
+
or incomplete existing-alert data is an infrastructure failure. See the
89
+
[2.13.0 migration table](../README.md#upgrading-to-2130) when updating existing CI rules.
90
+
55
91
## Config file usage in CI
56
92
57
93
Use `--config .socketcli.toml` or `--config .socketcli.json` to keep pipeline commands small.
@@ -465,7 +501,7 @@ With `--scm github` or `--scm gitlab`, the detected event decides the scan type:
465
501
466
502
| Event | Scan | Blocks the build |
467
503
|:------|:-----|:-----------------|
468
-
| Pull request / merge request | Diff scan against the repository's baseline | Yes, on newly introduced alerts |
504
+
| Pull request / merge request | Diff scan against the repository's baseline | Yes, on new blocking alerts; also existing blockers with `--strict-blocking` |
469
505
| Any other pipeline, including default-branch pushes | Full scan | No |
470
506
471
507
A full scan has no baseline, so it cannot tell a newly introduced alert from one
Copy file name to clipboardExpand all lines: docs/cli-reference.md
+18-4Lines changed: 18 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -430,13 +430,16 @@ Sample config files:
430
430
### CI/CD usage tips
431
431
432
432
For CI-specific examples and guidance, see [`ci-cd.md`](ci-cd.md).
433
+
Exit statuses and flag precedence are listed in [Exit codes](../README.md#exit-codes),
434
+
with pipeline examples in [Exit codes in CI](ci-cd.md#exit-codes-in-ci).
433
435
434
436
The CLI runs a pinned version of the Coana CLI, the analysis engine; it does **not** auto-update the engine. It downloads the engine from the Socket API on first use and keeps it in `$XDG_CACHE_HOME/socket/coana/v1` (`~/.cache/socket/coana/v1` when `XDG_CACHE_HOME` is unset). Pass `--reach-version latest` to opt into the newest published version. Use `--reach` to enable reachability analysis during a full scan, or add `--only-facts-file` (with `--reach`) to submit only the reachability facts file (`.socket.facts.json`) when creating the full scan.
| `--ignore-commit-files` | False | False | Compare regardless of which files changed, scanning every manifest |
442
+
| `--exit-code-on-api-error` | False | 3 | Remap infrastructure failures, including missing tokens, setup failures, incomplete scan data and unexpected runtime errors. Findings (`1`), usage errors (`2`) and Ctrl+C (`130`) are unaffected. `--disable-blocking` takes precedence. |
440
443
| `--disable-blocking` | False | False | Non-blocking CI mode: the CLI exits **0** even when blocking alerts are present (including with `--strict-blocking`). Also exits 0 on infrastructure errors (missing API or SCM token, Socket API failures, uncaught runtime errors) and interrupts, so the job is treated as successful while findings and errors are still logged. Invalid flags still exit **2**. Takes precedence over `--strict-blocking`. |
441
444
| `--disable-ignore` | False | False | Disable support for `@SocketSecurity ignore` commands in PR comments. When set, alerts cannot be suppressed via comments and ignore instructions are hidden from comment output. See [Who can ignore an alert](#who-can-ignore-an-alert). |
442
445
| `--ignore-authorization` | False | enforce | Who may suppress alerts with `@SocketSecurity ignore`. `enforce` requires write access and honors the command with a warning when the provider cannot report it; `strict` rejects it in that case; `off` honors any commenter. See [Who can ignore an alert](#who-can-ignore-an-alert). |
@@ -641,10 +644,10 @@ Security issues detected by Socket Security:
641
644
642
645
### Important Notes
643
646
644
-
- **Diff Mode Only**: The flag only works in diff mode (with SCM integration). In API mode, a warning is logged.
647
+
- **Diff Mode Only**: The flag applies when a scan comparison runs, with or without SCM integration. A full scan logs a warning and does not evaluate existing violations; see [Scan type by pipeline](ci-cd.md#scan-type-by-pipeline).
645
648
- **Error-Level Only**: Only fails on `error=True` alerts (blocking severity), not warnings.
646
649
- **Existing alerts come from the full scan**: The scan comparison doesn't carry alerts on unchanged packages, so the CLI reads them from the new full scan, at the cost of one more API request per run. If that request fails or omits an unchanged package, the run fails with the infrastructure-error code rather than passing without them.
647
-
- **PR/MR comments**: Existing alerts are listed in their own table after the new ones, blocking first. `@SocketSecurity ignore` applies to them too. Very large sets are cut off before the comment reaches GitHub's size limit, with a link to the full report.
650
+
- **PR/MR comments**: Existing alerts are listed in their own table after the new ones, blocking first, with license violations grouped per package. `@SocketSecurity ignore` applies to them too. Very large sets are cut off before the comment reaches GitHub's size limit, with a link to the full report. Ignoring every displayed alert preserves the warning about omitted findings; `ignore-all` also clears omitted findings.
648
651
- **Priority**: `--disable-blocking` takes precedence - if both flags are set, the build will always pass.
649
652
- **First Scan**: On the very first scan of a repository, there are no "existing" violations, so behavior is identical to standard mode.
650
653
@@ -883,9 +886,16 @@ The GitLab Security Dashboard report and the JSON/SARIF diff outputs use differe
883
886
884
887
### Alert Ignoring via PR/MR Comments
885
888
886
-
When using the CLI with SCM integration (`--scm github` or `--scm gitlab`), users can ignore specific alerts by reacting to Socket's PR/MR comments. Ignored alerts are removed from `--enable-json`, `--enable-sarif`, and console output.
889
+
In SCM diff mode (`--scm github` or `--scm gitlab`), an authorized
890
+
`@SocketSecurity ignore <ecosystem>/<package>@<version>` or
891
+
`@SocketSecurity ignore-all` comment removes matching new alerts from the CLI's
892
+
reports, including the GitLab report. With `--strict-blocking`, it also removes
893
+
matching existing alerts from blocking checks and reports. Without strict blocking,
894
+
the GitLab report still includes existing findings.
887
895
888
-
However, the GitLab Security Dashboard report includes **all** alerts matching your security policy (new and existing), regardless of comment-based ignores. This ensures the Security Dashboard always reflects the full set of known issues. To suppress a vulnerability from the GitLab report, adjust the alert's policy in Socket's dashboard rather than ignoring it via a PR comment.
896
+
`--disable-ignore` disables these commands. See [Who can ignore an alert](#who-can-ignore-an-alert)
897
+
for authorization rules. To suppress a finding across future PRs, update its policy
898
+
or triage state in Socket's dashboard.
889
899
890
900
### Report Schema
891
901
@@ -902,6 +912,10 @@ Socket CLI generates reports compliant with [GitLab Dependency Scanning schema v
902
912
903
913
**Schema compatibility:** The v15.0.0 schema is supported across all GitLab versions 12.0+ (both self-hosted and cloud). The report includes the `dependency_files` field, which is required by v15.0.0 and accepted as an optional extra by newer schema versions, ensuring maximum compatibility across GitLab instances.
904
914
915
+
Finding IDs distinguish the ecosystem, full package coordinate and advisory, so
916
+
different namespaces or CVEs remain separate findings. Upgrading to 2.13.0 changes
917
+
existing finding IDs once; GitLab may show them as newly detected on the first report.
918
+
905
919
### Performance Notes
906
920
907
921
When `--enable-gitlab-security` (or `--enable-json` / `--enable-sarif`) is used with a full scan (non-diff mode), the CLI fetches package and alert data from the scan results to populate the report. This adds time proportional to the number of packages in the scan. Without these output flags, no additional data is fetched and scan performance is unchanged.
Copy file name to clipboardExpand all lines: docs/troubleshooting.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,17 @@
1
1
# Troubleshooting
2
2
3
+
## Unexpected CI exit status
4
+
5
+
| Symptom | What to check |
6
+
|---------|---------------|
7
+
| Exit `2`, even with `--disable-blocking`| Fix the flags or configuration reported in the logs. Usage errors are never suppressed. |
8
+
| Exit `3` with no reported findings | Check tokens, scopes, baseline lookup and scan-completeness errors. This is a failed evaluation; `--exit-code-on-api-error` can remap its code. |
9
+
| Ctrl+C is treated as a configuration error | Update wrapper/CI rules: Ctrl+C changed from `2` to `130` in 2.13.0. |
10
+
| Exit `0` despite expected blockers | Check `--disable-blocking`, remapping to `0`, and whether the run produced a full scan instead of a diff. Full scans do not gate on findings. |
11
+
12
+
See [Exit codes in CI](ci-cd.md#exit-codes-in-ci) for the flag combinations and
13
+
[upgrade guidance](../README.md#upgrading-to-2130) for older pipeline rules.
14
+
3
15
## API token scopes for scan comparisons
4
16
5
17
PR/MR runs compare the new scan against the repository's head scan. That comparison
0 commit comments