socketsecurity 2.2.26__tar.gz → 2.2.32__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.
Files changed (87) hide show
  1. socketsecurity-2.2.32/Dockerfile +102 -0
  2. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/PKG-INFO +4 -2
  3. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/README.md +2 -0
  4. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/pyproject.toml +2 -2
  5. socketsecurity-2.2.32/scripts/build_container_flexible.sh +161 -0
  6. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/__init__.py +1 -1
  7. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/config.py +30 -9
  8. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/core/scm/gitlab.py +13 -9
  9. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/core/tools/reachability.py +19 -1
  10. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/socketcli.py +12 -2
  11. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/uv.lock +9 -5
  12. socketsecurity-2.2.26/Dockerfile +0 -41
  13. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/.github/CODEOWNERS +0 -0
  14. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/.github/PULL_REQUEST_TEMPLATE/bug-fix.md +0 -0
  15. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -0
  16. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/.github/PULL_REQUEST_TEMPLATE/improvement.md +0 -0
  17. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  18. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/.github/workflows/docker-stable.yml +0 -0
  19. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/.github/workflows/pr-preview.yml +0 -0
  20. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/.github/workflows/release.yml +0 -0
  21. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/.github/workflows/version-check.yml +0 -0
  22. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/.gitignore +0 -0
  23. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/.hooks/sync_version.py +0 -0
  24. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/.pre-commit-config.yaml +0 -0
  25. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/.python-version +0 -0
  26. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/LICENSE +0 -0
  27. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/Makefile +0 -0
  28. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/docs/README.md +0 -0
  29. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/pytest.ini +0 -0
  30. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/scripts/build_container.sh +0 -0
  31. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/scripts/deploy-test-docker.sh +0 -0
  32. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/scripts/deploy-test-pypi.sh +0 -0
  33. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/scripts/run.sh +0 -0
  34. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/core/__init__.py +0 -0
  35. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/core/classes.py +0 -0
  36. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/core/cli_client.py +0 -0
  37. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/core/exceptions.py +0 -0
  38. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/core/git_interface.py +0 -0
  39. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/core/helper/__init__.py +0 -0
  40. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/core/lazy_file_loader.py +0 -0
  41. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/core/logging.py +0 -0
  42. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/core/messages.py +0 -0
  43. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/core/resource_utils.py +0 -0
  44. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/core/scm/__init__.py +0 -0
  45. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/core/scm/base.py +0 -0
  46. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/core/scm/client.py +0 -0
  47. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/core/scm/github.py +0 -0
  48. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/core/scm_comments.py +0 -0
  49. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/core/socket_config.py +0 -0
  50. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/core/utils.py +0 -0
  51. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/output.py +0 -0
  52. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/plugins/__init__.py +0 -0
  53. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/plugins/base.py +0 -0
  54. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/plugins/jira.py +0 -0
  55. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/plugins/manager.py +0 -0
  56. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/plugins/slack.py +0 -0
  57. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/plugins/teams.py +0 -0
  58. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/socketsecurity/plugins/webhook.py +0 -0
  59. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/__init__.py +0 -0
  60. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/core/conftest.py +0 -0
  61. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/core/create_diff_input.json +0 -0
  62. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/core/test_diff_generation.py +0 -0
  63. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/core/test_package_and_alerts.py +0 -0
  64. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/core/test_sdk_methods.py +0 -0
  65. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/core/test_supporting_methods.py +0 -0
  66. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/data/fullscans/create_response.json +0 -0
  67. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/data/fullscans/diff/stream_diff.json +0 -0
  68. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/data/fullscans/diff/stream_diff_full.json +0 -0
  69. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/data/fullscans/head_scan/metadata.json +0 -0
  70. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/data/fullscans/head_scan/stream_scan.json +0 -0
  71. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/data/fullscans/head_scan/stream_scan_full.json +0 -0
  72. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/data/fullscans/new_scan/metadata.json +0 -0
  73. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/data/fullscans/new_scan/stream_scan.json +0 -0
  74. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/data/repos/repo_info_error.json +0 -0
  75. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/data/repos/repo_info_no_head.json +0 -0
  76. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/data/repos/repo_info_success.json +0 -0
  77. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/data/settings/security-policy.json +0 -0
  78. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/unit/__init__.py +0 -0
  79. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/unit/test_cli_config.py +0 -0
  80. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/unit/test_client.py +0 -0
  81. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/unit/test_config.py +0 -0
  82. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/unit/test_gitlab_auth.py +0 -0
  83. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/unit/test_gitlab_auth_fallback.py +0 -0
  84. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/tests/unit/test_output.py +0 -0
  85. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/workflows/bitbucket-pipelines.yml +0 -0
  86. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/workflows/github-actions.yml +0 -0
  87. {socketsecurity-2.2.26 → socketsecurity-2.2.32}/workflows/gitlab-ci.yml +0 -0
@@ -0,0 +1,102 @@
1
+ FROM python:3-alpine
2
+ LABEL org.opencontainers.image.authors="socket.dev"
3
+
4
+ # Language version arguments with defaults
5
+ ARG GO_VERSION=system
6
+ ARG JAVA_VERSION=17
7
+ ARG DOTNET_VERSION=8
8
+
9
+ # CLI and SDK arguments
10
+ ARG CLI_VERSION
11
+ ARG SDK_VERSION
12
+ ARG PIP_INDEX_URL=https://pypi.org/simple
13
+ ARG PIP_EXTRA_INDEX_URL=https://pypi.org/simple
14
+ ARG USE_LOCAL_INSTALL=false
15
+
16
+ # Install base packages first
17
+ RUN apk update && apk add --no-cache \
18
+ git nodejs npm yarn curl wget \
19
+ ruby ruby-dev build-base
20
+
21
+ # Install Go with version control
22
+ RUN if [ "$GO_VERSION" = "system" ]; then \
23
+ apk add --no-cache go; \
24
+ else \
25
+ cd /tmp && \
26
+ ARCH=$(uname -m) && \
27
+ case $ARCH in \
28
+ x86_64) GOARCH=amd64 ;; \
29
+ aarch64) GOARCH=arm64 ;; \
30
+ *) echo "Unsupported architecture: $ARCH" && exit 1 ;; \
31
+ esac && \
32
+ wget https://golang.org/dl/go${GO_VERSION}.linux-${GOARCH}.tar.gz && \
33
+ tar -C /usr/local -xzf go${GO_VERSION}.linux-${GOARCH}.tar.gz && \
34
+ rm go${GO_VERSION}.linux-${GOARCH}.tar.gz; \
35
+ fi
36
+
37
+ # Install Java with version control
38
+ RUN if [ "$JAVA_VERSION" = "8" ]; then \
39
+ apk add --no-cache openjdk8-jdk; \
40
+ elif [ "$JAVA_VERSION" = "11" ]; then \
41
+ apk add --no-cache openjdk11-jdk; \
42
+ elif [ "$JAVA_VERSION" = "17" ]; then \
43
+ apk add --no-cache openjdk17-jdk; \
44
+ elif [ "$JAVA_VERSION" = "21" ]; then \
45
+ apk add --no-cache openjdk21-jdk; \
46
+ else \
47
+ echo "Unsupported Java version: $JAVA_VERSION. Supported: 8, 11, 17, 21" && exit 1; \
48
+ fi
49
+
50
+ # Install .NET with version control
51
+ RUN if [ "$DOTNET_VERSION" = "6" ]; then \
52
+ apk add --no-cache dotnet6-sdk; \
53
+ elif [ "$DOTNET_VERSION" = "8" ]; then \
54
+ apk add --no-cache dotnet8-sdk; \
55
+ else \
56
+ echo "Unsupported .NET version: $DOTNET_VERSION. Supported: 6, 8" && exit 1; \
57
+ fi
58
+
59
+ # Install additional tools
60
+ RUN npm install @coana-tech/cli -g && \
61
+ gem install bundler && \
62
+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
63
+ . ~/.cargo/env && \
64
+ rustup component add rustfmt clippy
65
+
66
+ # Set environment paths
67
+ ENV PATH="/usr/local/go/bin:/root/.cargo/bin:${PATH}"
68
+ ENV GOROOT="/usr/local/go"
69
+ ENV GOPATH="/go"
70
+
71
+ # Install uv
72
+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
73
+
74
+ # Install CLI based on build mode
75
+ RUN if [ "$USE_LOCAL_INSTALL" = "true" ]; then \
76
+ echo "Using local development install"; \
77
+ else \
78
+ for i in $(seq 1 10); do \
79
+ echo "Attempt $i/10: Installing socketsecurity==$CLI_VERSION"; \
80
+ if pip install --index-url ${PIP_INDEX_URL} --extra-index-url ${PIP_EXTRA_INDEX_URL} socketsecurity==$CLI_VERSION; then \
81
+ break; \
82
+ fi; \
83
+ echo "Install failed, waiting 30s before retry..."; \
84
+ sleep 30; \
85
+ done && \
86
+ if [ ! -z "$SDK_VERSION" ]; then \
87
+ pip install --index-url ${PIP_INDEX_URL} --extra-index-url ${PIP_EXTRA_INDEX_URL} socketdev==${SDK_VERSION}; \
88
+ fi; \
89
+ fi
90
+
91
+ # Copy local source and install in editable mode if USE_LOCAL_INSTALL is true
92
+ COPY . /app
93
+ WORKDIR /app
94
+ RUN if [ "$USE_LOCAL_INSTALL" = "true" ]; then \
95
+ pip install --upgrade -e .; \
96
+ pip install --upgrade socketdev; \
97
+ fi
98
+
99
+ # Create workspace directory with proper permissions
100
+ RUN mkdir -p /go/src && chmod -R 777 /go
101
+
102
+ ENTRYPOINT ["socketcli"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: socketsecurity
3
- Version: 2.2.26
3
+ Version: 2.2.32
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>
@@ -40,7 +40,7 @@ Requires-Dist: packaging
40
40
  Requires-Dist: prettytable
41
41
  Requires-Dist: python-dotenv
42
42
  Requires-Dist: requests
43
- Requires-Dist: socketdev<4.0.0,>=3.0.17
43
+ Requires-Dist: socketdev<4.0.0,>=3.0.19
44
44
  Provides-Extra: dev
45
45
  Requires-Dist: hatch; extra == 'dev'
46
46
  Requires-Dist: pre-commit; extra == 'dev'
@@ -228,6 +228,8 @@ If you don't want to provide the Socket API Token every time then you can use th
228
228
  | --reach-version | False | latest | Version of @coana-tech/cli to use for analysis |
229
229
  | --reach-analysis-timeout | False | 1200 | Timeout in seconds for the reachability analysis (default: 1200 seconds / 20 minutes) |
230
230
  | --reach-analysis-memory-limit | False | 4096 | Memory limit in MB for the reachability analysis (default: 4096 MB / 4 GB) |
231
+ | --reach-concurrency | False | | Control parallel analysis execution (must be >= 1) |
232
+ | --reach-additional-params | False | | Pass custom parameters to the coana CLI tool |
231
233
  | --reach-ecosystems | False | | Comma-separated list of ecosystems to analyze (e.g., "npm,pypi"). If not specified, all supported ecosystems are analyzed |
232
234
  | --reach-exclude-paths | False | | Comma-separated list of file paths or patterns to exclude from reachability analysis |
233
235
  | --reach-min-severity | False | | Minimum severity level for reporting reachability results (low, medium, high, critical) |
@@ -171,6 +171,8 @@ If you don't want to provide the Socket API Token every time then you can use th
171
171
  | --reach-version | False | latest | Version of @coana-tech/cli to use for analysis |
172
172
  | --reach-analysis-timeout | False | 1200 | Timeout in seconds for the reachability analysis (default: 1200 seconds / 20 minutes) |
173
173
  | --reach-analysis-memory-limit | False | 4096 | Memory limit in MB for the reachability analysis (default: 4096 MB / 4 GB) |
174
+ | --reach-concurrency | False | | Control parallel analysis execution (must be >= 1) |
175
+ | --reach-additional-params | False | | Pass custom parameters to the coana CLI tool |
174
176
  | --reach-ecosystems | False | | Comma-separated list of ecosystems to analyze (e.g., "npm,pypi"). If not specified, all supported ecosystems are analyzed |
175
177
  | --reach-exclude-paths | False | | Comma-separated list of file paths or patterns to exclude from reachability analysis |
176
178
  | --reach-min-severity | False | | Minimum severity level for reporting reachability results (low, medium, high, critical) |
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
6
6
 
7
7
  [project]
8
8
  name = "socketsecurity"
9
- version = "2.2.26"
9
+ version = "2.2.32"
10
10
  requires-python = ">= 3.10"
11
11
  license = {"file" = "LICENSE"}
12
12
  dependencies = [
@@ -16,7 +16,7 @@ dependencies = [
16
16
  'GitPython',
17
17
  'packaging',
18
18
  'python-dotenv',
19
- 'socketdev>=3.0.17,<4.0.0',
19
+ 'socketdev>=3.0.19,<4.0.0',
20
20
  "bs4>=0.0.2",
21
21
  ]
22
22
  readme = "README.md"
@@ -0,0 +1,161 @@
1
+ #!/bin/sh
2
+ VERSION=$(grep -o "__version__.*" socketsecurity/__init__.py | awk '{print $3}' | tr -d "'")
3
+ ENABLE_PYPI_BUILD=$1
4
+ STABLE_VERSION=$2
5
+ GO_VERSION=${GO_VERSION:-"1.21"}
6
+ JAVA_VERSION=${JAVA_VERSION:-"17"}
7
+ DOTNET_VERSION=${DOTNET_VERSION:-"8"}
8
+
9
+ verify_package() {
10
+ local version=$1
11
+ local pip_index=$2
12
+ echo "Verifying package availability..."
13
+
14
+ for i in $(seq 1 30); do
15
+ if pip install --index-url $pip_index socketsecurity==$version; then
16
+ echo "Package $version is now available and installable"
17
+ pip uninstall -y socketsecurity
18
+ return 0
19
+ fi
20
+ echo "Attempt $i: Package not yet installable, waiting 20s... ($i/30)"
21
+ sleep 20
22
+ done
23
+
24
+ echo "Package verification failed after 30 attempts"
25
+ return 1
26
+ }
27
+
28
+ # Function to build Docker image with language versions
29
+ build_docker_image() {
30
+ local cli_version=$1
31
+ local tag=$2
32
+ local pip_index=${3:-"https://pypi.org/simple"}
33
+ local pip_extra_index=${4:-"https://pypi.org/simple"}
34
+ local use_local=${5:-"false"}
35
+ local dockerfile=${6:-"Dockerfile"}
36
+
37
+ echo "Building with Go $GO_VERSION, Java $JAVA_VERSION, .NET $DOTNET_VERSION"
38
+
39
+ local build_args="--build-arg CLI_VERSION=$cli_version"
40
+ build_args="$build_args --build-arg GO_VERSION=$GO_VERSION"
41
+ build_args="$build_args --build-arg JAVA_VERSION=$JAVA_VERSION"
42
+ build_args="$build_args --build-arg DOTNET_VERSION=$DOTNET_VERSION"
43
+ build_args="$build_args --build-arg PIP_INDEX_URL=$pip_index"
44
+ build_args="$build_args --build-arg PIP_EXTRA_INDEX_URL=$pip_extra_index"
45
+ build_args="$build_args --build-arg USE_LOCAL_INSTALL=$use_local"
46
+
47
+ docker build --no-cache $build_args --platform linux/amd64,linux/arm64 -t $tag -f $dockerfile .
48
+ }
49
+
50
+ echo "Socket CLI version: $VERSION"
51
+ echo "Language versions: Go $GO_VERSION, Java $JAVA_VERSION, .NET $DOTNET_VERSION"
52
+
53
+ if [ -z $ENABLE_PYPI_BUILD ] || [ -z $STABLE_VERSION ]; then
54
+ echo "$0 pypi-build=<option> stable=<true|false|prod|test>"
55
+ echo "\tpypi-build: Options are prod, test, or local"
56
+ echo "\t - prod: Build and publish to production PyPI, then build Docker images"
57
+ echo "\t - test: Build and publish to test PyPI, then build Docker images"
58
+ echo "\t - local: Build Docker images only using existing PyPI package (specify prod or test via stable parameter)"
59
+ echo "\tstable: true/false/prod/test - Also tag as stable; for local builds:"
60
+ echo "\t - stable=prod: Use production PyPI package"
61
+ echo "\t - stable=test: Use test PyPI package"
62
+ echo "\t - stable=false: Use local development install (pip install -e .)"
63
+ echo ""
64
+ echo "Environment variables for language versions:"
65
+ echo "\tGO_VERSION: Go version to install (default: 1.21, or 'system' for Alpine package)"
66
+ echo "\tJAVA_VERSION: Java version to install (default: 17, options: 8, 11, 17, 21)"
67
+ echo "\tDOTNET_VERSION: .NET version to install (default: 8, options: 6, 8)"
68
+ echo ""
69
+ echo "Examples:"
70
+ echo "\tGO_VERSION=1.19 JAVA_VERSION=11 $0 pypi-build=local stable=prod"
71
+ echo "\tGO_VERSION=system JAVA_VERSION=8 $0 pypi-build=local stable=false"
72
+ exit
73
+ fi
74
+
75
+ if [ $ENABLE_PYPI_BUILD = "pypi-build=prod" ]; then
76
+ echo "Doing production build"
77
+
78
+ build_docker_image $VERSION "socketdev/cli:$VERSION"
79
+ docker push socketdev/cli:$VERSION
80
+
81
+ build_docker_image $VERSION "socketdev/cli:latest"
82
+ docker push socketdev/cli:latest
83
+ fi
84
+
85
+ if [ $ENABLE_PYPI_BUILD = "pypi-build=test" ]; then
86
+ echo "Doing test build"
87
+ if ! python -m build --wheel --sdist; then
88
+ echo "Build failed"
89
+ exit 1
90
+ fi
91
+
92
+ if ! twine upload --repository testpypi dist/*$VERSION*; then
93
+ echo "Upload to TestPyPI failed"
94
+ exit 1
95
+ fi
96
+
97
+ if ! verify_package $VERSION "https://test.pypi.org/simple"; then
98
+ echo "Failed to verify package on TestPyPI"
99
+ exit 1
100
+ fi
101
+
102
+ build_docker_image $VERSION "socketdev/cli:$VERSION-test" "https://test.pypi.org/simple" "https://pypi.org/simple"
103
+ docker push socketdev/cli:$VERSION-test
104
+
105
+ build_docker_image $VERSION "socketdev/cli:test" "https://test.pypi.org/simple" "https://pypi.org/simple"
106
+ docker push socketdev/cli:test
107
+ fi
108
+
109
+ if [ $STABLE_VERSION = "stable=true" ]; then
110
+ if [ $ENABLE_PYPI_BUILD = "pypi-build=enable" ]; then
111
+ if ! verify_package $VERSION "https://pypi.org/simple"; then
112
+ echo "Failed to verify package on PyPI"
113
+ exit 1
114
+ fi
115
+ fi
116
+
117
+ build_docker_image $VERSION "socketdev/cli:stable"
118
+ docker push socketdev/cli:stable
119
+ fi
120
+
121
+ if [ $ENABLE_PYPI_BUILD = "pypi-build=local" ]; then
122
+ echo "Building local version without publishing to PyPI"
123
+
124
+ # Determine PyPI source and build parameters
125
+ if [ $STABLE_VERSION = "stable=prod" ]; then
126
+ echo "Using production PyPI"
127
+ PIP_INDEX_URL="https://pypi.org/simple"
128
+ PIP_EXTRA_INDEX_URL="https://pypi.org/simple"
129
+ TAG_SUFFIX="local"
130
+ USE_LOCAL_INSTALL="false"
131
+ elif [ $STABLE_VERSION = "stable=test" ]; then
132
+ echo "Using test PyPI"
133
+ PIP_INDEX_URL="https://test.pypi.org/simple"
134
+ PIP_EXTRA_INDEX_URL="https://pypi.org/simple"
135
+ TAG_SUFFIX="local-test"
136
+ USE_LOCAL_INSTALL="false"
137
+ elif [ $STABLE_VERSION = "stable=false" ]; then
138
+ echo "Using local development install (pip install -e .)"
139
+ TAG_SUFFIX="local-dev"
140
+ USE_LOCAL_INSTALL="true"
141
+ PIP_INDEX_URL="https://pypi.org/simple"
142
+ PIP_EXTRA_INDEX_URL="https://pypi.org/simple"
143
+ else
144
+ echo "For local builds, use stable=prod, stable=test, or stable=false"
145
+ exit 1
146
+ fi
147
+
148
+ # Create language-specific tag if non-default versions are used
149
+ LANG_TAG=""
150
+ if [ "$GO_VERSION" != "1.21" ] || [ "$JAVA_VERSION" != "17" ] || [ "$DOTNET_VERSION" != "8" ]; then
151
+ LANG_TAG="-go${GO_VERSION}-java${JAVA_VERSION}-dotnet${DOTNET_VERSION}"
152
+ fi
153
+
154
+ build_docker_image $VERSION "socketdev/cli:$VERSION-$TAG_SUFFIX$LANG_TAG" $PIP_INDEX_URL $PIP_EXTRA_INDEX_URL $USE_LOCAL_INSTALL "Dockerfile.flexible"
155
+
156
+ build_docker_image $VERSION "socketdev/cli:$TAG_SUFFIX$LANG_TAG" $PIP_INDEX_URL $PIP_EXTRA_INDEX_URL $USE_LOCAL_INSTALL "Dockerfile.flexible"
157
+
158
+ echo "Local build complete. Tagged as:"
159
+ echo " - socketdev/cli:$VERSION-$TAG_SUFFIX$LANG_TAG"
160
+ echo " - socketdev/cli:$TAG_SUFFIX$LANG_TAG"
161
+ fi
@@ -1,3 +1,3 @@
1
1
  __author__ = 'socket.dev'
2
- __version__ = '2.2.26'
2
+ __version__ = '2.2.32'
3
3
  USER_AGENT = f'SocketPythonCLI/{__version__}'
@@ -73,6 +73,8 @@ class CliConfig:
73
73
  reach_skip_cache: bool = False
74
74
  reach_min_severity: Optional[str] = None
75
75
  reach_output_file: Optional[str] = None
76
+ reach_concurrency: Optional[int] = None
77
+ reach_additional_params: Optional[List[str]] = None
76
78
  only_facts_file: bool = False
77
79
 
78
80
  @classmethod
@@ -132,6 +134,8 @@ class CliConfig:
132
134
  'reach_skip_cache': args.reach_skip_cache,
133
135
  'reach_min_severity': args.reach_min_severity,
134
136
  'reach_output_file': args.reach_output_file,
137
+ 'reach_concurrency': args.reach_concurrency,
138
+ 'reach_additional_params': args.reach_additional_params,
135
139
  'only_facts_file': args.only_facts_file,
136
140
  'version': __version__
137
141
  }
@@ -169,6 +173,11 @@ class CliConfig:
169
173
  logging.error("--only-facts-file requires --reach to be specified")
170
174
  exit(1)
171
175
 
176
+ # Validate reach_concurrency is >= 1 if provided
177
+ if args.reach_concurrency is not None and args.reach_concurrency < 1:
178
+ logging.error("--reach-concurrency must be >= 1")
179
+ exit(1)
180
+
172
181
  return cls(**config_args)
173
182
 
174
183
  def to_dict(self) -> dict:
@@ -429,20 +438,13 @@ def create_argument_parser() -> argparse.ArgumentParser:
429
438
  help="Exclude license details from the diff report (boosts performance for large repos)"
430
439
  )
431
440
 
432
- # Security Configuration
433
- security_group = parser.add_argument_group('Security Configuration')
434
- security_group.add_argument(
435
- "--allow-unverified",
436
- action="store_true",
437
- help="Allow unverified packages"
438
- )
439
- security_group.add_argument(
441
+ output_group.add_argument(
440
442
  "--disable-security-issue",
441
443
  dest="disable_security_issue",
442
444
  action="store_true",
443
445
  help="Disable security issue checks"
444
446
  )
445
- security_group.add_argument(
447
+ output_group.add_argument(
446
448
  "--disable_security_issue",
447
449
  dest="disable_security_issue",
448
450
  action="store_true",
@@ -494,6 +496,11 @@ def create_argument_parser() -> argparse.ArgumentParser:
494
496
  help="Timeout in seconds for API requests",
495
497
  required=False
496
498
  )
499
+ advanced_group.add_argument(
500
+ "--allow-unverified",
501
+ action="store_true",
502
+ help="Disable SSL certificate verification for API requests"
503
+ )
497
504
  config_group.add_argument(
498
505
  "--include-module-folders",
499
506
  dest="include_module_folders",
@@ -567,6 +574,20 @@ def create_argument_parser() -> argparse.ArgumentParser:
567
574
  default=".socket.facts.json",
568
575
  help="Output file path for reachability analysis results (default: .socket.facts.json)"
569
576
  )
577
+ reachability_group.add_argument(
578
+ "--reach-concurrency",
579
+ dest="reach_concurrency",
580
+ type=int,
581
+ metavar="<number>",
582
+ help="Concurrency level for reachability analysis (must be >= 1)"
583
+ )
584
+ reachability_group.add_argument(
585
+ "--reach-additional-params",
586
+ dest="reach_additional_params",
587
+ nargs='+',
588
+ metavar="<param>",
589
+ help="Additional parameters to pass to the coana CLI (e.g., --reach-additional-params --other-param value --another-param value2)"
590
+ )
570
591
  reachability_group.add_argument(
571
592
  "--only-facts-file",
572
593
  dest="only_facts_file",
@@ -1,8 +1,9 @@
1
1
  import os
2
2
  import sys
3
3
  from dataclasses import dataclass
4
- from typing import Optional
4
+ from typing import Optional, Union
5
5
 
6
+ import requests
6
7
  from socketsecurity import USER_AGENT
7
8
  from socketsecurity.core import log
8
9
  from socketsecurity.core.classes import Comment
@@ -128,9 +129,9 @@ class Gitlab:
128
129
  try:
129
130
  # Try the initial request with the configured headers
130
131
  return self.client.request(**kwargs)
131
- except Exception as e:
132
+ except requests.exceptions.HTTPError as e:
132
133
  # Check if this is an authentication error (401)
133
- if hasattr(e, 'response') and e.response and e.response.status_code == 401:
134
+ if e.response and e.response.status_code == 401:
134
135
  log.debug(f"Authentication failed with initial headers, trying fallback method")
135
136
 
136
137
  # Determine the fallback headers
@@ -144,6 +145,9 @@ class Gitlab:
144
145
 
145
146
  # Re-raise the original exception if it's not an auth error or fallback failed
146
147
  raise
148
+ except Exception as e:
149
+ # Handle other types of exceptions that don't have response attribute
150
+ raise
147
151
 
148
152
  def _get_fallback_headers(self, original_headers: dict) -> dict:
149
153
  """
@@ -235,13 +239,13 @@ class Gitlab:
235
239
  new_security_comment: bool = True,
236
240
  new_overview_comment: bool = True
237
241
  ) -> None:
238
- existing_overview_comment = comments.get("overview", "")
239
- existing_security_comment = comments.get("security", "")
242
+ existing_overview_comment = comments.get("overview")
243
+ existing_security_comment = comments.get("security")
240
244
  if new_overview_comment:
241
245
  log.debug("New Dependency Overview comment")
242
246
  if existing_overview_comment is not None:
243
247
  log.debug("Previous version of Dependency Overview, updating")
244
- existing_overview_comment: Comment
248
+ # Type narrowing: after None check, mypy knows this is Comment
245
249
  self.update_comment(overview_comment, str(existing_overview_comment.id))
246
250
  else:
247
251
  log.debug("No previous version of Dependency Overview, posting")
@@ -250,15 +254,15 @@ class Gitlab:
250
254
  log.debug("New Security Issue Comment")
251
255
  if existing_security_comment is not None:
252
256
  log.debug("Previous version of Security Issue comment, updating")
253
- existing_security_comment: Comment
257
+ # Type narrowing: after None check, mypy knows this is Comment
254
258
  self.update_comment(security_comment, str(existing_security_comment.id))
255
259
  else:
256
260
  log.debug("No Previous version of Security Issue comment, posting")
257
261
  self.post_comment(security_comment)
258
262
 
259
263
  def remove_comment_alerts(self, comments: dict):
260
- security_alert = comments.get("security", "")
264
+ security_alert = comments.get("security")
261
265
  if security_alert is not None:
262
- security_alert: Comment
266
+ # Type narrowing: after None check, mypy knows this is Comment
263
267
  new_body = Comments.process_security_comment(security_alert, comments)
264
268
  self.update_comment(new_body, str(security_alert.id))
@@ -20,7 +20,7 @@ class ReachabilityAnalyzer:
20
20
  Check if @coana-tech/cli is installed, and install/update it if needed.
21
21
 
22
22
  Args:
23
- version: Specific version to install (e.g., '1.2.3'). If None, updates to latest.
23
+ version: Specific version to install (e.g., '1.2.3'). If None, always updates to latest.
24
24
 
25
25
  Returns:
26
26
  str: The package specifier to use with npx
@@ -48,6 +48,7 @@ class ReachabilityAnalyzer:
48
48
  log.debug(f"Could not check for existing @coana-tech/cli installation: {e}")
49
49
 
50
50
  # Install or update the package
51
+ # When no version is specified, always try to update to latest
51
52
  if version:
52
53
  log.info(f"Installing reachability analysis plugin (@coana-tech/cli@{version})...")
53
54
  else:
@@ -95,6 +96,9 @@ class ReachabilityAnalyzer:
95
96
  repo_name: Optional[str] = None,
96
97
  branch_name: Optional[str] = None,
97
98
  version: Optional[str] = None,
99
+ concurrency: Optional[int] = None,
100
+ additional_params: Optional[List[str]] = None,
101
+ allow_unverified: bool = False,
98
102
  ) -> Dict[str, Any]:
99
103
  """
100
104
  Run reachability analysis.
@@ -114,6 +118,9 @@ class ReachabilityAnalyzer:
114
118
  repo_name: Repository name
115
119
  branch_name: Branch name
116
120
  version: Specific version of @coana-tech/cli to use
121
+ concurrency: Concurrency level for analysis (must be >= 1)
122
+ additional_params: Additional parameters to pass to coana CLI
123
+ allow_unverified: Disable SSL certificate verification (sets NODE_TLS_REJECT_UNAUTHORIZED=0)
117
124
 
118
125
  Returns:
119
126
  Dict containing scan_id and report_path
@@ -158,6 +165,13 @@ class ReachabilityAnalyzer:
158
165
  if skip_cache:
159
166
  cmd.append("--skip-cache-usage")
160
167
 
168
+ if concurrency:
169
+ cmd.extend(["--concurrency", str(concurrency)])
170
+
171
+ # Add any additional parameters provided by the user
172
+ if additional_params:
173
+ cmd.extend(additional_params)
174
+
161
175
  # Set up environment variables
162
176
  env = os.environ.copy()
163
177
 
@@ -172,6 +186,10 @@ class ReachabilityAnalyzer:
172
186
  if branch_name:
173
187
  env["SOCKET_BRANCH_NAME"] = branch_name
174
188
 
189
+ # Set NODE_TLS_REJECT_UNAUTHORIZED=0 if allow_unverified is True
190
+ if allow_unverified:
191
+ env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0"
192
+
175
193
  # Execute CLI
176
194
  log.info("Running reachability analysis...")
177
195
  log.debug(f"Reachability command: {' '.join(cmd)}")
@@ -2,6 +2,7 @@ import json
2
2
  import sys
3
3
  import traceback
4
4
  import shutil
5
+ import warnings
5
6
 
6
7
  from dotenv import load_dotenv
7
8
  from git import InvalidGitRepositoryError, NoSuchPathError
@@ -55,7 +56,13 @@ def main_code():
55
56
  "2. Environment variable: SOCKET_SECURITY_API_KEY")
56
57
  sys.exit(3)
57
58
 
58
- sdk = socketdev(token=config.api_token)
59
+ sdk = socketdev(token=config.api_token, allow_unverified=config.allow_unverified)
60
+
61
+ # Suppress urllib3 InsecureRequestWarning when using --allow-unverified
62
+ if config.allow_unverified:
63
+ import urllib3
64
+ urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
65
+
59
66
  output_handler = OutputHandler(config, sdk)
60
67
  log.debug("sdk loaded")
61
68
 
@@ -277,7 +284,10 @@ def main_code():
277
284
  disable_analytics=config.reach_disable_analytics or False,
278
285
  repo_name=config.repo,
279
286
  branch_name=config.branch,
280
- version=config.reach_version
287
+ version=config.reach_version,
288
+ concurrency=config.reach_concurrency,
289
+ additional_params=config.reach_additional_params,
290
+ allow_unverified=config.allow_unverified
281
291
  )
282
292
 
283
293
  log.info(f"Reachability analysis completed successfully")
@@ -1052,26 +1052,28 @@ wheels = [
1052
1052
 
1053
1053
  [[package]]
1054
1054
  name = "socketdev"
1055
- version = "3.0.16"
1055
+ version = "3.0.17"
1056
1056
  source = { registry = "https://pypi.org/simple" }
1057
1057
  dependencies = [
1058
1058
  { name = "requests" },
1059
1059
  { name = "typing-extensions" },
1060
1060
  ]
1061
- sdist = { url = "https://files.pythonhosted.org/packages/02/0d/6da0e0c34b97eef3a926d55470fa4bda2fcbbc42cc9e26ac51a34c6f117d/socketdev-3.0.16.tar.gz", hash = "sha256:5145300945e4e8d2d7f71db9c55cb44cc1449874f9d6416cc1d6ec129c64d638", size = 132505, upload-time = "2025-11-07T03:24:16.231Z" }
1061
+ sdist = { url = "https://files.pythonhosted.org/packages/47/60/54b56ac179a9c89b2c9f2ab7eb5ba81220de64d11d52cf19249113ff364d/socketdev-3.0.17.tar.gz", hash = "sha256:a4446a84856c637c312d809d5b8deb25dd20ca38ae7d00a4c8104ea5b890c0af", size = 134013, upload-time = "2025-11-07T22:38:34.354Z" }
1062
1062
  wheels = [
1063
- { url = "https://files.pythonhosted.org/packages/a3/91/8486b2a62ba71d62a8f4f2f9ad22c61fcaabb461c5f269bbe0734eae76f9/socketdev-3.0.16-py3-none-any.whl", hash = "sha256:f5e413f5f2f8c0c938d5654da7f0a157c0be02a25e14d94af62c252e9fb3b502", size = 58567, upload-time = "2025-11-07T03:24:14.965Z" },
1063
+ { url = "https://files.pythonhosted.org/packages/98/56/34ab0e33b5345ca7ada68cd0a9e9d4adcde16051192eb10f8e2c3e0deaa1/socketdev-3.0.17-py3-none-any.whl", hash = "sha256:0986ee0694d5ce879cadb8e06fcfb75a4ca2dfb6f415414593825701593cf991", size = 59317, upload-time = "2025-11-07T22:38:32.704Z" },
1064
1064
  ]
1065
1065
 
1066
1066
  [[package]]
1067
1067
  name = "socketsecurity"
1068
- version = "2.2.18"
1068
+ version = "2.2.26"
1069
1069
  source = { editable = "." }
1070
1070
  dependencies = [
1071
1071
  { name = "bs4" },
1072
1072
  { name = "gitpython" },
1073
+ { name = "hatch" },
1073
1074
  { name = "mdutils" },
1074
1075
  { name = "packaging" },
1076
+ { name = "pluggy" },
1075
1077
  { name = "prettytable" },
1076
1078
  { name = "python-dotenv" },
1077
1079
  { name = "requests" },
@@ -1098,9 +1100,11 @@ test = [
1098
1100
  requires-dist = [
1099
1101
  { name = "bs4", specifier = ">=0.0.2" },
1100
1102
  { name = "gitpython" },
1103
+ { name = "hatch", specifier = ">=1.14.1" },
1101
1104
  { name = "hatch", marker = "extra == 'dev'" },
1102
1105
  { name = "mdutils" },
1103
1106
  { name = "packaging" },
1107
+ { name = "pluggy", specifier = ">=1.6.0" },
1104
1108
  { name = "pre-commit", marker = "extra == 'dev'" },
1105
1109
  { name = "prettytable" },
1106
1110
  { name = "pytest", marker = "extra == 'test'", specifier = ">=7.4.0" },
@@ -1111,7 +1115,7 @@ requires-dist = [
1111
1115
  { name = "python-dotenv" },
1112
1116
  { name = "requests" },
1113
1117
  { name = "ruff", marker = "extra == 'dev'", specifier = ">=0.3.0" },
1114
- { name = "socketdev", specifier = ">=3.0.16,<4.0.0" },
1118
+ { name = "socketdev", specifier = ">=3.0.17,<4.0.0" },
1115
1119
  { name = "twine", marker = "extra == 'dev'" },
1116
1120
  { name = "uv", marker = "extra == 'dev'", specifier = ">=0.1.0" },
1117
1121
  ]
@@ -1,41 +0,0 @@
1
- FROM python:3-alpine
2
- LABEL org.opencontainers.image.authors="socket.dev"
3
- ARG CLI_VERSION
4
- ARG SDK_VERSION
5
- ARG PIP_INDEX_URL=https://pypi.org/simple
6
- ARG PIP_EXTRA_INDEX_URL=https://pypi.org/simple
7
- ARG USE_LOCAL_INSTALL=false
8
-
9
- RUN apk update \
10
- && apk add --no-cache git nodejs npm yarn curl \
11
- && npm install @coana-tech/cli -g
12
-
13
- # Install uv
14
- COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
15
-
16
- # Install CLI based on build mode
17
- RUN if [ "$USE_LOCAL_INSTALL" = "true" ]; then \
18
- echo "Using local development install"; \
19
- else \
20
- for i in $(seq 1 10); do \
21
- echo "Attempt $i/10: Installing socketsecurity==$CLI_VERSION"; \
22
- if pip install --index-url ${PIP_INDEX_URL} --extra-index-url ${PIP_EXTRA_INDEX_URL} socketsecurity==$CLI_VERSION; then \
23
- break; \
24
- fi; \
25
- echo "Install failed, waiting 30s before retry..."; \
26
- sleep 30; \
27
- done && \
28
- if [ ! -z "$SDK_VERSION" ]; then \
29
- pip install --index-url ${PIP_INDEX_URL} --extra-index-url ${PIP_EXTRA_INDEX_URL} socketdev==${SDK_VERSION}; \
30
- fi; \
31
- fi
32
-
33
- # Copy local source and install in editable mode if USE_LOCAL_INSTALL is true
34
- COPY . /app
35
- WORKDIR /app
36
- RUN if [ "$USE_LOCAL_INSTALL" = "true" ]; then \
37
- pip install --upgrade -e .; \
38
- pip install --upgrade socketdev; \
39
- fi
40
-
41
- # ENTRYPOINT ["socketcli"]
File without changes