Socket Security CLI for CI/CD
Project description
Socket Security CLI
Socket Python CLI for Socket scans, diff reporting, reachability analysis, and SARIF/GitLab exports.
Comprehensive docs are available in docs/ for full flag reference, CI/CD-specific guidance, and contributor setup.
Quick start
1) Install
pip install socketsecurity
2) Authenticate
export SOCKET_SECURITY_API_TOKEN="<token>"
3) Run a basic scan
socketcli --target-path .
Common use cases
This section covers the paved path/common workflows.
For advanced options and exhaustive details, see docs/cli-reference.md.
For CI/CD-specific guidance, see docs/ci-cd.md.
Basic policy scan (no SARIF)
socketcli --target-path .
GitLab dependency-scanning report
socketcli --enable-gitlab-security --gitlab-security-file gl-dependency-scanning-report.json
SARIF use cases
Full-scope reachable SARIF (grouped alerts)
socketcli \
--reach \
--sarif-file results.sarif \
--sarif-scope full \
--sarif-grouping alert \
--sarif-reachability reachable \
--disable-blocking
Diff-scope reachable SARIF (PR/CI gating)
socketcli \
--reach \
--sarif-file results.sarif \
--sarif-scope diff \
--sarif-reachability reachable \
--strict-blocking
Full-scope SARIF (instance-level detail)
socketcli \
--reach \
--sarif-file results.sarif \
--sarif-scope full \
--sarif-grouping instance \
--sarif-reachability all \
--disable-blocking
Choose your mode
| Use case | Recommended mode | Key flags |
|---|---|---|
| Basic policy enforcement in CI | Diff-based policy check | --strict-blocking |
| Reachable-focused SARIF for reporting | Full-scope grouped SARIF | --reach --sarif-scope full --sarif-grouping alert --sarif-reachability reachable --sarif-file <path> |
| Detailed reachability export for investigations | Full-scope instance SARIF | --reach --sarif-scope full --sarif-grouping instance --sarif-reachability all --sarif-file <path> |
| Net-new PR findings only | Diff-scope SARIF | --reach --sarif-scope diff --sarif-reachability reachable --sarif-file <path> |
Dashboard parity note:
- Full-scope SARIF is the closest match for dashboard-style filtering.
- Exact result counts can still differ from the dashboard due to backend/API consolidation differences and grouping semantics.
- See
docs/troubleshooting.md#dashboard-vs-cli-result-counts.
Config files (--config)
Use --config <path> with .toml or .json to avoid long command lines.
Precedence order:
CLI flags > environment variables > config file > built-in defaults
Example:
[socketcli]
repo = "example-repo"
reach = true
sarif_scope = "full"
sarif_grouping = "alert"
sarif_reachability = "reachable"
sarif_file = "reachable.sarif"
Equivalent JSON:
{
"socketcli": {
"repo": "example-repo",
"reach": true,
"sarif_scope": "full",
"sarif_grouping": "alert",
"sarif_reachability": "reachable",
"sarif_file": "reachable.sarif"
}
}
Run:
socketcli --config .socketcli.toml --target-path .
Reference sample configs:
TOML:
examples/config/sarif-dashboard-parity.tomlexamples/config/sarif-instance-detail.tomlexamples/config/sarif-diff-ci-cd.toml
JSON:
examples/config/sarif-dashboard-parity.jsonexamples/config/sarif-instance-detail.jsonexamples/config/sarif-diff-ci-cd.json
CI/CD examples
Prebuilt workflow examples:
Minimal pattern:
- name: Run Socket CLI
run: socketcli --config .socketcli.toml --target-path .
env:
SOCKET_SECURITY_API_TOKEN: ${{ secrets.SOCKET_SECURITY_API_TOKEN }}
Common gotchas
Quick verification checks
After generating SARIF files, validate shape/count quickly:
jq '.runs[0].results | length' results.sarif
jq -r '.runs[0].results[]?.properties.reachability' results.sarif | sort -u
For side-by-side comparisons:
jq '.runs[0].results | length' sarif-dashboard-parity-reachable.sarif
jq '.runs[0].results | length' sarif-full-instance-all.sarif
jq '.runs[0].results | length' sarif-diff-reachable.sarif
Documentation reference
- Full CLI reference:
docs/cli-reference.md - CI/CD guide:
docs/ci-cd.md - Troubleshooting guide:
docs/troubleshooting.md - Development guide:
docs/development.md
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file socketsecurity-2.2.83.tar.gz.
File metadata
- Download URL: socketsecurity-2.2.83.tar.gz
- Upload date:
- Size: 806.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4cfd65afb55d0333db2e24c6da4c0a2dc5d0a4558bb5d08bccc159eb50e29fa
|
|
| MD5 |
1418840a7616ad9010a4fdbb7ff1684d
|
|
| BLAKE2b-256 |
8b8223e47784e46d5f5d78d80a6783db9ac7c878ef1258515b3f596e6ba43950
|
Provenance
The following attestation bundles were made for socketsecurity-2.2.83.tar.gz:
Publisher:
release.yml on SocketDev/socket-python-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
socketsecurity-2.2.83.tar.gz -
Subject digest:
e4cfd65afb55d0333db2e24c6da4c0a2dc5d0a4558bb5d08bccc159eb50e29fa - Sigstore transparency entry: 1327473964
- Sigstore integration time:
-
Permalink:
SocketDev/socket-python-cli@aa1ba531d1910ea53c359fec74e1c005f62659ee -
Branch / Tag:
refs/tags/v2.2.83 - Owner: https://github.com/SocketDev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@aa1ba531d1910ea53c359fec74e1c005f62659ee -
Trigger Event:
release
-
Statement type:
File details
Details for the file socketsecurity-2.2.83-py3-none-any.whl.
File metadata
- Download URL: socketsecurity-2.2.83-py3-none-any.whl
- Upload date:
- Size: 102.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2936c058c17906314f6626a92a640fc18ce8cc3ef198a3c10ecf1d5e8f27fdc5
|
|
| MD5 |
939e83f645cf13beddeee77060eac4cf
|
|
| BLAKE2b-256 |
db7f563da7132e536a71d3f5fcba552256a326a30c0e976c5324d7e2f225b3f4
|
Provenance
The following attestation bundles were made for socketsecurity-2.2.83-py3-none-any.whl:
Publisher:
release.yml on SocketDev/socket-python-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
socketsecurity-2.2.83-py3-none-any.whl -
Subject digest:
2936c058c17906314f6626a92a640fc18ce8cc3ef198a3c10ecf1d5e8f27fdc5 - Sigstore transparency entry: 1327474715
- Sigstore integration time:
-
Permalink:
SocketDev/socket-python-cli@aa1ba531d1910ea53c359fec74e1c005f62659ee -
Branch / Tag:
refs/tags/v2.2.83 - Owner: https://github.com/SocketDev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@aa1ba531d1910ea53c359fec74e1c005f62659ee -
Trigger Event:
release
-
Statement type: