socketsecurity 2.11.12__tar.gz → 2.11.13__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.11.12 → socketsecurity-2.11.13}/CHANGELOG.md +30 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/PKG-INFO +6 -6
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/docs/cli-reference.md +23 -10
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/docs/troubleshooting.md +6 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/pyproject.toml +7 -7
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/__init__.py +1 -1
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/config.py +25 -3
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/git_interface.py +2 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/messages.py +6 -25
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/pull_request.py +69 -5
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/socketcli.py +10 -2
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_config.py +28 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_fossa_compat.py +7 -7
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_messages.py +23 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_pr_comment_rendering.py +4 -4
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_pull_request_context.py +43 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/uv.lock +58 -58
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/.github/CODEOWNERS +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/.github/PULL_REQUEST_TEMPLATE/bug-fix.md +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/.github/PULL_REQUEST_TEMPLATE/improvement.md +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/.github/actions/setup-docker/action.yml +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/.github/actions/setup-hatch/action.yml +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/.github/actions/setup-sfw/action.yml +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/.github/dependabot.yml +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/.github/workflows/dependency-audit.yml +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/.github/workflows/dependency-review.yml +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/.github/workflows/docker-stable.yml +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/.github/workflows/e2e-test.yml +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/.github/workflows/package-check.yml +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/.github/workflows/pr-preview.yml +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/.github/workflows/python-tests.yml +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/.github/workflows/release.yml +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/.github/workflows/version-check.yml +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/.github/zizmor.yml +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/.gitignore +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/.hooks/sync_version.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/.pre-commit-config.yaml +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/.python-version +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/CONTRIBUTING.md +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/Dockerfile +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/Dockerfile.preview +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/LICENSE +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/Makefile +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/README.md +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/benchmarks/manifest_discovery.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/docs/ci-cd.md +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/docs/development.md +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/examples/config/sarif-dashboard-parity.json +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/examples/config/sarif-dashboard-parity.toml +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/examples/config/sarif-diff-ci-cd.json +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/examples/config/sarif-diff-ci-cd.toml +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/examples/config/sarif-instance-detail.json +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/examples/config/sarif-instance-detail.toml +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/instructions/gitlab-commit-status/uat.md +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/pytest.ini +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/scripts/build_container.sh +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/scripts/build_container_flexible.sh +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/scripts/deploy-test-docker.sh +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/scripts/deploy-test-pypi.sh +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/scripts/docker-entrypoint.sh +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/scripts/run.sh +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/session.md +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socket.yml +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/__init__.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/alert_selection.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/classes.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/cli_client.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/cli_run.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/exceptions.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/git_remote.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/helper/__init__.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/helper/socket_facts_loader.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/lazy_file_loader.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/log_uploader.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/logging.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/resource_utils.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/scm/__init__.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/scm/base.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/scm/client.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/scm/github.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/scm/gitlab.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/scm_comments.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/socket_config.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/streaming.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/tools/coana-cache.mjs +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/tools/reachability.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/core/utils.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/fossa_compat.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/output.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/plugins/__init__.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/plugins/base.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/plugins/formatters/__init__.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/plugins/formatters/slack.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/plugins/jira.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/plugins/manager.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/plugins/slack.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/plugins/teams.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/socketsecurity/plugins/webhook.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/__init__.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/core/conftest.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/core/create_diff_input.json +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/core/test_diff_alerts.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/core/test_diff_generation.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/core/test_diff_scan_polling.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/core/test_facts_compression.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/core/test_full_scan_outputs.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/core/test_has_manifest_files.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/core/test_invalid_facts_marker.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/core/test_package_and_alerts.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/core/test_sdk_methods.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/core/test_supporting_methods.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/data/fullscans/create_response.json +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/data/fullscans/diff/stream_diff.json +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/data/fullscans/diff/stream_diff_full.json +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/data/fullscans/head_scan/metadata.json +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/data/fullscans/head_scan/stream_scan.json +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/data/fullscans/head_scan/stream_scan_full.json +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/data/fullscans/new_scan/metadata.json +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/data/fullscans/new_scan/stream_scan.json +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/data/repos/repo_info_error.json +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/data/repos/repo_info_no_head.json +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/data/repos/repo_info_success.json +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/data/settings/security-policy.json +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/e2e/fixtures/simple-npm/index.js +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/e2e/fixtures/simple-npm/package.json +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/e2e/fixtures/simple-pypi/requirements.txt +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/e2e/reach-facts-probe.sh +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/e2e/validate-gitlab.sh +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/e2e/validate-json.sh +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/e2e/validate-reachability.sh +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/e2e/validate-sarif.sh +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/e2e/validate-scan.sh +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/fixtures/fossa/README.md +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/fixtures/fossa/fossa-analyze-empty.json +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/fixtures/fossa/fossa-analyze-populated.json +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/fixtures/fossa/fossa-sbom-empty-deep.json +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/fixtures/fossa/fossa-sbom-populated.json +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/__init__.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_alert_selection.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_cli_config.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_cli_run.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_client.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_commit_message_truncation.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_dependency_overview.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_disable_ignore.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_exclude_paths.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_fossa_parity.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_full_scan_retry.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_git_interface.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_git_remote.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_github_buildkite_config.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_gitlab_auth.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_gitlab_auth_fallback.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_gitlab_commit_status.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_gitlab_format.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_ignore_authorization.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_ignore_telemetry_filtering.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_include_dirs.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_log_uploader.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_manifest_discovery.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_output.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_reachability.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_scan_scope.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_slack_plugin.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_slack_severity_normalization.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_socketcli.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_streaming.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_summary_text.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_tier1_finalize.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/tests/unit/test_user_agent.py +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/workflows/bitbucket-pipelines.yml +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/workflows/buildkite.yml +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/workflows/github-actions.yml +0 -0
- {socketsecurity-2.11.12 → socketsecurity-2.11.13}/workflows/gitlab-ci.yml +0 -0
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.11.13
|
|
4
|
+
|
|
5
|
+
### Changed: `--repo` takes a repository slug
|
|
6
|
+
|
|
7
|
+
- `--repo` takes the repository slug without its owner (`my-repo`, not
|
|
8
|
+
`my-org/my-repo`). A value containing `/` now exits `1` and names the slug to
|
|
9
|
+
use. Pass the owner with `--workspace`.
|
|
10
|
+
|
|
11
|
+
### Fixed: manifest links in pull request comments
|
|
12
|
+
|
|
13
|
+
- Manifest links in GitHub, GitLab and Bitbucket comments now include the
|
|
14
|
+
repository owner. When the CLI can't determine the owner, they link to the
|
|
15
|
+
Socket report instead.
|
|
16
|
+
|
|
17
|
+
### Deprecated: `--pending-head`
|
|
18
|
+
|
|
19
|
+
- `--pending-head` has no effect and logs a deprecation warning. Use
|
|
20
|
+
`--default-branch`.
|
|
21
|
+
|
|
22
|
+
### Docs: reachability network access
|
|
23
|
+
|
|
24
|
+
- Documented the hosts `--reach` needs: `api.socket.dev`,
|
|
25
|
+
`storage.googleapis.com` for the analysis engine download, and each scanned
|
|
26
|
+
ecosystem's package registry for dependency installs. Covers what fails when
|
|
27
|
+
each is blocked, including dependencies reported as `INSTALL ERROR` while the
|
|
28
|
+
scan still completes, and that the CLI and engine honor `HTTPS_PROXY`.
|
|
29
|
+
|
|
3
30
|
## 2.11.12
|
|
4
31
|
|
|
5
32
|
### Changed: bump pinned Coana CLI to 15.14.2
|
|
@@ -132,6 +159,9 @@ their changes ship here.
|
|
|
132
159
|
|
|
133
160
|
## 2.11.1
|
|
134
161
|
|
|
162
|
+
Version 2.11.0 was never published to PyPI or Docker Hub; its changes ship
|
|
163
|
+
here.
|
|
164
|
+
|
|
135
165
|
### Changed: bump pinned Coana CLI to 15.12.10
|
|
136
166
|
|
|
137
167
|
- Bumped the pinned reachability engine (the Coana CLI) from `15.12.8` to
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: socketsecurity
|
|
3
|
-
Version: 2.11.
|
|
3
|
+
Version: 2.11.13
|
|
4
4
|
Summary: Socket Security CLI for CI/CD
|
|
5
5
|
Project-URL: Homepage, https://socket.dev
|
|
6
6
|
Author-email: Douglas Coburn <douglas@socket.dev>
|
|
@@ -46,17 +46,17 @@ Requires-Dist: python-dotenv==1.2.4
|
|
|
46
46
|
Requires-Dist: requests==2.34.2
|
|
47
47
|
Requires-Dist: socketdev==3.6.2
|
|
48
48
|
Provides-Extra: dev
|
|
49
|
-
Requires-Dist: hatch==1.18.
|
|
49
|
+
Requires-Dist: hatch==1.18.2; extra == 'dev'
|
|
50
50
|
Requires-Dist: pre-commit==4.7.0; extra == 'dev'
|
|
51
|
-
Requires-Dist: ruff==0.17.
|
|
51
|
+
Requires-Dist: ruff==0.17.3; extra == 'dev'
|
|
52
52
|
Requires-Dist: twine==7.0.0; extra == 'dev'
|
|
53
|
-
Requires-Dist: uv==0.13.
|
|
53
|
+
Requires-Dist: uv==0.13.6; extra == 'dev'
|
|
54
54
|
Provides-Extra: test
|
|
55
|
-
Requires-Dist: pytest-asyncio==1.4.
|
|
55
|
+
Requires-Dist: pytest-asyncio==1.4.1; extra == 'test'
|
|
56
56
|
Requires-Dist: pytest-cov==7.1.0; extra == 'test'
|
|
57
57
|
Requires-Dist: pytest-mock==3.17.0; extra == 'test'
|
|
58
58
|
Requires-Dist: pytest-watch==4.2.0; extra == 'test'
|
|
59
|
-
Requires-Dist: pytest==9.
|
|
59
|
+
Requires-Dist: pytest==9.2.0; extra == 'test'
|
|
60
60
|
Description-Content-Type: text/markdown
|
|
61
61
|
|
|
62
62
|
# Socket Security CLI
|
|
@@ -154,7 +154,7 @@ These are two full-scan uploads, two server-side graphs, and two repository head
|
|
|
154
154
|
**Generate GitLab Security Dashboard report:**
|
|
155
155
|
```bash
|
|
156
156
|
socketcli --enable-gitlab-security \
|
|
157
|
-
--repo
|
|
157
|
+
--repo my-repo \
|
|
158
158
|
--target-path .
|
|
159
159
|
```
|
|
160
160
|
|
|
@@ -167,7 +167,7 @@ This will:
|
|
|
167
167
|
**Save SARIF report to file (e.g. for GitHub Code Scanning, SonarQube, or VS Code):**
|
|
168
168
|
```bash
|
|
169
169
|
socketcli --sarif-file results.sarif \
|
|
170
|
-
--repo
|
|
170
|
+
--repo my-repo \
|
|
171
171
|
--target-path .
|
|
172
172
|
```
|
|
173
173
|
|
|
@@ -176,7 +176,7 @@ socketcli --sarif-file results.sarif \
|
|
|
176
176
|
socketcli --enable-json \
|
|
177
177
|
--sarif-file results.sarif \
|
|
178
178
|
--enable-gitlab-security \
|
|
179
|
-
--repo
|
|
179
|
+
--repo my-repo
|
|
180
180
|
```
|
|
181
181
|
|
|
182
182
|
This will simultaneously generate:
|
|
@@ -212,7 +212,7 @@ socketcli [-h] [--api-token API_TOKEN] [--repo REPO] [--workspace WORKSPACE] [--
|
|
|
212
212
|
[--base-scan-id BASE_SCAN_ID | --base-commit-sha BASE_COMMIT_SHA]
|
|
213
213
|
[--target-path TARGET_PATH] [--sbom-file SBOM_FILE] [--license-file-name LICENSE_FILE_NAME] [--save-submitted-files-list SAVE_SUBMITTED_FILES_LIST]
|
|
214
214
|
[--save-manifest-tar SAVE_MANIFEST_TAR] [--files FILES] [--sub-path SUB_PATH] [--workspace-name WORKSPACE_NAME]
|
|
215
|
-
[--excluded-ecosystems EXCLUDED_ECOSYSTEMS] [--exclude-paths EXCLUDE_PATHS] [--include-dirs INCLUDE_DIRS] [--default-branch] [--
|
|
215
|
+
[--excluded-ecosystems EXCLUDED_ECOSYSTEMS] [--exclude-paths EXCLUDE_PATHS] [--include-dirs INCLUDE_DIRS] [--default-branch] [--generate-license] [--enable-debug]
|
|
216
216
|
[--enable-json] [--enable-sarif] [--sarif-file <path>] [--sarif-scope {diff,full}] [--sarif-grouping {instance,alert}] [--sarif-reachability {all,reachable,potentially,reachable-or-potentially}] [--enable-gitlab-security] [--gitlab-security-file <path>]
|
|
217
217
|
[--disable-overview] [--exclude-license-details] [--allow-unverified] [--disable-security-issue]
|
|
218
218
|
[--ignore-commit-files] [--disable-blocking] [--disable-ignore] [--enable-diff] [--scm SCM] [--timeout TIMEOUT] [--include-module-folders]
|
|
@@ -235,7 +235,7 @@ If you don't want to provide the Socket API Token every time then you can use th
|
|
|
235
235
|
#### Repository
|
|
236
236
|
| Parameter | Required | Default | Description |
|
|
237
237
|
|:-----------------|:---------|:--------|:------------------------------------------------------------------------------------------------------------------|
|
|
238
|
-
| `--repo` | False | *auto* | Repository
|
|
238
|
+
| `--repo` | False | *auto* | Repository slug in Socket, without the owner: `my-repo`, not `my-org/my-repo`. Auto-detected from the git remote. A value containing `/` is rejected; use `--workspace` for the owner. |
|
|
239
239
|
| `--workspace` | False | | The Socket workspace to associate the scan with (e.g. `my-org` in `my-org/my-repo`). See note below. |
|
|
240
240
|
| `--repo-is-public` | False | False | If set, flags a new repository creation as public. Defaults to false. |
|
|
241
241
|
| `--integration` | False | api | Integration type (api, github, gitlab, azure, bitbucket). When omitted, `--scm github` or `--scm gitlab` implies the matching integration. |
|
|
@@ -308,7 +308,6 @@ If you don't want to provide the Socket API Token every time then you can use th
|
|
|
308
308
|
| Parameter | Required | Default | Description |
|
|
309
309
|
|:-------------------------|:---------|:--------|:------------------------------------------------------------------------------------------------------|
|
|
310
310
|
| `--default-branch` | False | *auto* | Make this branch the default branch (auto-detected from git and CI environment when not specified) |
|
|
311
|
-
| `--pending-head` | False | *auto* | If true, the new scan will be set as the branch's head scan (automatically synced with default-branch) |
|
|
312
311
|
| `--include-module-folders` | False | False | If enabled, re-includes the JS/TS module folders (`node_modules`, `bower_components`, `jspm_packages`) in manifest discovery. For other excluded directories, use `--include-dirs`. |
|
|
313
312
|
|
|
314
313
|
#### Output Configuration
|
|
@@ -366,6 +365,20 @@ The Python CLI verifies the following **up front** (before invoking the analysis
|
|
|
366
365
|
|
|
367
366
|
Separately, the analysis engine (coana) needs the **per-ecosystem build toolchain** for whatever languages your project uses — e.g. a compatible Python interpreter (3.11+, or PyPy) for Python, a JDK for Java/Kotlin/Scala, .NET 6+ for C#, the matching Go toolchain for Go, etc. These are validated by the engine **at analysis time** (the CLI does not pre-check them) and that validation can be skipped with `--reach-disable-external-tool-checks`.
|
|
368
367
|
|
|
368
|
+
**Reachability network access:**
|
|
369
|
+
|
|
370
|
+
`--reach` downloads the analysis engine on first use and installs your project's dependencies to analyze them. On a restricted network, allow:
|
|
371
|
+
|
|
372
|
+
| Host | Used for | If blocked |
|
|
373
|
+
|---|---|---|
|
|
374
|
+
| `api.socket.dev` | Socket API calls, and a signed URL for the engine download | The CLI fails |
|
|
375
|
+
| `storage.googleapis.com` | Downloading the engine and its analyzers (about 120 MB) | The CLI exits with code **3**: `Failed to run reachability analysis: HTTPSConnectionPool(host='storage.googleapis.com', ...)` |
|
|
376
|
+
| The package registry of each scanned ecosystem, for example `registry.npmjs.org` | Installing your project's dependencies for analysis | The scan still completes, but the affected vulnerabilities are reported as `INSTALL ERROR` with no reachability result |
|
|
377
|
+
|
|
378
|
+
The engine comes from Socket, not npm, so an npm mirror or registry proxy does not cover the engine download. The registry row does not apply when your dependencies are already installed in the target path, for example a `node_modules` directory from an earlier `npm ci`. The engine is cached as described below; with a warm cache, `storage.googleapis.com` is not contacted.
|
|
379
|
+
|
|
380
|
+
Behind an HTTP(S) proxy, set `HTTPS_PROXY`. The CLI, the engine download and the engine itself all send their requests through it.
|
|
381
|
+
|
|
369
382
|
**Reachability analysis types:**
|
|
370
383
|
|
|
371
384
|
Socket's reachability analysis comes in three forms, referred to by their full names rather than the older "Tier" numbering:
|
|
@@ -551,7 +564,7 @@ export SOCKET_SLACK_BOT_TOKEN="xoxb-your-bot-token-here"
|
|
|
551
564
|
|
|
552
565
|
Webhook mode (`url_configs`):
|
|
553
566
|
- `reachability_alerts_only` (boolean, default: false): When `--reach` is enabled, only send reachable vulnerabilities from the selected diff alert set (uses reachability facts when available; otherwise falls back to blocking-status behavior)
|
|
554
|
-
- `repos` (array): Only send alerts for specific repositories (e.g., `["
|
|
567
|
+
- `repos` (array): Only send alerts for specific repositories, matched against the `--repo` slug without the owner (e.g., `["my-repo1", "my-repo2"]`)
|
|
555
568
|
- `alert_types` (array): Only send specific alert types (e.g., `["malware", "typosquat"]`)
|
|
556
569
|
- `severities` (array): Only send alerts with specific severities (e.g., `["high", "critical"]`)
|
|
557
570
|
|
|
@@ -683,7 +696,7 @@ The CLI uses intelligent default branch detection with the following priority:
|
|
|
683
696
|
3. **Git repository analysis**: Compares current branch with repository's default branch
|
|
684
697
|
4. **Fallback**: Defaults to `false` if none of the above methods succeed
|
|
685
698
|
|
|
686
|
-
|
|
699
|
+
A scan on the default branch also becomes that branch's head scan. `--pending-head` is deprecated and has no effect: it is still accepted so existing pipelines keep working, but it logs a warning. Use `--default-branch` instead.
|
|
687
700
|
|
|
688
701
|
## Who can ignore an alert
|
|
689
702
|
|
|
@@ -763,7 +776,7 @@ Socket CLI can generate reports compatible with GitLab's Security Dashboard, all
|
|
|
763
776
|
To generate a GitLab-compatible security report:
|
|
764
777
|
|
|
765
778
|
```bash
|
|
766
|
-
socketcli --enable-gitlab-security --repo
|
|
779
|
+
socketcli --enable-gitlab-security --repo my-repo
|
|
767
780
|
```
|
|
768
781
|
|
|
769
782
|
This creates a `gl-dependency-scanning-report.json` file following GitLab's Dependency Scanning report schema.
|
|
@@ -782,7 +795,7 @@ socket_security_scan:
|
|
|
782
795
|
script:
|
|
783
796
|
- socketcli
|
|
784
797
|
--api-token $SOCKET_API_TOKEN
|
|
785
|
-
--repo $
|
|
798
|
+
--repo $CI_PROJECT_NAME
|
|
786
799
|
--branch $CI_COMMIT_REF_NAME
|
|
787
800
|
--commit-sha $CI_COMMIT_SHA
|
|
788
801
|
--enable-gitlab-security
|
|
@@ -36,6 +36,12 @@ total before assuming either path is at fault.
|
|
|
36
36
|
- In `--sarif-scope full` with `--sarif-file`, SARIF JSON is written to file and stdout JSON is suppressed.
|
|
37
37
|
- `--sarif-grouping alert` currently applies to `--sarif-scope full`.
|
|
38
38
|
|
|
39
|
+
## Reachability on a restricted network
|
|
40
|
+
|
|
41
|
+
- `Failed to run reachability analysis: HTTPSConnectionPool(host='storage.googleapis.com', ...)`: the engine download is blocked. Allow `storage.googleapis.com`, or set `HTTPS_PROXY`. An npm mirror does not cover it.
|
|
42
|
+
- Every vulnerability reported as `INSTALL ERROR`: the engine could not install your dependencies. Allow the ecosystem's package registry, or install dependencies in the target path before running `--reach`.
|
|
43
|
+
- See **Reachability network access** in the [CLI reference](cli-reference.md) for the full list of hosts.
|
|
44
|
+
|
|
39
45
|
## Dashboard vs CLI result counts
|
|
40
46
|
|
|
41
47
|
Differences in result counts can be valid, even when filtering appears similar.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
[build-system]
|
|
2
2
|
requires = [
|
|
3
|
-
"hatchling==1.
|
|
3
|
+
"hatchling==1.33.0"
|
|
4
4
|
]
|
|
5
5
|
build-backend = "hatchling.build"
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "socketsecurity"
|
|
9
|
-
version = "2.11.
|
|
9
|
+
version = "2.11.13"
|
|
10
10
|
requires-python = ">= 3.11"
|
|
11
11
|
license = {"file" = "LICENSE"}
|
|
12
12
|
dependencies = [
|
|
@@ -44,18 +44,18 @@ classifiers = [
|
|
|
44
44
|
|
|
45
45
|
[project.optional-dependencies]
|
|
46
46
|
test = [
|
|
47
|
-
"pytest==9.
|
|
47
|
+
"pytest==9.2.0",
|
|
48
48
|
"pytest-cov==7.1.0",
|
|
49
49
|
"pytest-mock==3.17.0",
|
|
50
|
-
"pytest-asyncio==1.4.
|
|
50
|
+
"pytest-asyncio==1.4.1",
|
|
51
51
|
"pytest-watch==4.2.0"
|
|
52
52
|
]
|
|
53
53
|
dev = [
|
|
54
|
-
"ruff==0.17.
|
|
54
|
+
"ruff==0.17.3",
|
|
55
55
|
"twine==7.0.0", # for building
|
|
56
|
-
"uv==0.13.
|
|
56
|
+
"uv==0.13.6", # for dependency management
|
|
57
57
|
"pre-commit==4.7.0",
|
|
58
|
-
"hatch==1.18.
|
|
58
|
+
"hatch==1.18.2"
|
|
59
59
|
]
|
|
60
60
|
|
|
61
61
|
[project.scripts]
|
|
@@ -197,6 +197,8 @@ class CliConfig:
|
|
|
197
197
|
sub_paths: List[str] = field(default_factory=list)
|
|
198
198
|
workspace_name: Optional[str] = None
|
|
199
199
|
workspace: Optional[str] = None
|
|
200
|
+
# Web URL of the scanned repository, resolved at runtime; see resolve_repository_url.
|
|
201
|
+
repository_url: Optional[str] = None
|
|
200
202
|
# Reachability Flags
|
|
201
203
|
reach: bool = False
|
|
202
204
|
reach_version: Optional[str] = None
|
|
@@ -448,6 +450,22 @@ class CliConfig:
|
|
|
448
450
|
logging.error("--workspace-name requires --sub-path to be specified")
|
|
449
451
|
exit(1)
|
|
450
452
|
|
|
453
|
+
# The API validates the repo as a slug, which can't contain "/", so an
|
|
454
|
+
# owner/repo value would otherwise fail later at repository creation.
|
|
455
|
+
if args.repo and "/" in args.repo:
|
|
456
|
+
suggested = args.repo.rstrip("/").rsplit("/", 1)[-1]
|
|
457
|
+
logging.error(
|
|
458
|
+
f"--repo takes the repository slug without its owner, but got '{args.repo}'. "
|
|
459
|
+
f"Use --repo {suggested}, and --workspace for the owner if your repositories use one."
|
|
460
|
+
)
|
|
461
|
+
exit(1)
|
|
462
|
+
|
|
463
|
+
if args.pending_head:
|
|
464
|
+
logging.warning(
|
|
465
|
+
"--pending-head is deprecated and has no effect. A scan becomes the head scan "
|
|
466
|
+
"when it runs on the default branch; use --default-branch to mark it as such."
|
|
467
|
+
)
|
|
468
|
+
|
|
451
469
|
# argparse only enforces the mutually exclusive group for real CLI args;
|
|
452
470
|
# this also catches both values arriving via a --config file.
|
|
453
471
|
if args.base_scan_id and args.base_commit_sha:
|
|
@@ -527,8 +545,11 @@ def create_argument_parser() -> argparse.ArgumentParser:
|
|
|
527
545
|
repo_group = parser.add_argument_group('Repository')
|
|
528
546
|
repo_group.add_argument(
|
|
529
547
|
"--repo",
|
|
530
|
-
metavar="<
|
|
531
|
-
help=
|
|
548
|
+
metavar="<repo>",
|
|
549
|
+
help=(
|
|
550
|
+
"Repository slug in Socket, without the owner (e.g. my-repo, not my-org/my-repo). "
|
|
551
|
+
"Defaults to the git remote's repository name. Use --workspace for the owner."
|
|
552
|
+
),
|
|
532
553
|
required=False
|
|
533
554
|
)
|
|
534
555
|
repo_group.add_argument(
|
|
@@ -743,11 +764,12 @@ def create_argument_parser() -> argparse.ArgumentParser:
|
|
|
743
764
|
action="store_true",
|
|
744
765
|
help=argparse.SUPPRESS
|
|
745
766
|
)
|
|
767
|
+
# Deprecated no-op, still accepted so existing pipelines don't fail to parse.
|
|
746
768
|
config_group.add_argument(
|
|
747
769
|
"--pending-head",
|
|
748
770
|
dest="pending_head",
|
|
749
771
|
action="store_true",
|
|
750
|
-
help=
|
|
772
|
+
help=argparse.SUPPRESS
|
|
751
773
|
)
|
|
752
774
|
config_group.add_argument(
|
|
753
775
|
"--ignore-authorization",
|
|
@@ -74,8 +74,10 @@ class Git:
|
|
|
74
74
|
log.debug(f"Commit committer: {self.commit.committer.name} <{self.commit.committer.email}>")
|
|
75
75
|
|
|
76
76
|
# Extract repository name from git remote, with fallback to default
|
|
77
|
+
self.remote_url: str | None = None
|
|
77
78
|
try:
|
|
78
79
|
remote_url = self.repo.remotes.origin.url
|
|
80
|
+
self.remote_url = remote_url
|
|
79
81
|
self.repo_name = remote_url.split('.git')[0].split('/')[-1]
|
|
80
82
|
log.debug(f"Repository name detected from git remote: {self.repo_name}")
|
|
81
83
|
except Exception as error:
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import logging
|
|
3
|
-
import os
|
|
4
3
|
import re
|
|
5
4
|
import uuid
|
|
6
5
|
from datetime import datetime, timezone
|
|
@@ -94,30 +93,12 @@ class Messages:
|
|
|
94
93
|
|
|
95
94
|
# Generate URL based on SCM type using config information
|
|
96
95
|
# NEVER use diff.diff_url for SCM URLs - those are Socket URLs for "View report" links
|
|
97
|
-
if
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return f"{github_server}/{config.repo}/blob/{branch}/{clean_path}"
|
|
104
|
-
|
|
105
|
-
elif scm_type == "gitlab":
|
|
106
|
-
if config and hasattr(config, 'repo') and config.repo:
|
|
107
|
-
# Get branch from config, default to main
|
|
108
|
-
branch = getattr(config, 'branch', 'main') if hasattr(config, 'branch') and config.branch else 'main'
|
|
109
|
-
# Construct GitLab URL from repo info (could be gitlab.com or self-hosted GitLab)
|
|
110
|
-
gitlab_server = os.getenv('CI_SERVER_URL', 'https://gitlab.com')
|
|
111
|
-
return f"{gitlab_server}/{config.repo}/-/blob/{branch}/{clean_path}"
|
|
112
|
-
|
|
113
|
-
elif scm_type == "bitbucket":
|
|
114
|
-
if config and hasattr(config, 'repo') and config.repo:
|
|
115
|
-
# Get branch from config, default to main
|
|
116
|
-
branch = getattr(config, 'branch', 'main') if hasattr(config, 'branch') and config.branch else 'main'
|
|
117
|
-
# Construct Bitbucket URL from repo info (could be bitbucket.org or Bitbucket Server)
|
|
118
|
-
bitbucket_server = os.getenv('BITBUCKET_SERVER_URL', 'https://bitbucket.org')
|
|
119
|
-
return f"{bitbucket_server}/{config.repo}/src/{branch}/{clean_path}"
|
|
120
|
-
|
|
96
|
+
repository_url = getattr(config, 'repository_url', None) if config else None
|
|
97
|
+
if repository_url and scm_type in ("github", "gitlab", "bitbucket"):
|
|
98
|
+
branch = getattr(config, 'branch', None) or 'main'
|
|
99
|
+
blob_path = {"github": "blob", "gitlab": "-/blob", "bitbucket": "src"}[scm_type]
|
|
100
|
+
return f"{repository_url}/{blob_path}/{branch}/{clean_path}"
|
|
101
|
+
|
|
121
102
|
# Fallback to Socket file view for API or unknown repository types
|
|
122
103
|
if hasattr(diff, 'report_url') and diff.report_url:
|
|
123
104
|
# Strip leading slash and URL encode for Socket dashboard
|
|
@@ -59,8 +59,10 @@ def _github_number(env: Mapping[str, str]) -> int:
|
|
|
59
59
|
return parse_pull_request_number(match.group(1)) if match else 0
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
def
|
|
63
|
-
|
|
62
|
+
def _github_repository_url(
|
|
63
|
+
repo: Optional[str], env: Mapping[str, str], remote_url: Optional[str] = None
|
|
64
|
+
) -> Optional[str]:
|
|
65
|
+
remote_host, remote_path = parse_git_remote(env.get("BUILDKITE_REPO") or remote_url)
|
|
64
66
|
# config.repo is only ever a bare repository name, so it cannot produce a
|
|
65
67
|
# slug on its own; it is kept last for callers that pass a full owner/repo.
|
|
66
68
|
repository = env.get("GITHUB_REPOSITORY") or remote_path or repo
|
|
@@ -71,13 +73,15 @@ def _github_url(number: int, repo: Optional[str], env: Mapping[str, str]) -> Opt
|
|
|
71
73
|
or (_http_url(f"https://{remote_host}") if remote_host else None)
|
|
72
74
|
or "https://github.com"
|
|
73
75
|
)
|
|
74
|
-
return f"{server}/{repository.strip('/')}
|
|
76
|
+
return f"{server}/{repository.strip('/')}"
|
|
75
77
|
|
|
76
78
|
|
|
77
|
-
def
|
|
79
|
+
def _gitlab_project_url(
|
|
80
|
+
repo: Optional[str], env: Mapping[str, str], remote_url: Optional[str] = None
|
|
81
|
+
) -> Optional[str]:
|
|
78
82
|
project_url = _repository_url(env.get("CI_PROJECT_URL"))
|
|
79
83
|
if not project_url:
|
|
80
|
-
remote_host, remote_path = parse_git_remote(env.get("BUILDKITE_REPO"))
|
|
84
|
+
remote_host, remote_path = parse_git_remote(env.get("BUILDKITE_REPO") or remote_url)
|
|
81
85
|
project_path = env.get("CI_PROJECT_PATH") or remote_path or repo
|
|
82
86
|
server = (
|
|
83
87
|
_http_url(env.get("CI_SERVER_URL"))
|
|
@@ -85,6 +89,66 @@ def _gitlab_url(number: int, repo: Optional[str], env: Mapping[str, str]) -> Opt
|
|
|
85
89
|
)
|
|
86
90
|
if server and project_path and "/" in project_path:
|
|
87
91
|
project_url = f"{server}/{project_path.strip('/')}"
|
|
92
|
+
return project_url
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def _bitbucket_repository_url(
|
|
96
|
+
repo: Optional[str], env: Mapping[str, str], remote_url: Optional[str] = None
|
|
97
|
+
) -> Optional[str]:
|
|
98
|
+
remote_host, remote_path = parse_git_remote(remote_url)
|
|
99
|
+
repository = env.get("BITBUCKET_REPO_FULL_NAME") or remote_path or repo
|
|
100
|
+
if not repository or "/" not in repository:
|
|
101
|
+
return None
|
|
102
|
+
server = (
|
|
103
|
+
_http_url(env.get("BITBUCKET_SERVER_URL"))
|
|
104
|
+
or (_http_url(f"https://{remote_host}") if remote_host else None)
|
|
105
|
+
or "https://bitbucket.org"
|
|
106
|
+
)
|
|
107
|
+
return f"{server}/{repository.strip('/')}"
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def resolve_repository_url(
|
|
111
|
+
scm: Optional[str],
|
|
112
|
+
repo: Optional[str] = None,
|
|
113
|
+
env: Optional[Mapping[str, str]] = None,
|
|
114
|
+
remote_url: Optional[str] = None,
|
|
115
|
+
) -> Optional[str]:
|
|
116
|
+
"""Return the web URL of the scanned repository, such as ``https://github.com/owner/repo``.
|
|
117
|
+
|
|
118
|
+
The CI environment wins, then the checkout's ``origin`` remote. ``None`` means the
|
|
119
|
+
owner could not be determined: ``config.repo`` is the Socket repository slug,
|
|
120
|
+
which has no owner, so a link built from it alone would point nowhere.
|
|
121
|
+
"""
|
|
122
|
+
environment = env or {}
|
|
123
|
+
provider = str(scm or "").lower()
|
|
124
|
+
if provider == "github":
|
|
125
|
+
return _github_repository_url(repo, environment, remote_url)
|
|
126
|
+
if provider == "gitlab":
|
|
127
|
+
return _gitlab_project_url(repo, environment, remote_url)
|
|
128
|
+
if provider == "bitbucket":
|
|
129
|
+
return _bitbucket_repository_url(repo, environment, remote_url)
|
|
130
|
+
return None
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
def repository_owner(repository_url: Optional[str]) -> str:
|
|
134
|
+
"""Return everything before the repository name in ``repository_url``'s path.
|
|
135
|
+
|
|
136
|
+
That is the owner on GitHub and Bitbucket, and the full group path on GitLab,
|
|
137
|
+
where projects can be nested under subgroups.
|
|
138
|
+
"""
|
|
139
|
+
if not repository_url:
|
|
140
|
+
return ""
|
|
141
|
+
path = urlparse(repository_url).path.strip("/")
|
|
142
|
+
return path.rsplit("/", 1)[0] if "/" in path else ""
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def _github_url(number: int, repo: Optional[str], env: Mapping[str, str]) -> Optional[str]:
|
|
146
|
+
repository_url = _github_repository_url(repo, env)
|
|
147
|
+
return f"{repository_url}/pull/{number}" if repository_url else None
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def _gitlab_url(number: int, repo: Optional[str], env: Mapping[str, str]) -> Optional[str]:
|
|
151
|
+
project_url = _gitlab_project_url(repo, env)
|
|
88
152
|
return f"{project_url}/-/merge_requests/{number}" if project_url else None
|
|
89
153
|
|
|
90
154
|
|
|
@@ -22,7 +22,9 @@ from socketsecurity.core.logging import initialize_logging, set_debug_mode
|
|
|
22
22
|
from socketsecurity.core.messages import Messages
|
|
23
23
|
from socketsecurity.core.pull_request import (
|
|
24
24
|
parse_pull_request_number,
|
|
25
|
+
repository_owner,
|
|
25
26
|
resolve_pull_request_context,
|
|
27
|
+
resolve_repository_url,
|
|
26
28
|
)
|
|
27
29
|
from socketsecurity.core.scm_comments import Comments
|
|
28
30
|
from socketsecurity.core.socket_config import SocketConfig, module_folder_dirs
|
|
@@ -601,6 +603,12 @@ def main_code():
|
|
|
601
603
|
from socketsecurity.core.scm.gitlab import Gitlab, GitlabConfig
|
|
602
604
|
gitlab_config = GitlabConfig.from_env()
|
|
603
605
|
scm = Gitlab(client=client, config=gitlab_config, ignore_authorization=config.ignore_authorization)
|
|
606
|
+
config.repository_url = resolve_repository_url(
|
|
607
|
+
config.scm,
|
|
608
|
+
config.repo,
|
|
609
|
+
os.environ,
|
|
610
|
+
remote_url=getattr(git_repo, "remote_url", None) if is_repo else None,
|
|
611
|
+
)
|
|
604
612
|
# Don't override config.default_branch if it was explicitly set via --default-branch flag
|
|
605
613
|
# Only use SCM detection if --default-branch wasn't provided
|
|
606
614
|
if scm is not None and not config.default_branch:
|
|
@@ -806,7 +814,7 @@ def main_code():
|
|
|
806
814
|
"alert_action": "error",
|
|
807
815
|
"event_sender_created_at": now,
|
|
808
816
|
"vcs_provider": integration_type,
|
|
809
|
-
"owner": config.
|
|
817
|
+
"owner": repository_owner(config.repository_url),
|
|
810
818
|
"repo": config.repo,
|
|
811
819
|
"pr_number": pr_number,
|
|
812
820
|
"ignore_all": ignore_all,
|
|
@@ -881,7 +889,7 @@ def main_code():
|
|
|
881
889
|
"client_action": "ignore",
|
|
882
890
|
"event_sender_created_at": now,
|
|
883
891
|
"vcs_provider": integration_type,
|
|
884
|
-
"owner": config.
|
|
892
|
+
"owner": repository_owner(config.repository_url),
|
|
885
893
|
"repo": config.repo,
|
|
886
894
|
"pr_number": pr_number,
|
|
887
895
|
"ignore_all": c_ignore_all,
|
|
@@ -168,6 +168,34 @@ class TestCliConfigValidation:
|
|
|
168
168
|
assert config.sarif_reachability == "reachable"
|
|
169
169
|
|
|
170
170
|
|
|
171
|
+
class TestRepoAndPendingHeadFlags:
|
|
172
|
+
"""--repo takes a bare slug, and --pending-head is a deprecated no-op"""
|
|
173
|
+
|
|
174
|
+
@pytest.mark.parametrize("repo", ["my-org/my-repo", "group/sub/my-repo", "my-org/my-repo/"])
|
|
175
|
+
def test_repo_with_owner_exits_with_suggestion(self, repo, caplog):
|
|
176
|
+
with pytest.raises(SystemExit) as exc_info:
|
|
177
|
+
CliConfig.from_args(["--api-token", "test-token", "--repo", repo])
|
|
178
|
+
assert exc_info.value.code == 1
|
|
179
|
+
assert "Use --repo my-repo" in caplog.text
|
|
180
|
+
|
|
181
|
+
def test_repo_slug_is_accepted(self):
|
|
182
|
+
config = CliConfig.from_args(["--api-token", "test-token", "--repo", "my-repo"])
|
|
183
|
+
assert config.repo == "my-repo"
|
|
184
|
+
|
|
185
|
+
@pytest.mark.parametrize("flag", ["--pending-head", "--pending_head"])
|
|
186
|
+
def test_pending_head_is_accepted_with_a_deprecation_warning(self, flag, caplog):
|
|
187
|
+
config = CliConfig.from_args(["--api-token", "test-token", flag])
|
|
188
|
+
assert config.pending_head is True
|
|
189
|
+
assert "--pending-head is deprecated" in caplog.text
|
|
190
|
+
|
|
191
|
+
def test_help_hides_pending_head_and_shows_repo_slug(self, capsys):
|
|
192
|
+
with pytest.raises(SystemExit):
|
|
193
|
+
CliConfig.from_args(["--help"])
|
|
194
|
+
help_text = capsys.readouterr().out
|
|
195
|
+
assert "--pending-head" not in help_text
|
|
196
|
+
assert "--repo <repo>" in help_text
|
|
197
|
+
|
|
198
|
+
|
|
171
199
|
class TestBaseScanFlags:
|
|
172
200
|
"""Tests for the --base-scan-id / --base-commit-sha diff baseline overrides."""
|
|
173
201
|
|
|
@@ -66,7 +66,7 @@ def test_fossa_report_payload_vulnerability_shape_is_stable():
|
|
|
66
66
|
config = CliConfig.from_args([
|
|
67
67
|
"--api-token", "test",
|
|
68
68
|
"--legal-format", "fossa",
|
|
69
|
-
"--repo", "
|
|
69
|
+
"--repo", "widgets",
|
|
70
70
|
"--branch", "refs/heads/main",
|
|
71
71
|
])
|
|
72
72
|
diff = Diff(id="scan-123", report_url="https://socket.dev/report/123")
|
|
@@ -147,14 +147,14 @@ def test_fossa_report_payload_vulnerability_shape_is_stable():
|
|
|
147
147
|
def test_project_metadata_uses_dollar_revision_separator():
|
|
148
148
|
"""The composed FOSSA `project.id` is `<projectLocator>$<revision>`."""
|
|
149
149
|
from socketsecurity.fossa_compat import _build_project_metadata
|
|
150
|
-
config = CliConfig.from_args(["--api-token", "test", "--legal-format", "fossa", "--repo", "
|
|
150
|
+
config = CliConfig.from_args(["--api-token", "test", "--legal-format", "fossa", "--repo", "widgets", "--branch", "refs/heads/main"])
|
|
151
151
|
diff = Diff(id="scan-abc123", report_url="https://socket.dev/x")
|
|
152
152
|
project = _build_project_metadata(diff, config)
|
|
153
153
|
assert project == {
|
|
154
154
|
"branch": "refs/heads/main",
|
|
155
|
-
"id": "
|
|
156
|
-
"project": "
|
|
157
|
-
"projectId": "
|
|
155
|
+
"id": "widgets$scan-abc123",
|
|
156
|
+
"project": "widgets",
|
|
157
|
+
"projectId": "widgets",
|
|
158
158
|
"revision": "scan-abc123",
|
|
159
159
|
"url": "https://socket.dev/x",
|
|
160
160
|
}
|
|
@@ -311,10 +311,10 @@ def test_attribution_payload_top_level_is_5_keys():
|
|
|
311
311
|
|
|
312
312
|
def test_attribution_project_has_only_name_and_revision():
|
|
313
313
|
"""SBOM `project` is the 2-key subset, not the 6-key analyze project."""
|
|
314
|
-
config = CliConfig.from_args(["--api-token", "test", "--legal-format", "fossa", "--repo", "
|
|
314
|
+
config = CliConfig.from_args(["--api-token", "test", "--legal-format", "fossa", "--repo", "widgets"])
|
|
315
315
|
diff = Diff(id="rev-x")
|
|
316
316
|
payload = build_fossa_attribution_payload(diff, config)
|
|
317
|
-
assert payload["project"] == {"name": "
|
|
317
|
+
assert payload["project"] == {"name": "widgets", "revision": "rev-x"}
|
|
318
318
|
|
|
319
319
|
|
|
320
320
|
def test_attribution_empty_diff_yields_empty_collections():
|
|
@@ -79,3 +79,26 @@ def test_security_comment_omits_missing_patched_version():
|
|
|
79
79
|
comment = Messages.security_comment_template(diff)
|
|
80
80
|
|
|
81
81
|
assert "Patched version:" not in comment
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class _LinkConfig:
|
|
85
|
+
scm = "github"
|
|
86
|
+
branch = "main"
|
|
87
|
+
repository_url = "https://github.com/acme/widgets"
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def test_manifest_link_uses_the_full_repository_url():
|
|
91
|
+
url = Messages.get_manifest_file_url(Diff(), "app/package.json", _LinkConfig())
|
|
92
|
+
|
|
93
|
+
assert url == "https://github.com/acme/widgets/blob/main/app/package.json"
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def test_manifest_link_falls_back_to_the_report_without_a_repository_url():
|
|
97
|
+
"""A bare slug has no owner, so the link goes to the Socket report instead."""
|
|
98
|
+
config = _LinkConfig()
|
|
99
|
+
config.repository_url = None
|
|
100
|
+
diff = Diff(report_url="https://socket.dev/report/123")
|
|
101
|
+
|
|
102
|
+
url = Messages.get_manifest_file_url(diff, "app/package.json", config)
|
|
103
|
+
|
|
104
|
+
assert url == "https://socket.dev/report/123?tab=files&file=app%2Fpackage.json"
|
|
@@ -376,11 +376,11 @@ class TestExtractReportUrl:
|
|
|
376
376
|
class _RepoConfig(_FakeConfig):
|
|
377
377
|
"""A config that reaches the branch which embeds the path verbatim.
|
|
378
378
|
|
|
379
|
-
Without
|
|
380
|
-
Socket link, and the path never lands in the comment -- so a
|
|
381
|
-
bare config asserts nothing.
|
|
379
|
+
Without repository_url/branch, get_manifest_file_url returns "" or a
|
|
380
|
+
percent-encoded Socket link, and the path never lands in the comment -- so a
|
|
381
|
+
test using the bare config asserts nothing.
|
|
382
382
|
"""
|
|
383
|
-
|
|
383
|
+
repository_url: str = "https://github.com/acme/widgets"
|
|
384
384
|
branch: str = "main"
|
|
385
385
|
|
|
386
386
|
|