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 b41017d
Browse filesBrowse the repository at this point in the historyBrowse files
| `3` | Infrastructure or API error (timeout, network failure, unexpected error) |
220
+
| Code | Meaning |
221
+
|-------|---------|
222
+
| `0` | Successful report, skipped SCM event, or `--disable-blocking` set; findings gate only evaluated diffs |
223
+
| `1` | Blocking security finding(s) detected |
224
+
| `2` | Invalid flags or configuration (usage error), including argparse's own errors |
225
+
| `3` | Infrastructure or API error: missing API or SCM token, permission or plan problem, timeout, network failure, incomplete scan comparison, unexpected error |
226
+
| `130` | Scan interrupted (SIGINT / Ctrl+C) |
226
227
227
228
`--exit-code-on-api-error <N>`remaps the infrastructure-error code (`3`) to any
228
229
value — e.g. a Buildkite
@@ -239,12 +240,12 @@ error, so the supervisor's exit status (commonly 124 or 137) takes precedence.
239
240
The two flags that affect exit codes can cancel each other out, so the order of
240
241
precedence matters:
241
242
242
-
- **`--disable-blocking` wins over everything.** It forces exit `0` for *all*
243
-
outcomes — security findings *and* infrastructure errors. If you set it,
244
-
`--exit-code-on-api-error`has no effect (you'll always get `0`).
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`.
245
246
- **`--exit-code-on-api-error` only applies when `--disable-blocking` is *not*
246
-
set.** It changes the infra-error code (and the generic-error code); it never
247
-
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.
248
249
249
250
So for the common "don't let Socket outages block my pipeline, but still fail on
250
251
real findings" goal, use `--exit-code-on-api-error` **without** `--disable-blocking`:
@@ -263,6 +264,28 @@ scan exit `0` on *both* findings and outages — the `soft_fail: 100` rule would
263
264
never match, and real findings would stop blocking. That's usually not what you
264
265
want.
265
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
+
Configuration is validated before credentials or network setup. Use native
282
+
JSON/TOML booleans such as `false`, a positive integer `timeout`, and an array of
283
+
file paths for `files`. Invalid or unreadable configuration exits `2` even when
284
+
credentials are missing or blocking is disabled.
285
+
286
+
For a compact comparison of failure-handling policies, see
287
+
[Exit codes in CI](docs/ci-cd.md#exit-codes-in-ci).
288
+
266
289
## Common gotchas
267
290
268
291
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
+
SCM event filters can also skip unsupported events with exit `0`; confirm a report
88
+
was created when validating a new workflow.
89
+
`--strict-blocking`also checks existing blocking alerts; an incomplete comparison
90
+
or incomplete existing-alert data is an infrastructure failure. See the
91
+
[2.13.0 migration table](../README.md#upgrading-to-2130) when updating existing CI rules.
92
+
55
93
## Config file usage in CI
56
94
57
95
Use `--config .socketcli.toml` or `--config .socketcli.json` to keep pipeline commands small.
@@ -465,7 +503,7 @@ With `--scm github` or `--scm gitlab`, the detected event decides the scan type:
465
503
466
504
| Event | Scan | Blocks the build |
467
505
|:------|:-----|:-----------------|
468
-
| Pull request / merge request | Diff scan against the repository's baseline | Yes, on newly introduced alerts |
506
+
| Pull request / merge request | Diff scan against the repository's baseline | Yes, on new blocking alerts; also existing blockers with `--strict-blocking` |
469
507
| Any other pipeline, including default-branch pushes | Full scan | No |
470
508
471
509
A full scan has no baseline, so it cannot tell a newly introduced alert from one
0 commit comments