socketsecurity 2.2.77__tar.gz → 2.2.79__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/.github/workflows/e2e-test.yml +13 -13
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/.github/workflows/pr-preview.yml +13 -1
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/.github/workflows/python-tests.yml +20 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/.github/workflows/version-check.yml +6 -4
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/.gitignore +1 -0
- socketsecurity-2.2.79/PKG-INFO +251 -0
- socketsecurity-2.2.79/README.md +193 -0
- socketsecurity-2.2.79/docs/ci-cd.md +119 -0
- socketsecurity-2.2.77/README.md → socketsecurity-2.2.79/docs/cli-reference.md +155 -320
- socketsecurity-2.2.79/docs/development.md +95 -0
- socketsecurity-2.2.79/docs/troubleshooting.md +81 -0
- socketsecurity-2.2.79/examples/config/sarif-dashboard-parity.json +11 -0
- socketsecurity-2.2.79/examples/config/sarif-dashboard-parity.toml +18 -0
- socketsecurity-2.2.79/examples/config/sarif-diff-ci-cd.json +11 -0
- socketsecurity-2.2.79/examples/config/sarif-diff-ci-cd.toml +16 -0
- socketsecurity-2.2.79/examples/config/sarif-instance-detail.json +11 -0
- socketsecurity-2.2.79/examples/config/sarif-instance-detail.toml +16 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/pyproject.toml +2 -3
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/__init__.py +1 -1
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/config.py +111 -14
- socketsecurity-2.2.79/socketsecurity/core/alert_selection.py +239 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/core/messages.py +204 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/output.py +59 -21
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/plugins/slack.py +29 -24
- socketsecurity-2.2.79/tests/unit/test_alert_selection.py +101 -0
- socketsecurity-2.2.79/tests/unit/test_config.py +179 -0
- socketsecurity-2.2.79/tests/unit/test_output.py +816 -0
- socketsecurity-2.2.79/tests/unit/test_slack_plugin.py +122 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/uv.lock +2 -103
- socketsecurity-2.2.79/workflows/buildkite.yml +13 -0
- socketsecurity-2.2.77/PKG-INFO +0 -957
- socketsecurity-2.2.77/docs/README.md +0 -10
- socketsecurity-2.2.77/tests/unit/test_config.py +0 -93
- socketsecurity-2.2.77/tests/unit/test_output.py +0 -338
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/.github/CODEOWNERS +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/.github/PULL_REQUEST_TEMPLATE/bug-fix.md +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/.github/PULL_REQUEST_TEMPLATE/improvement.md +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/.github/workflows/docker-stable.yml +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/.github/workflows/release.yml +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/.hooks/sync_version.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/.pre-commit-config.yaml +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/.python-version +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/CHANGELOG.md +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/Dockerfile +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/LICENSE +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/Makefile +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/instructions/gitlab-commit-status/uat.md +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/pytest.ini +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/scripts/build_container.sh +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/scripts/build_container_flexible.sh +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/scripts/deploy-test-docker.sh +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/scripts/deploy-test-pypi.sh +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/scripts/docker-entrypoint.sh +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/scripts/run.sh +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/session.md +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socket.yml +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/core/__init__.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/core/classes.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/core/cli_client.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/core/exceptions.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/core/git_interface.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/core/helper/__init__.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/core/helper/socket_facts_loader.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/core/lazy_file_loader.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/core/logging.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/core/resource_utils.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/core/scm/__init__.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/core/scm/base.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/core/scm/client.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/core/scm/github.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/core/scm/gitlab.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/core/scm_comments.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/core/socket_config.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/core/tools/reachability.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/core/utils.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/plugins/__init__.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/plugins/base.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/plugins/formatters/__init__.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/plugins/formatters/slack.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/plugins/jira.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/plugins/manager.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/plugins/teams.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/plugins/webhook.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/socketsecurity/socketcli.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/__init__.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/core/conftest.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/core/create_diff_input.json +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/core/test_diff_alerts.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/core/test_diff_generation.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/core/test_has_manifest_files.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/core/test_package_and_alerts.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/core/test_sdk_methods.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/core/test_supporting_methods.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/data/fullscans/create_response.json +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/data/fullscans/diff/stream_diff.json +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/data/fullscans/diff/stream_diff_full.json +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/data/fullscans/head_scan/metadata.json +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/data/fullscans/head_scan/stream_scan.json +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/data/fullscans/head_scan/stream_scan_full.json +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/data/fullscans/new_scan/metadata.json +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/data/fullscans/new_scan/stream_scan.json +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/data/repos/repo_info_error.json +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/data/repos/repo_info_no_head.json +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/data/repos/repo_info_success.json +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/data/settings/security-policy.json +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/e2e/fixtures/simple-npm/index.js +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/e2e/fixtures/simple-npm/package.json +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/unit/__init__.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/unit/test_cli_config.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/unit/test_client.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/unit/test_gitlab_auth.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/unit/test_gitlab_auth_fallback.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/unit/test_gitlab_commit_status.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/tests/unit/test_gitlab_format.py +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/workflows/bitbucket-pipelines.yml +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/workflows/github-actions.yml +0 -0
- {socketsecurity-2.2.77 → socketsecurity-2.2.79}/workflows/gitlab-ci.yml +0 -0
|
@@ -4,9 +4,11 @@ on:
|
|
|
4
4
|
push:
|
|
5
5
|
branches: [main]
|
|
6
6
|
pull_request:
|
|
7
|
+
workflow_dispatch:
|
|
7
8
|
|
|
8
9
|
jobs:
|
|
9
10
|
e2e-scan:
|
|
11
|
+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
|
|
10
12
|
runs-on: ubuntu-latest
|
|
11
13
|
steps:
|
|
12
14
|
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
|
|
@@ -48,6 +50,7 @@ jobs:
|
|
|
48
50
|
fi
|
|
49
51
|
|
|
50
52
|
e2e-sarif:
|
|
53
|
+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
|
|
51
54
|
runs-on: ubuntu-latest
|
|
52
55
|
steps:
|
|
53
56
|
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
|
|
@@ -63,15 +66,6 @@ jobs:
|
|
|
63
66
|
python -m pip install --upgrade pip
|
|
64
67
|
pip install .
|
|
65
68
|
|
|
66
|
-
- name: Verify --sarif-reachable-only without --reach exits non-zero
|
|
67
|
-
run: |
|
|
68
|
-
if socketcli --sarif-reachable-only --api-token dummy 2>&1; then
|
|
69
|
-
echo "FAIL: Expected non-zero exit"
|
|
70
|
-
exit 1
|
|
71
|
-
else
|
|
72
|
-
echo "PASS: Exited non-zero as expected"
|
|
73
|
-
fi
|
|
74
|
-
|
|
75
69
|
- name: Run Socket CLI scan with --sarif-file
|
|
76
70
|
env:
|
|
77
71
|
SOCKET_SECURITY_API_KEY: ${{ secrets.SOCKET_CLI_API_TOKEN }}
|
|
@@ -96,6 +90,7 @@ jobs:
|
|
|
96
90
|
"
|
|
97
91
|
|
|
98
92
|
e2e-reachability:
|
|
93
|
+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
|
|
99
94
|
runs-on: ubuntu-latest
|
|
100
95
|
steps:
|
|
101
96
|
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
|
|
@@ -164,10 +159,12 @@ jobs:
|
|
|
164
159
|
--target-path tests/e2e/fixtures/simple-npm \
|
|
165
160
|
--reach \
|
|
166
161
|
--sarif-file /tmp/sarif-all.sarif \
|
|
162
|
+
--sarif-scope full \
|
|
163
|
+
--sarif-reachability all \
|
|
167
164
|
--disable-blocking \
|
|
168
|
-
2>/dev/null
|
|
165
|
+
2>/dev/null
|
|
169
166
|
|
|
170
|
-
- name: Run scan with --sarif-file --sarif-reachable
|
|
167
|
+
- name: Run scan with --sarif-file --sarif-reachability reachable (filtered results)
|
|
171
168
|
env:
|
|
172
169
|
SOCKET_SECURITY_API_KEY: ${{ secrets.SOCKET_CLI_API_TOKEN }}
|
|
173
170
|
run: |
|
|
@@ -175,12 +172,15 @@ jobs:
|
|
|
175
172
|
--target-path tests/e2e/fixtures/simple-npm \
|
|
176
173
|
--reach \
|
|
177
174
|
--sarif-file /tmp/sarif-reachable.sarif \
|
|
178
|
-
--sarif-
|
|
175
|
+
--sarif-scope full \
|
|
176
|
+
--sarif-reachability reachable \
|
|
179
177
|
--disable-blocking \
|
|
180
|
-
2>/dev/null
|
|
178
|
+
2>/dev/null
|
|
181
179
|
|
|
182
180
|
- name: Verify reachable-only results are a subset of all results
|
|
183
181
|
run: |
|
|
182
|
+
test -f /tmp/sarif-all.sarif
|
|
183
|
+
test -f /tmp/sarif-reachable.sarif
|
|
184
184
|
python3 -c "
|
|
185
185
|
import json
|
|
186
186
|
with open('/tmp/sarif-all.sarif') as f:
|
|
@@ -5,6 +5,7 @@ on:
|
|
|
5
5
|
|
|
6
6
|
jobs:
|
|
7
7
|
preview:
|
|
8
|
+
if: github.event.pull_request.head.repo.full_name == github.repository
|
|
8
9
|
runs-on: ubuntu-latest
|
|
9
10
|
permissions:
|
|
10
11
|
id-token: write
|
|
@@ -37,6 +38,17 @@ jobs:
|
|
|
37
38
|
VERSION=$(hatch version | cut -d+ -f1)
|
|
38
39
|
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
39
40
|
|
|
41
|
+
- name: Check if version already exists on Test PyPI
|
|
42
|
+
id: version_check
|
|
43
|
+
env:
|
|
44
|
+
VERSION: ${{ env.VERSION }}
|
|
45
|
+
run: |
|
|
46
|
+
if curl -s -f https://test.pypi.org/pypi/socketsecurity/${VERSION}/json > /dev/null; then
|
|
47
|
+
echo "exists=true" >> $GITHUB_OUTPUT
|
|
48
|
+
else
|
|
49
|
+
echo "exists=false" >> $GITHUB_OUTPUT
|
|
50
|
+
fi
|
|
51
|
+
|
|
40
52
|
- name: Build package
|
|
41
53
|
if: steps.version_check.outputs.exists != 'true'
|
|
42
54
|
run: |
|
|
@@ -146,4 +158,4 @@ jobs:
|
|
|
146
158
|
build-args: |
|
|
147
159
|
CLI_VERSION=${{ env.VERSION }}
|
|
148
160
|
PIP_INDEX_URL=https://test.pypi.org/simple
|
|
149
|
-
PIP_EXTRA_INDEX_URL=https://pypi.org/simple
|
|
161
|
+
PIP_EXTRA_INDEX_URL=https://pypi.org/simple
|
|
@@ -50,3 +50,23 @@ jobs:
|
|
|
50
50
|
uv sync --extra test
|
|
51
51
|
- name: 🧪 run tests
|
|
52
52
|
run: uv run pytest -q tests/unit/ tests/core/
|
|
53
|
+
|
|
54
|
+
unsupported-python-install:
|
|
55
|
+
runs-on: ubuntu-latest
|
|
56
|
+
timeout-minutes: 10
|
|
57
|
+
steps:
|
|
58
|
+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
|
|
59
|
+
with:
|
|
60
|
+
fetch-depth: 1
|
|
61
|
+
persist-credentials: false
|
|
62
|
+
- name: 🐍 setup python
|
|
63
|
+
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3
|
|
64
|
+
with:
|
|
65
|
+
python-version: "3.10"
|
|
66
|
+
- name: 🚫 verify install is rejected on unsupported python
|
|
67
|
+
run: |
|
|
68
|
+
python -m pip install --upgrade pip
|
|
69
|
+
if pip install .; then
|
|
70
|
+
echo "Expected pip install . to fail on Python 3.10"
|
|
71
|
+
exit 1
|
|
72
|
+
fi
|
|
@@ -18,13 +18,15 @@ jobs:
|
|
|
18
18
|
- name: Check version increment
|
|
19
19
|
id: version_check
|
|
20
20
|
run: |
|
|
21
|
+
python -m pip install --upgrade pip
|
|
22
|
+
pip install packaging
|
|
23
|
+
|
|
21
24
|
# Get version from current PR
|
|
22
25
|
PR_VERSION=$(grep -o "__version__.*" socketsecurity/__init__.py | awk '{print $3}' | tr -d "'")
|
|
23
26
|
echo "PR_VERSION=$PR_VERSION" >> $GITHUB_ENV
|
|
24
27
|
|
|
25
28
|
# Get version from main branch
|
|
26
|
-
git
|
|
27
|
-
MAIN_VERSION=$(grep -o "__version__.*" socketsecurity/__init__.py | awk '{print $3}' | tr -d "'")
|
|
29
|
+
MAIN_VERSION=$(git show origin/main:socketsecurity/__init__.py | grep -o "__version__.*" | awk '{print $3}' | tr -d "'")
|
|
28
30
|
echo "MAIN_VERSION=$MAIN_VERSION" >> $GITHUB_ENV
|
|
29
31
|
|
|
30
32
|
# Compare versions using Python
|
|
@@ -40,7 +42,7 @@ jobs:
|
|
|
40
42
|
|
|
41
43
|
- name: Manage PR Comment
|
|
42
44
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
|
|
43
|
-
if: always()
|
|
45
|
+
if: always() && github.event.pull_request.head.repo.full_name == github.repository
|
|
44
46
|
env:
|
|
45
47
|
MAIN_VERSION: ${{ env.MAIN_VERSION }}
|
|
46
48
|
PR_VERSION: ${{ env.PR_VERSION }}
|
|
@@ -87,4 +89,4 @@ jobs:
|
|
|
87
89
|
issue_number: prNumber,
|
|
88
90
|
body: `❌ **Version Check Failed**\n\nPlease increment...`
|
|
89
91
|
});
|
|
90
|
-
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: socketsecurity
|
|
3
|
+
Version: 2.2.79
|
|
4
|
+
Summary: Socket Security CLI for CI/CD
|
|
5
|
+
Project-URL: Homepage, https://socket.dev
|
|
6
|
+
Author-email: Douglas Coburn <douglas@socket.dev>
|
|
7
|
+
Maintainer-email: Douglas Coburn <douglas@socket.dev>
|
|
8
|
+
License: MIT License
|
|
9
|
+
|
|
10
|
+
Copyright (c) 2022 Socket Inc
|
|
11
|
+
|
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
14
|
+
in the Software without restriction, including without limitation the rights
|
|
15
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
17
|
+
furnished to do so, subject to the following conditions:
|
|
18
|
+
|
|
19
|
+
The above copyright notice and this permission notice shall be included in all
|
|
20
|
+
copies or substantial portions of the Software.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
+
SOFTWARE.
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Keywords: oss,sca,security,socket.dev,socketsecurity
|
|
31
|
+
Classifier: Development Status :: 4 - Beta
|
|
32
|
+
Classifier: Intended Audience :: Developers
|
|
33
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
34
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
35
|
+
Requires-Python: >=3.11
|
|
36
|
+
Requires-Dist: bs4>=0.0.2
|
|
37
|
+
Requires-Dist: gitpython
|
|
38
|
+
Requires-Dist: markdown>=3.10
|
|
39
|
+
Requires-Dist: mdutils
|
|
40
|
+
Requires-Dist: packaging
|
|
41
|
+
Requires-Dist: prettytable
|
|
42
|
+
Requires-Dist: python-dotenv
|
|
43
|
+
Requires-Dist: requests
|
|
44
|
+
Requires-Dist: socketdev<4.0.0,>=3.0.32
|
|
45
|
+
Provides-Extra: dev
|
|
46
|
+
Requires-Dist: hatch; extra == 'dev'
|
|
47
|
+
Requires-Dist: pre-commit; extra == 'dev'
|
|
48
|
+
Requires-Dist: ruff>=0.3.0; extra == 'dev'
|
|
49
|
+
Requires-Dist: twine; extra == 'dev'
|
|
50
|
+
Requires-Dist: uv>=0.1.0; extra == 'dev'
|
|
51
|
+
Provides-Extra: test
|
|
52
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'test'
|
|
53
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == 'test'
|
|
54
|
+
Requires-Dist: pytest-mock>=3.12.0; extra == 'test'
|
|
55
|
+
Requires-Dist: pytest-watch>=4.2.0; extra == 'test'
|
|
56
|
+
Requires-Dist: pytest>=7.4.0; extra == 'test'
|
|
57
|
+
Description-Content-Type: text/markdown
|
|
58
|
+
|
|
59
|
+
# Socket Security CLI
|
|
60
|
+
|
|
61
|
+
Socket Python CLI for Socket scans, diff reporting, reachability analysis, and SARIF/GitLab exports.
|
|
62
|
+
|
|
63
|
+
Comprehensive docs are available in [`docs/`](docs/) for full flag reference, CI/CD-specific guidance, and contributor setup.
|
|
64
|
+
|
|
65
|
+
## Quick start
|
|
66
|
+
|
|
67
|
+
### 1) Install
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pip install socketsecurity
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 2) Authenticate
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
export SOCKET_SECURITY_API_TOKEN="<token>"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 3) Run a basic scan
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
socketcli --target-path .
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Common use cases
|
|
86
|
+
|
|
87
|
+
This section covers the paved path/common workflows.
|
|
88
|
+
For advanced options and exhaustive details, see [`docs/cli-reference.md`](docs/cli-reference.md).
|
|
89
|
+
For CI/CD-specific guidance, see [`docs/ci-cd.md`](docs/ci-cd.md).
|
|
90
|
+
|
|
91
|
+
### Basic policy scan (no SARIF)
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
socketcli --target-path .
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### GitLab dependency-scanning report
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
socketcli --enable-gitlab-security --gitlab-security-file gl-dependency-scanning-report.json
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## SARIF use cases
|
|
104
|
+
|
|
105
|
+
### Full-scope reachable SARIF (grouped alerts)
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
socketcli \
|
|
109
|
+
--reach \
|
|
110
|
+
--sarif-file results.sarif \
|
|
111
|
+
--sarif-scope full \
|
|
112
|
+
--sarif-grouping alert \
|
|
113
|
+
--sarif-reachability reachable \
|
|
114
|
+
--disable-blocking
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Diff-scope reachable SARIF (PR/CI gating)
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
socketcli \
|
|
121
|
+
--reach \
|
|
122
|
+
--sarif-file results.sarif \
|
|
123
|
+
--sarif-scope diff \
|
|
124
|
+
--sarif-reachability reachable \
|
|
125
|
+
--strict-blocking
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Full-scope SARIF (instance-level detail)
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
socketcli \
|
|
132
|
+
--reach \
|
|
133
|
+
--sarif-file results.sarif \
|
|
134
|
+
--sarif-scope full \
|
|
135
|
+
--sarif-grouping instance \
|
|
136
|
+
--sarif-reachability all \
|
|
137
|
+
--disable-blocking
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Choose your mode
|
|
141
|
+
|
|
142
|
+
| Use case | Recommended mode | Key flags |
|
|
143
|
+
|:--|:--|:--|
|
|
144
|
+
| Basic policy enforcement in CI | Diff-based policy check | `--strict-blocking` |
|
|
145
|
+
| Reachable-focused SARIF for reporting | Full-scope grouped SARIF | `--reach --sarif-scope full --sarif-grouping alert --sarif-reachability reachable --sarif-file <path>` |
|
|
146
|
+
| Detailed reachability export for investigations | Full-scope instance SARIF | `--reach --sarif-scope full --sarif-grouping instance --sarif-reachability all --sarif-file <path>` |
|
|
147
|
+
| Net-new PR findings only | Diff-scope SARIF | `--reach --sarif-scope diff --sarif-reachability reachable --sarif-file <path>` |
|
|
148
|
+
|
|
149
|
+
Dashboard parity note:
|
|
150
|
+
- Full-scope SARIF is the closest match for dashboard-style filtering.
|
|
151
|
+
- Exact result counts can still differ from the dashboard due to backend/API consolidation differences and grouping semantics.
|
|
152
|
+
- See [`docs/troubleshooting.md#dashboard-vs-cli-result-counts`](docs/troubleshooting.md#dashboard-vs-cli-result-counts).
|
|
153
|
+
|
|
154
|
+
## Config files (`--config`)
|
|
155
|
+
|
|
156
|
+
Use `--config <path>` with `.toml` or `.json` to avoid long command lines.
|
|
157
|
+
|
|
158
|
+
Precedence order:
|
|
159
|
+
|
|
160
|
+
`CLI flags` > `environment variables` > `config file` > `built-in defaults`
|
|
161
|
+
|
|
162
|
+
Example:
|
|
163
|
+
|
|
164
|
+
```toml
|
|
165
|
+
[socketcli]
|
|
166
|
+
repo = "example-repo"
|
|
167
|
+
reach = true
|
|
168
|
+
sarif_scope = "full"
|
|
169
|
+
sarif_grouping = "alert"
|
|
170
|
+
sarif_reachability = "reachable"
|
|
171
|
+
sarif_file = "reachable.sarif"
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Equivalent JSON:
|
|
175
|
+
|
|
176
|
+
```json
|
|
177
|
+
{
|
|
178
|
+
"socketcli": {
|
|
179
|
+
"repo": "example-repo",
|
|
180
|
+
"reach": true,
|
|
181
|
+
"sarif_scope": "full",
|
|
182
|
+
"sarif_grouping": "alert",
|
|
183
|
+
"sarif_reachability": "reachable",
|
|
184
|
+
"sarif_file": "reachable.sarif"
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Run:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
socketcli --config .socketcli.toml --target-path .
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Reference sample configs:
|
|
196
|
+
|
|
197
|
+
TOML:
|
|
198
|
+
- [`examples/config/sarif-dashboard-parity.toml`](examples/config/sarif-dashboard-parity.toml)
|
|
199
|
+
- [`examples/config/sarif-instance-detail.toml`](examples/config/sarif-instance-detail.toml)
|
|
200
|
+
- [`examples/config/sarif-diff-ci-cd.toml`](examples/config/sarif-diff-ci-cd.toml)
|
|
201
|
+
|
|
202
|
+
JSON:
|
|
203
|
+
- [`examples/config/sarif-dashboard-parity.json`](examples/config/sarif-dashboard-parity.json)
|
|
204
|
+
- [`examples/config/sarif-instance-detail.json`](examples/config/sarif-instance-detail.json)
|
|
205
|
+
- [`examples/config/sarif-diff-ci-cd.json`](examples/config/sarif-diff-ci-cd.json)
|
|
206
|
+
|
|
207
|
+
## CI/CD examples
|
|
208
|
+
|
|
209
|
+
Prebuilt workflow examples:
|
|
210
|
+
|
|
211
|
+
- [GitHub Actions](workflows/github-actions.yml)
|
|
212
|
+
- [Buildkite](workflows/buildkite.yml)
|
|
213
|
+
- [GitLab CI](workflows/gitlab-ci.yml)
|
|
214
|
+
- [Bitbucket Pipelines](workflows/bitbucket-pipelines.yml)
|
|
215
|
+
|
|
216
|
+
Minimal pattern:
|
|
217
|
+
|
|
218
|
+
```yaml
|
|
219
|
+
- name: Run Socket CLI
|
|
220
|
+
run: socketcli --config .socketcli.toml --target-path .
|
|
221
|
+
env:
|
|
222
|
+
SOCKET_SECURITY_API_TOKEN: ${{ secrets.SOCKET_SECURITY_API_TOKEN }}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## Common gotchas
|
|
226
|
+
|
|
227
|
+
See [`docs/troubleshooting.md`](docs/troubleshooting.md#common-gotchas).
|
|
228
|
+
|
|
229
|
+
## Quick verification checks
|
|
230
|
+
|
|
231
|
+
After generating SARIF files, validate shape/count quickly:
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
jq '.runs[0].results | length' results.sarif
|
|
235
|
+
jq -r '.runs[0].results[]?.properties.reachability' results.sarif | sort -u
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
For side-by-side comparisons:
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
jq '.runs[0].results | length' sarif-dashboard-parity-reachable.sarif
|
|
242
|
+
jq '.runs[0].results | length' sarif-full-instance-all.sarif
|
|
243
|
+
jq '.runs[0].results | length' sarif-diff-reachable.sarif
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Documentation reference
|
|
247
|
+
|
|
248
|
+
- Full CLI reference: [`docs/cli-reference.md`](docs/cli-reference.md)
|
|
249
|
+
- CI/CD guide: [`docs/ci-cd.md`](docs/ci-cd.md)
|
|
250
|
+
- Troubleshooting guide: [`docs/troubleshooting.md`](docs/troubleshooting.md)
|
|
251
|
+
- Development guide: [`docs/development.md`](docs/development.md)
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# Socket Security CLI
|
|
2
|
+
|
|
3
|
+
Socket Python CLI for Socket scans, diff reporting, reachability analysis, and SARIF/GitLab exports.
|
|
4
|
+
|
|
5
|
+
Comprehensive docs are available in [`docs/`](docs/) for full flag reference, CI/CD-specific guidance, and contributor setup.
|
|
6
|
+
|
|
7
|
+
## Quick start
|
|
8
|
+
|
|
9
|
+
### 1) Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pip install socketsecurity
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### 2) Authenticate
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
export SOCKET_SECURITY_API_TOKEN="<token>"
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### 3) Run a basic scan
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
socketcli --target-path .
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Common use cases
|
|
28
|
+
|
|
29
|
+
This section covers the paved path/common workflows.
|
|
30
|
+
For advanced options and exhaustive details, see [`docs/cli-reference.md`](docs/cli-reference.md).
|
|
31
|
+
For CI/CD-specific guidance, see [`docs/ci-cd.md`](docs/ci-cd.md).
|
|
32
|
+
|
|
33
|
+
### Basic policy scan (no SARIF)
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
socketcli --target-path .
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### GitLab dependency-scanning report
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
socketcli --enable-gitlab-security --gitlab-security-file gl-dependency-scanning-report.json
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## SARIF use cases
|
|
46
|
+
|
|
47
|
+
### Full-scope reachable SARIF (grouped alerts)
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
socketcli \
|
|
51
|
+
--reach \
|
|
52
|
+
--sarif-file results.sarif \
|
|
53
|
+
--sarif-scope full \
|
|
54
|
+
--sarif-grouping alert \
|
|
55
|
+
--sarif-reachability reachable \
|
|
56
|
+
--disable-blocking
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Diff-scope reachable SARIF (PR/CI gating)
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
socketcli \
|
|
63
|
+
--reach \
|
|
64
|
+
--sarif-file results.sarif \
|
|
65
|
+
--sarif-scope diff \
|
|
66
|
+
--sarif-reachability reachable \
|
|
67
|
+
--strict-blocking
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Full-scope SARIF (instance-level detail)
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
socketcli \
|
|
74
|
+
--reach \
|
|
75
|
+
--sarif-file results.sarif \
|
|
76
|
+
--sarif-scope full \
|
|
77
|
+
--sarif-grouping instance \
|
|
78
|
+
--sarif-reachability all \
|
|
79
|
+
--disable-blocking
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Choose your mode
|
|
83
|
+
|
|
84
|
+
| Use case | Recommended mode | Key flags |
|
|
85
|
+
|:--|:--|:--|
|
|
86
|
+
| Basic policy enforcement in CI | Diff-based policy check | `--strict-blocking` |
|
|
87
|
+
| Reachable-focused SARIF for reporting | Full-scope grouped SARIF | `--reach --sarif-scope full --sarif-grouping alert --sarif-reachability reachable --sarif-file <path>` |
|
|
88
|
+
| Detailed reachability export for investigations | Full-scope instance SARIF | `--reach --sarif-scope full --sarif-grouping instance --sarif-reachability all --sarif-file <path>` |
|
|
89
|
+
| Net-new PR findings only | Diff-scope SARIF | `--reach --sarif-scope diff --sarif-reachability reachable --sarif-file <path>` |
|
|
90
|
+
|
|
91
|
+
Dashboard parity note:
|
|
92
|
+
- Full-scope SARIF is the closest match for dashboard-style filtering.
|
|
93
|
+
- Exact result counts can still differ from the dashboard due to backend/API consolidation differences and grouping semantics.
|
|
94
|
+
- See [`docs/troubleshooting.md#dashboard-vs-cli-result-counts`](docs/troubleshooting.md#dashboard-vs-cli-result-counts).
|
|
95
|
+
|
|
96
|
+
## Config files (`--config`)
|
|
97
|
+
|
|
98
|
+
Use `--config <path>` with `.toml` or `.json` to avoid long command lines.
|
|
99
|
+
|
|
100
|
+
Precedence order:
|
|
101
|
+
|
|
102
|
+
`CLI flags` > `environment variables` > `config file` > `built-in defaults`
|
|
103
|
+
|
|
104
|
+
Example:
|
|
105
|
+
|
|
106
|
+
```toml
|
|
107
|
+
[socketcli]
|
|
108
|
+
repo = "example-repo"
|
|
109
|
+
reach = true
|
|
110
|
+
sarif_scope = "full"
|
|
111
|
+
sarif_grouping = "alert"
|
|
112
|
+
sarif_reachability = "reachable"
|
|
113
|
+
sarif_file = "reachable.sarif"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Equivalent JSON:
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"socketcli": {
|
|
121
|
+
"repo": "example-repo",
|
|
122
|
+
"reach": true,
|
|
123
|
+
"sarif_scope": "full",
|
|
124
|
+
"sarif_grouping": "alert",
|
|
125
|
+
"sarif_reachability": "reachable",
|
|
126
|
+
"sarif_file": "reachable.sarif"
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Run:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
socketcli --config .socketcli.toml --target-path .
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Reference sample configs:
|
|
138
|
+
|
|
139
|
+
TOML:
|
|
140
|
+
- [`examples/config/sarif-dashboard-parity.toml`](examples/config/sarif-dashboard-parity.toml)
|
|
141
|
+
- [`examples/config/sarif-instance-detail.toml`](examples/config/sarif-instance-detail.toml)
|
|
142
|
+
- [`examples/config/sarif-diff-ci-cd.toml`](examples/config/sarif-diff-ci-cd.toml)
|
|
143
|
+
|
|
144
|
+
JSON:
|
|
145
|
+
- [`examples/config/sarif-dashboard-parity.json`](examples/config/sarif-dashboard-parity.json)
|
|
146
|
+
- [`examples/config/sarif-instance-detail.json`](examples/config/sarif-instance-detail.json)
|
|
147
|
+
- [`examples/config/sarif-diff-ci-cd.json`](examples/config/sarif-diff-ci-cd.json)
|
|
148
|
+
|
|
149
|
+
## CI/CD examples
|
|
150
|
+
|
|
151
|
+
Prebuilt workflow examples:
|
|
152
|
+
|
|
153
|
+
- [GitHub Actions](workflows/github-actions.yml)
|
|
154
|
+
- [Buildkite](workflows/buildkite.yml)
|
|
155
|
+
- [GitLab CI](workflows/gitlab-ci.yml)
|
|
156
|
+
- [Bitbucket Pipelines](workflows/bitbucket-pipelines.yml)
|
|
157
|
+
|
|
158
|
+
Minimal pattern:
|
|
159
|
+
|
|
160
|
+
```yaml
|
|
161
|
+
- name: Run Socket CLI
|
|
162
|
+
run: socketcli --config .socketcli.toml --target-path .
|
|
163
|
+
env:
|
|
164
|
+
SOCKET_SECURITY_API_TOKEN: ${{ secrets.SOCKET_SECURITY_API_TOKEN }}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Common gotchas
|
|
168
|
+
|
|
169
|
+
See [`docs/troubleshooting.md`](docs/troubleshooting.md#common-gotchas).
|
|
170
|
+
|
|
171
|
+
## Quick verification checks
|
|
172
|
+
|
|
173
|
+
After generating SARIF files, validate shape/count quickly:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
jq '.runs[0].results | length' results.sarif
|
|
177
|
+
jq -r '.runs[0].results[]?.properties.reachability' results.sarif | sort -u
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
For side-by-side comparisons:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
jq '.runs[0].results | length' sarif-dashboard-parity-reachable.sarif
|
|
184
|
+
jq '.runs[0].results | length' sarif-full-instance-all.sarif
|
|
185
|
+
jq '.runs[0].results | length' sarif-diff-reachable.sarif
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Documentation reference
|
|
189
|
+
|
|
190
|
+
- Full CLI reference: [`docs/cli-reference.md`](docs/cli-reference.md)
|
|
191
|
+
- CI/CD guide: [`docs/ci-cd.md`](docs/ci-cd.md)
|
|
192
|
+
- Troubleshooting guide: [`docs/troubleshooting.md`](docs/troubleshooting.md)
|
|
193
|
+
- Development guide: [`docs/development.md`](docs/development.md)
|