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 96173cd
Browse filesBrowse the repository at this point in the historyBrowse files
Exercise the comparison and SDK parser from the CLI. Verify that incomplete
comparisons and missing existing-alert data use the configured exit policy.
Document scan scope, baseline selection, and the upgrade impact.
Copy file name to clipboardExpand all lines: docs/ci-cd.md
+15-16Lines changed: 15 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -499,25 +499,24 @@ pipelines:
499
499
500
500
## Scan type by pipeline
501
501
502
-
With `--scm github` or `--scm gitlab`, the detected event decides the scan type:
502
+
With `--scm github` or `--scm gitlab`, the detected event controls which
503
+
pipelines can run a comparison. The table assumes changed-file detection:
503
504
504
505
| Event | Scan | Blocks the build |
505
506
|:------|:-----|:-----------------|
506
-
| Pull request / merge request | Diff scan against the repository's baseline | Yes, on new blocking alerts; also existing blockers with `--strict-blocking` |
507
-
| Any other pipeline, including default-branch pushes | Full scan | No |
508
-
509
-
A full scan has no baseline, so it cannot tell a newly introduced alert from one
510
-
that was already there. Rather than block on a number that would mean something
511
-
different depending on which output format was enabled, those runs behave as if
512
-
`--disable-blocking`was supplied and report through the Dashboard instead. This
513
-
matches how the CLI treats a change with no supported manifest files, except under
514
-
`--strict-blocking`: there a pull request or merge request that touches no manifest
515
-
still gets the comparison, so existing blocking alerts fail it.
516
-
517
-
The event type is authoritative once `--scm` is set: `--enable-diff`and
518
-
`--ignore-commit-files`do not turn a branch pipeline into a comparison. To diff
519
-
a branch build, drop `--scm` and use `--enable-diff` with `--integration`, which
520
-
runs the comparison without the PR comment adapter.
507
+
| Pull request / merge request with a supported manifest change | Comparison | New Block findings, plus existing Block findings with `--strict-blocking` |
508
+
| Pull request / merge request with no supported manifest change | Full scan by default. Comparison with `--strict-blocking` or `--ignore-commit-files` | In a comparison, new Block findings, plus existing Block findings with `--strict-blocking` |
509
+
| Branch pipeline, including a default-branch push | Full scan | No |
510
+
511
+
Full scans report through the Dashboard. The SCM adapter keeps branch pipelines
512
+
in full-scan mode even with `--enable-diff`, `--ignore-commit-files`, or
513
+
`--strict-blocking`.
514
+
515
+
Without a GitHub or GitLab SCM adapter, `--strict-blocking` runs a comparison
516
+
even when no supported manifest changed. This includes default-branch pushes and
517
+
scans of non-git paths. A Block finding exits `1`. A comparison infrastructure
518
+
error exits `3` by default. Check the [API token scopes for comparison runs](troubleshooting.md#api-token-permissions)
519
+
when upgrading a pipeline that previously ran only full scans.
521
520
522
521
`--generate-license`and `--legal-format fossa` work on both paths; a full scan
| `--ignore-commit-files` | False | False | Compare regardless of which files changed, scanning every manifest |
464
+
| `--ignore-commit-files` | False | False | Skip the changed-file check for comparisons eligible under the SCM event rules. |
465
465
| `--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. |
466
466
| `--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`. |
467
467
| `--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). |
468
468
| `--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). |
469
-
| `--strict-blocking` | False | False | Fail on ANY security policy violations (blocking severity), not just new ones. Runs a comparison even when no manifest changed. See [Strict Blocking Mode](#strict-blocking-mode) for details. |
469
+
| `--strict-blocking` | False | False | Fail on new and existing Block findings, including on changes that touch no manifest. See [Strict Blocking Mode](#strict-blocking-mode). |
470
470
| `--enable-diff` | False | False | Enable diff mode even when using `--integration api` (forces diff mode without SCM integration) |
471
471
| `--scm` | False | api | Source control management type |
472
472
| `--timeout` | False | 1200 | Positive integer timeout in seconds for each API request. This is not a total CLI runtime limit and does not limit local discovery, Git, or reachability analysis. |
The `--strict-blocking` flag enforces a zero-tolerance security policy by failing builds when **ANY** security violations with blocking severity exist, not just new ones introduced in the current changes.
607
+
In a scan comparison, `--strict-blocking` fails the build on new and existing findings with a **Block** action.
608
608
609
609
### Standard vs Strict Blocking Behavior
610
610
611
-
**Standard Behavior (Default)**:
612
-
- ✅ Passes if no NEW violations are introduced
613
-
- ❌ Fails only on NEW violations from your changes
- ✅ Passes only if NO violations exist (new or existing)
618
-
- ❌ Fails on ANY violation (new OR existing)
619
-
- 🔴 Enforces zero-tolerance policy
611
+
- **Default** fails on findings introduced by the change that have a **Block** action.
612
+
- **Strict blocking** also checks unchanged dependencies and findings that persist after a version change. For example, if an upgrade leaves a blocking advisory unresolved, the run still fails and the advisory appears under **Existing alerts** at the new version.
620
613
621
614
### Usage Examples
622
615
@@ -667,11 +660,10 @@ Security issues detected by Socket Security:
667
660
668
661
### Important Notes
669
662
670
-
- **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).
671
-
- **No manifest changed**: When the changed files include no supported manifest, the CLI still runs the comparison over every manifest in the target path, as with `--ignore-commit-files`, instead of falling back to a full scan. Code-only pull requests fail on existing blocking alerts and list them in the PR/MR comment. Without `--scm`, this also applies to default-branch pushes and to target paths that aren't git repositories, so those runs fail on existing blocking alerts where they used to pass. This adds the comparison and existing-alert requests to those runs.
672
-
- **With `--reach`**: The comparison uses the last default-branch scan made with `--reach` as its baseline. If the default branch is scanned without `--reach`, the baseline is empty and every alert is reported as new. The exit code is the same under `--strict-blocking`, but the PR/MR comment says the change introduced them. Scan the default branch with `--reach` too.
673
-
- **Error-Level Only**: Only fails on `error=True` alerts (blocking severity), not warnings.
674
-
- **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.
663
+
- **Scan scope**. Strict mode compares the configured scan scope even when no supported manifest changed. Scan options such as `--sub-path` and `--reach-use-only-pregenerated-sboms` still control what the CLI submits. GitHub and GitLab branch pipelines using `--scm` perform non-blocking full scans. See [Scan type by pipeline](ci-cd.md#scan-type-by-pipeline).
664
+
- **With `--reach`**. With no explicit baseline, the CLI looks for a default-branch head scan with reachability enabled. If none exists, the CLI compares against an empty baseline and classifies all findings as new. Scan the default branch with `--reach` too.
665
+
- **Policy actions**. Warn findings are reported. If the same finding has both Warn and Block actions, Block takes precedence.
666
+
- **Existing alerts come from the full scan**. The CLI fetches the current full scan when the comparison leaves out alerts on unchanged packages or when a dependency version changes. A failed fetch or a missing package in that response triggers the infrastructure-error exit code.
675
667
- **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.
676
668
- **Priority**: `--disable-blocking` takes precedence - if both flags are set, the build will always pass.
677
669
- **First Scan**: On the very first scan of a repository, there are no "existing" violations, so behavior is identical to standard mode.
@@ -771,23 +763,24 @@ The CLI determines which files to scan based on the following logic:
771
763
772
764
2. **`--files` Parameter Override**: When specified, this parameter takes precedence over git commit detection. It accepts a JSON array of file paths to check for manifest files.
773
765
774
-
3. **`--ignore-commit-files` Flag**: When set, the changed-file check is skipped entirely. The CLI runs the comparison regardless of what changed, and scans every manifest file in the target directory.
766
+
3. **`--ignore-commit-files` Flag**: Skip the changed-file check for comparisons, subject to the SCM event type.
775
767
776
-
4. **Automatic Fallback**: If no manifest files are found in git commit changes and no `--files` are specified, the CLI automatically switches to "API mode" and performs a full repository scan. With `--strict-blocking`, it runs the comparison instead, as `--ignore-commit-files` does, so existing blocking alerts are still checked.
768
+
4. **Automatic Fallback**: When the changed-file check finds no supported manifest, the CLI normally runs a full scan. Strict mode compares scans so it can evaluate existing findings. See [Scan type by pipeline](ci-cd.md#scan-type-by-pipeline) for SCM event rules.
777
769
778
-
> **Important**: The CLI doesn't scan only the specified files - it uses them to determine whether a scan should be performed and what type of scan to run. When triggered, it searches the entire `--target-path`for all supported manifest files.
770
+
The changed-file list and `--files` select the scan type. Manifest discovery
771
+
uses the configured scan scope, including any `--sub-path` restrictions.
779
772
780
773
### Scanning Modes
781
774
782
775
- **Differential Mode**: When manifest files are detected in changes, performs a diff scan with PR/MR comment integration
783
-
- **API Mode**: When no manifest files are in changes, creates a full scan report without PR comments but still scans the entire repository. With `--strict-blocking`, the CLI runs a comparison instead (see Automatic Fallback above);SCM branch pipelines still create a full scan
784
-
- **Force Mode**: With `--ignore-commit-files`, always runs a comparison regardless of which files changed, over every manifest in the target path
776
+
- **Full Scan**: Reports findings to the Dashboard. SCM branch pipelines use this mode.
777
+
- **Force Mode**: With `--ignore-commit-files`, compares regardless of which files changed on pipelines eligible for comparison.
785
778
- **Forced Diff Mode**: With `--enable-diff`, forces differential mode even when using `--integration api` (without SCM integration)
786
779
787
780
### Examples
788
781
789
782
- **Commit with manifest file**: If your commit includes changes to `package.json`, a differential scan will be triggered automatically with PR comment integration.
790
-
- **Commit without manifest files**: If your commit only changes non-manifest files (like `.github/workflows/socket.yaml`), the CLI automatically switches to API mode and performs a full repository scan.
783
+
- **Code-only commit**: The CLI runs a full scan by default. `--strict-blocking` selects a comparison on pipelines eligible for comparison.
791
784
- **Using `--files`**: If you specify `--files '["package.json"]'`, the CLI will check if this file exists and is a manifest file before determining scan type.
792
785
- **Using `--ignore-commit-files`**: This runs the comparison regardless of what's in your commit, over all manifest files in the target path. Use it when the changed-file check would otherwise skip a comparison you need.
793
786
- **Using `--enable-diff`**: Forces diff mode without SCM integration - useful when you want differential scanning but are using `--integration api`. For example: `socketcli --integration api --enable-diff --target-path /path/to/repo`
@@ -901,13 +894,11 @@ The GitLab Security Dashboard report and the JSON/SARIF diff outputs use differe
901
894
902
895
| Output Format | Default Alerts | With `--strict-blocking`|
903
896
|:---|:---|:---|
904
-
| `--enable-gitlab-security` | **All** alerts (new + existing) | All alerts (same) |
897
+
|`--enable-gitlab-security`|New alerts and existing alerts on unchanged dependencies | Also includes findings that persist after a version change|
905
898
|`--enable-json`| New alerts only | New + existing alerts |
906
899
|`--enable-sarif` (diff scope) | New alerts only | New + existing alerts |
907
900
908
-
**Why the difference?** GitLab's Security Dashboard is designed to present the full security posture of a project. An empty dashboard on a scan with no dependency changes would be misleading -- the vulnerabilities still exist, they just didn't change. By contrast, JSON and SARIF in diff scope are designed to answer "what changed?" and only include existing alerts when `--strict-blocking` explicitly requests it.
909
-
910
-
> **Tip:** If you use `--enable-json` alongside `--enable-gitlab-security`, the GitLab report may contain more vulnerabilities than the JSON output. This is expected. To make JSON output match, add `--strict-blocking`.
901
+
Enable `--strict-blocking` to include existing findings in JSON and diff-scope SARIF. Scan-based SARIF includes the advisory ID in the rule ID when available, so separate advisories on the same package and manifest remain distinguishable.
|`--enable-json`, `--enable-sarif`, `--enable-gitlab-security` or `--generate-license` on a full scan |`GET orgs/{org}/full-scans/{id}` (scan contents) |`full-scans:list`|
126
-
|`--strict-blocking`, `--enable-gitlab-security` or `--legal-format fossa` on a run that compares scans |`GET orgs/{org}/full-scans/{id}` (alerts on unchanged packages) |`full-scans:list`|
126
+
|`--strict-blocking`, `--enable-gitlab-security` or `--legal-format fossa` on a run that compares scans |`GET orgs/{org}/full-scans/{id}` (existing alerts) |`full-scans:list`|
127
127
128
128
`--reach` also runs the analysis engine with the same token. The engine reports to the
129
129
`tier1-reachability-scan/*` endpoints, which check `full-scans:create`.
0 commit comments