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 81b84e9
Browse filesBrowse the repository at this point in the historyBrowse files
- GitHub Actions for [pull requests](https://github.com/SocketDev/socket-python-cli/blob/main/workflows/github-actions.yml), [pushes](https://github.com/SocketDev/socket-python-cli/blob/main/workflows/github-actions-push.yml), and [ignore commands](https://github.com/SocketDev/socket-python-cli/blob/main/workflows/github-actions-comments.yml)
GitHub Actions `paths` filters only decide whether a workflow starts. They do not
@@ -499,27 +506,75 @@ pipelines:
499
506
500
507
## Scan type by pipeline
501
508
502
-
With `--scm github` or `--scm gitlab`, the detected event decides the scan type:
509
+
With `--scm github` or `--scm gitlab`, the adapter uses the event and PR/MR
510
+
context to select the scan type. A push given a PR/MR number can use the
511
+
comparison path.
503
512
504
513
| Event | Scan | Blocks the build |
505
514
|:------|:-----|:-----------------|
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 |
515
+
| Supported pull request / merge request events | Diff scan against the repository's baseline when a comparison runs | Yes, on new blocking alerts and on existing blockers with `--strict-blocking` |
516
+
| Push without a PR/MR number, including default-branch pushes | Full scan | No blocking on findings |
508
517
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 already treats a run with no supported manifest files.
518
+
With changed-file detection, a PR/MR with no supported manifest change runs a
519
+
full scan by default. Use `--strict-blocking` or `--ignore-commit-files` to
520
+
compare it. Full scans report through the Dashboard. A branch pipeline without
521
+
PR/MR context stays in full-scan mode even with `--enable-diff`,
522
+
`--ignore-commit-files`, or `--strict-blocking`.
514
523
515
-
The event type is authoritative once `--scm` is set: `--enable-diff`and
516
-
`--ignore-commit-files`do not turn a branch pipeline into a comparison. To diff
517
-
a branch build, drop `--scm` and use `--enable-diff` with `--integration`, which
518
-
runs the comparison without the PR comment adapter.
524
+
Without a GitHub or GitLab SCM adapter, `--strict-blocking` runs a comparison
525
+
even when no supported manifest changed. This includes default-branch pushes and
526
+
scans of non-git paths. A Block finding exits `1`. A comparison infrastructure
527
+
error exits `3` by default. Check the [API token scopes for comparison runs](troubleshooting.md#api-token-permissions)
528
+
when upgrading a pipeline that previously ran only full scans.
519
529
520
530
`--generate-license`and `--legal-format fossa` work on both paths; a full scan
521
531
fetches the package list for them.
522
532
533
+
### Skipped events
534
+
535
+
With `--scm github`, `pull_request` runs scan on the `opened`, `synchronize`,
536
+
`reopened`and `ready_for_review` actions. Other actions (`closed`, `labeled`,
537
+
`edited`, and others) and unsupported events log a warning and exit `0` without
538
+
scanning. `issue_comment` handles ignore commands. With `--scm gitlab`, the
539
+
recognized scan sources are `web`, `merge_request_event`, `push`, `api`, and
540
+
`pipeline`. Other sources, apart from the comment flow, also warn and exit `0`
541
+
without scanning.
542
+
543
+
- A GitHub merge queue evaluates required checks on the `merge_group` commit.
544
+
The CLI skips that event. Use a check that scans the merge group for
- GitHub Actions for [pull requests](../workflows/github-actions.yml), [pushes](../workflows/github-actions-push.yml), and [ignore commands](../workflows/github-actions-comments.yml)
| `--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. Only works in diff mode. 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. |
@@ -660,7 +660,8 @@ Security issues detected by Socket Security:
660
660
661
661
### Important Notes
662
662
663
-
- **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).
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. With `--scm`, GitHub and GitLab branch pipelines without PR/MR context 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.
664
665
- **Policy actions**. Warn findings are reported. If the same finding has both Warn and Block actions, Block takes precedence.
665
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.
666
667
- **PR/MR comments**. The comment lists new alerts first, then existing alerts
@@ -771,25 +772,26 @@ The CLI determines which files to scan based on the following logic:
771
772
772
773
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
774
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 inthe target directory.
775
+
3. **`--ignore-commit-files` Flag**: Skip the changed-file check for comparisons, subject to the SCM event type.
775
776
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.
777
+
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
778
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.
779
+
The changed-file list and `--files`selectthe scan type. Manifest discovery
780
+
uses the configured scan scope, including any `--sub-path` restrictions.
779
781
780
782
### Scanning Modes
781
783
782
784
- **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
784
-
- **Force Mode**: With `--ignore-commit-files`, always runs a comparison regardless of which files changed, over every manifest in the target path
785
+
- **Full Scan**: Reports findings to the Dashboard. SCM branch pipelines without PR/MR context use this mode.
786
+
- **Force Mode**: With `--ignore-commit-files`, compares regardless of which files changed on pipelines eligible for comparison.
785
787
- **Forced Diff Mode**: With `--enable-diff`, forces differential mode even when using `--integration api` (without SCM integration)
786
788
787
789
### Examples
788
790
789
791
- **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.
792
+
- **Code-only commit**: The CLI runs a full scan by default. `--strict-blocking` selects a comparison on pipelines eligible for comparison.
791
793
- **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
-
- **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.
794
+
- **Using `--ignore-commit-files`**: Compare the configured scan scope regardless of which files changed when the pipeline supports comparison.
793
795
- **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`
794
796
- **Auto-detection**: Most CI/CD scenarios now work with just `socketcli --target-path /path/to/repo --scm github --pr-number $PR_NUM`
0 commit comments