socketsecurity 2.6.5__tar.gz → 2.6.6__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.6.5 → socketsecurity-2.6.6}/.github/workflows/pr-preview.yml +10 -2
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/CHANGELOG.md +21 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/PKG-INFO +1 -1
- socketsecurity-2.6.6/benchmarks/manifest_discovery.py +101 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/docs/ci-cd.md +13 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/docs/troubleshooting.md +29 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/pyproject.toml +1 -1
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/__init__.py +1 -1
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/__init__.py +331 -70
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/git_interface.py +203 -68
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/scm/github.py +87 -12
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/streaming.py +6 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/socketcli.py +29 -13
- socketsecurity-2.6.6/tests/core/test_diff_scan_polling.py +274 -0
- socketsecurity-2.6.6/tests/unit/test_git_interface.py +251 -0
- socketsecurity-2.6.6/tests/unit/test_github_buildkite_config.py +173 -0
- socketsecurity-2.6.6/tests/unit/test_manifest_discovery.py +349 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_streaming.py +10 -5
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/uv.lock +1 -1
- socketsecurity-2.6.5/tests/core/test_diff_scan_polling.py +0 -122
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/.github/CODEOWNERS +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/.github/PULL_REQUEST_TEMPLATE/bug-fix.md +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/.github/PULL_REQUEST_TEMPLATE/improvement.md +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/.github/actions/setup-docker/action.yml +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/.github/actions/setup-hatch/action.yml +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/.github/actions/setup-sfw/action.yml +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/.github/dependabot.yml +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/.github/workflows/dependency-review.yml +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/.github/workflows/docker-stable.yml +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/.github/workflows/e2e-test.yml +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/.github/workflows/package-check.yml +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/.github/workflows/python-tests.yml +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/.github/workflows/release.yml +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/.github/workflows/version-check.yml +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/.github/zizmor.yml +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/.gitignore +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/.hooks/sync_version.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/.pre-commit-config.yaml +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/.python-version +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/CONTRIBUTING.md +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/Dockerfile +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/Dockerfile.preview +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/LICENSE +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/Makefile +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/README.md +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/docs/cli-reference.md +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/docs/development.md +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/examples/config/sarif-dashboard-parity.json +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/examples/config/sarif-dashboard-parity.toml +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/examples/config/sarif-diff-ci-cd.json +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/examples/config/sarif-diff-ci-cd.toml +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/examples/config/sarif-instance-detail.json +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/examples/config/sarif-instance-detail.toml +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/instructions/gitlab-commit-status/uat.md +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/pytest.ini +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/scripts/build_container.sh +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/scripts/build_container_flexible.sh +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/scripts/deploy-test-docker.sh +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/scripts/deploy-test-pypi.sh +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/scripts/docker-entrypoint.sh +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/scripts/run.sh +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/session.md +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socket.yml +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/config.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/alert_selection.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/classes.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/cli_client.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/cli_run.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/exceptions.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/helper/__init__.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/helper/socket_facts_loader.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/lazy_file_loader.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/log_uploader.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/logging.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/messages.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/resource_utils.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/scm/__init__.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/scm/base.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/scm/client.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/scm/gitlab.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/scm_comments.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/socket_config.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/tools/reachability.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/core/utils.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/fossa_compat.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/output.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/plugins/__init__.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/plugins/base.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/plugins/formatters/__init__.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/plugins/formatters/slack.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/plugins/jira.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/plugins/manager.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/plugins/slack.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/plugins/teams.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/socketsecurity/plugins/webhook.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/__init__.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/core/conftest.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/core/create_diff_input.json +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/core/test_diff_alerts.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/core/test_diff_generation.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/core/test_facts_compression.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/core/test_has_manifest_files.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/core/test_package_and_alerts.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/core/test_sdk_methods.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/core/test_supporting_methods.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/data/fullscans/create_response.json +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/data/fullscans/diff/stream_diff.json +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/data/fullscans/diff/stream_diff_full.json +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/data/fullscans/head_scan/metadata.json +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/data/fullscans/head_scan/stream_scan.json +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/data/fullscans/head_scan/stream_scan_full.json +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/data/fullscans/new_scan/metadata.json +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/data/fullscans/new_scan/stream_scan.json +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/data/repos/repo_info_error.json +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/data/repos/repo_info_no_head.json +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/data/repos/repo_info_success.json +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/data/settings/security-policy.json +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/e2e/fixtures/simple-npm/index.js +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/e2e/fixtures/simple-npm/package.json +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/e2e/fixtures/simple-pypi/requirements.txt +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/e2e/reach-facts-probe.sh +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/e2e/validate-gitlab.sh +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/e2e/validate-json.sh +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/e2e/validate-reachability.sh +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/e2e/validate-sarif.sh +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/e2e/validate-scan.sh +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/fixtures/fossa/README.md +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/fixtures/fossa/fossa-analyze-empty.json +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/fixtures/fossa/fossa-analyze-populated.json +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/fixtures/fossa/fossa-sbom-empty-deep.json +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/fixtures/fossa/fossa-sbom-populated.json +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/__init__.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_alert_selection.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_cli_config.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_cli_run.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_client.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_config.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_dependency_overview.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_disable_ignore.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_exclude_paths.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_fossa_compat.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_fossa_parity.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_full_scan_retry.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_gitlab_auth.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_gitlab_auth_fallback.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_gitlab_commit_status.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_gitlab_format.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_ignore_telemetry_filtering.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_include_dirs.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_log_uploader.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_output.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_reachability.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_slack_plugin.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_socketcli.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/tests/unit/test_tier1_finalize.py +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/workflows/bitbucket-pipelines.yml +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/workflows/buildkite.yml +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/workflows/github-actions.yml +0 -0
- {socketsecurity-2.6.5 → socketsecurity-2.6.6}/workflows/gitlab-ci.yml +0 -0
|
@@ -254,17 +254,25 @@ jobs:
|
|
|
254
254
|
- name: Set up Docker publishing
|
|
255
255
|
uses: ./.github/actions/setup-docker
|
|
256
256
|
with:
|
|
257
|
-
|
|
257
|
+
# QEMU is required to build the arm64 layer on an amd64 runner.
|
|
258
|
+
enable-qemu: "true"
|
|
258
259
|
dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
259
260
|
dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
260
261
|
|
|
261
262
|
- name: Build and push Docker preview
|
|
262
263
|
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
|
|
263
264
|
with:
|
|
265
|
+
# Build from the checked-out workspace, not the default Git context. The
|
|
266
|
+
# wheel is only present here as a downloaded artifact, and this also keeps
|
|
267
|
+
# Dockerfile.preview on the default-branch checkout rather than the PR ref.
|
|
268
|
+
context: .
|
|
264
269
|
file: Dockerfile.preview
|
|
265
270
|
push: true
|
|
266
271
|
pull: true
|
|
267
|
-
|
|
272
|
+
# Match the arch matrix of the release and stable images so a preview is a
|
|
273
|
+
# drop-in replacement for socketdev/cli:latest on arm64 runners too. The
|
|
274
|
+
# arm64 layer builds under emulation, so expect roughly double the runtime.
|
|
275
|
+
platforms: linux/amd64,linux/arm64
|
|
268
276
|
tags: socketdev/cli:pr-${{ needs.context.outputs.pr_number }}
|
|
269
277
|
build-args: |
|
|
270
278
|
SDK_PREVIEW_VERSION=${{ inputs.sdk_preview_version }}
|
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.6.6
|
|
4
|
+
|
|
5
|
+
### Changed: faster local scan setup for large repositories
|
|
6
|
+
|
|
7
|
+
- Manifest discovery now uses one filesystem walk per scan root and prunes
|
|
8
|
+
excluded directories before descent.
|
|
9
|
+
- Pull request scans use local Git refs first and fetch only missing history.
|
|
10
|
+
Buildkite pull request metadata is now supported directly.
|
|
11
|
+
- Supported manifest patterns are cached per invocation, and discovered
|
|
12
|
+
manifests are reused during scan creation.
|
|
13
|
+
- Added timings for initialization, Git operations, changed-file detection,
|
|
14
|
+
pattern lookup, and manifest discovery.
|
|
15
|
+
|
|
16
|
+
### Changed: scan comparisons no longer fetch unused artifacts
|
|
17
|
+
|
|
18
|
+
- Scan comparisons omit unchanged artifacts unless an enabled output needs them.
|
|
19
|
+
- Diff scans poll more frequently and log identifiers and timing details for
|
|
20
|
+
easier troubleshooting.
|
|
21
|
+
- Documented the `diff-scans:create`, `diff-scans:list` and `full-scans:list`
|
|
22
|
+
token scopes required by the optimized comparison path.
|
|
23
|
+
|
|
3
24
|
## 2.6.5
|
|
4
25
|
|
|
5
26
|
### Changed: bump pinned @coana-tech/cli to 15.10.16
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Compare legacy per-pattern rglob discovery with the single-pass walker.
|
|
3
|
+
|
|
4
|
+
This is an opt-in developer benchmark, not a timing assertion in the test
|
|
5
|
+
suite. It creates a synthetic monorepo so filesystem or CI-agent changes do not
|
|
6
|
+
make regular tests flaky.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import argparse
|
|
10
|
+
import tempfile
|
|
11
|
+
import time
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
from types import SimpleNamespace
|
|
14
|
+
from unittest.mock import MagicMock
|
|
15
|
+
|
|
16
|
+
from socketsecurity.core import Core
|
|
17
|
+
from socketsecurity.core.socket_config import SocketConfig
|
|
18
|
+
from socketsecurity.core.utils import socket_globs
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def seed_tree(root: Path, directories: int, files_per_directory: int) -> None:
|
|
22
|
+
for directory_index in range(directories):
|
|
23
|
+
directory = root / "packages" / f"package-{directory_index:05d}"
|
|
24
|
+
directory.mkdir(parents=True)
|
|
25
|
+
(directory / "package.json").write_text("{}\n", encoding="utf-8")
|
|
26
|
+
for file_index in range(files_per_directory):
|
|
27
|
+
(directory / f"source-{file_index:03d}.txt").write_text(
|
|
28
|
+
"not a manifest\n",
|
|
29
|
+
encoding="utf-8",
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
# These trees model the expensive directories that the new walker prunes
|
|
33
|
+
# before descent rather than visiting once for every manifest pattern.
|
|
34
|
+
for excluded in (".git/objects", "node_modules/example", ".venv/site-packages"):
|
|
35
|
+
directory = root / excluded
|
|
36
|
+
directory.mkdir(parents=True)
|
|
37
|
+
for index in range(files_per_directory * 10):
|
|
38
|
+
(directory / f"object-{index:05d}").write_text("x", encoding="utf-8")
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def legacy_discover(root: Path) -> set[str]:
|
|
42
|
+
results = set()
|
|
43
|
+
excluded_dirs = SocketConfig(api_key="benchmark").excluded_dirs
|
|
44
|
+
for ecosystem_patterns in socket_globs.values():
|
|
45
|
+
for details in ecosystem_patterns.values():
|
|
46
|
+
for pattern in Core.expand_brace_pattern(details["pattern"]):
|
|
47
|
+
insensitive = Core.to_case_insensitive_regex(pattern)
|
|
48
|
+
for candidate in root.rglob(insensitive):
|
|
49
|
+
if candidate.is_file() and not Core.is_excluded(
|
|
50
|
+
str(candidate),
|
|
51
|
+
excluded_dirs,
|
|
52
|
+
):
|
|
53
|
+
results.add(candidate.as_posix())
|
|
54
|
+
return results
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def new_core() -> Core:
|
|
58
|
+
core = Core.__new__(Core)
|
|
59
|
+
core.config = SocketConfig(api_key="benchmark")
|
|
60
|
+
core.cli_config = SimpleNamespace(exclude_paths=None)
|
|
61
|
+
core.sdk = MagicMock()
|
|
62
|
+
core._supported_patterns = socket_globs
|
|
63
|
+
return core
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def timed(function, root: Path) -> tuple[set[str], float]:
|
|
67
|
+
start = time.perf_counter()
|
|
68
|
+
results = set(function(root))
|
|
69
|
+
return results, time.perf_counter() - start
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def main() -> None:
|
|
73
|
+
parser = argparse.ArgumentParser()
|
|
74
|
+
parser.add_argument("--directories", type=int, default=500)
|
|
75
|
+
parser.add_argument("--files-per-directory", type=int, default=20)
|
|
76
|
+
args = parser.parse_args()
|
|
77
|
+
|
|
78
|
+
with tempfile.TemporaryDirectory(prefix="socket-manifest-benchmark-") as temp:
|
|
79
|
+
root = Path(temp)
|
|
80
|
+
seed_tree(root, args.directories, args.files_per_directory)
|
|
81
|
+
legacy_results, legacy_seconds = timed(legacy_discover, root)
|
|
82
|
+
new_results, new_seconds = timed(
|
|
83
|
+
lambda path: new_core().find_files(str(path)),
|
|
84
|
+
root,
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
if legacy_results != new_results:
|
|
88
|
+
raise SystemExit(
|
|
89
|
+
"Manifest result mismatch: "
|
|
90
|
+
f"legacy={len(legacy_results)}, single_pass={len(new_results)}"
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
speedup = legacy_seconds / new_seconds if new_seconds else float("inf")
|
|
94
|
+
print(f"Manifests: {len(new_results)}")
|
|
95
|
+
print(f"Legacy per-pattern rglob: {legacy_seconds:.3f}s")
|
|
96
|
+
print(f"Single-pass walk: {new_seconds:.3f}s")
|
|
97
|
+
print(f"Speedup: {speedup:.1f}x")
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
if __name__ == "__main__":
|
|
101
|
+
main()
|
|
@@ -81,6 +81,19 @@ steps:
|
|
|
81
81
|
SOCKET_SECURITY_API_TOKEN: "${SOCKET_SECURITY_API_TOKEN}"
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
+
The CLI reads Buildkite's native `BUILDKITE_COMMIT`, `BUILDKITE_BRANCH`,
|
|
85
|
+
`BUILDKITE_PULL_REQUEST`, and `BUILDKITE_PULL_REQUEST_BASE_BRANCH` variables.
|
|
86
|
+
For pull-request builds, ensure the checkout contains the base branch and the
|
|
87
|
+
checked-out head commit. The CLI uses those local refs first and performs a
|
|
88
|
+
targeted fetch only when a required ref or its comparison history is missing;
|
|
89
|
+
it does not fetch every remote ref and tag during startup.
|
|
90
|
+
|
|
91
|
+
When `--scm github` is used from Buildkite, the CLI also derives GitHub comment
|
|
92
|
+
context from `BUILDKITE_REPO`, `BUILDKITE_BUILD_CHECKOUT_PATH`, and the variables
|
|
93
|
+
above. Set `GH_API_TOKEN` to a GitHub token with the required repository access.
|
|
94
|
+
GitHub Enterprise users should also set `GITHUB_API_URL`; GitHub.com defaults to
|
|
95
|
+
`https://api.github.com`.
|
|
96
|
+
|
|
84
97
|
#### Merge-base baselines in Buildkite (dynamic pipelines)
|
|
85
98
|
|
|
86
99
|
Notes for using `--base-commit-sha` (see the
|
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Troubleshooting
|
|
2
2
|
|
|
3
|
+
## API token scopes for scan comparisons
|
|
4
|
+
|
|
5
|
+
PR/MR runs compare the new scan against the repository's head scan. That comparison
|
|
6
|
+
first uses the diff-scans endpoints, which require an organization token with these
|
|
7
|
+
scopes in addition to whatever the scan itself needs:
|
|
8
|
+
|
|
9
|
+
- `diff-scans:create`
|
|
10
|
+
- `diff-scans:list`
|
|
11
|
+
- `full-scans:list`
|
|
12
|
+
|
|
13
|
+
If the token is missing them the scan still succeeds, so this is easy to miss. The only
|
|
14
|
+
signal is a warning, after which the CLI falls back to the older streaming comparison:
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
Diff scan comparison failed with APIAccessDenied(Insufficient permissions), falling back to the streaming scan comparison
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Grant the scopes to use the diff-scans path. It polls with short, bounded requests
|
|
21
|
+
rather than holding one connection open while the backend computes, which is what lets
|
|
22
|
+
large comparisons survive network idle timeouts — notably Azure NAT gateways, which
|
|
23
|
+
reap idle connections after four minutes and surface as an intermittent
|
|
24
|
+
`ConnectionResetError`.
|
|
25
|
+
|
|
26
|
+
The two paths can take noticeably different amounts of time on the same repository,
|
|
27
|
+
because cached diff-scan responses always embed per-package license details while the
|
|
28
|
+
streaming comparison requests a lean payload. On a large dependency tree, compare the
|
|
29
|
+
`Diff scan comparison ready in ...` timing against the `Diff Report Gathered in ...`
|
|
30
|
+
total before assuming either path is at fault.
|
|
31
|
+
|
|
3
32
|
## Common gotchas
|
|
4
33
|
|
|
5
34
|
- In diff scope, `--strict-blocking` uses a stricter alert set (`new + unchanged`) for blocking checks and diff-based output selection.
|