socketsecurity 2.2.57__tar.gz → 2.2.60__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/PKG-INFO +40 -10
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/README.md +37 -8
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/pyproject.toml +3 -2
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/__init__.py +1 -1
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/config.py +27 -5
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/core/__init__.py +16 -11
- socketsecurity-2.2.60/socketsecurity/core/helper/socket_facts_loader.py +387 -0
- socketsecurity-2.2.60/socketsecurity/plugins/formatters/__init__.py +5 -0
- socketsecurity-2.2.60/socketsecurity/plugins/formatters/slack.py +272 -0
- socketsecurity-2.2.60/socketsecurity/plugins/slack.py +491 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/socketcli.py +3 -3
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/uv.lock +285 -274
- socketsecurity-2.2.57/socketsecurity/plugins/slack.py +0 -95
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/.github/CODEOWNERS +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/.github/PULL_REQUEST_TEMPLATE/bug-fix.md +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/.github/PULL_REQUEST_TEMPLATE/improvement.md +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/.github/workflows/docker-stable.yml +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/.github/workflows/pr-preview.yml +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/.github/workflows/release.yml +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/.github/workflows/version-check.yml +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/.gitignore +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/.hooks/sync_version.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/.pre-commit-config.yaml +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/.python-version +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/CHANGELOG.md +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/Dockerfile +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/LICENSE +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/Makefile +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/docs/README.md +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/pytest.ini +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/scripts/build_container.sh +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/scripts/build_container_flexible.sh +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/scripts/deploy-test-docker.sh +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/scripts/deploy-test-pypi.sh +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/scripts/docker-entrypoint.sh +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/scripts/run.sh +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/core/classes.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/core/cli_client.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/core/exceptions.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/core/git_interface.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/core/helper/__init__.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/core/lazy_file_loader.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/core/logging.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/core/messages.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/core/resource_utils.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/core/scm/__init__.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/core/scm/base.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/core/scm/client.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/core/scm/github.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/core/scm/gitlab.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/core/scm_comments.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/core/socket_config.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/core/tools/reachability.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/core/utils.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/output.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/plugins/__init__.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/plugins/base.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/plugins/jira.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/plugins/manager.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/plugins/teams.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/socketsecurity/plugins/webhook.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/__init__.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/core/conftest.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/core/create_diff_input.json +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/core/test_diff_generation.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/core/test_package_and_alerts.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/core/test_sdk_methods.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/core/test_supporting_methods.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/data/fullscans/create_response.json +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/data/fullscans/diff/stream_diff.json +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/data/fullscans/diff/stream_diff_full.json +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/data/fullscans/head_scan/metadata.json +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/data/fullscans/head_scan/stream_scan.json +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/data/fullscans/head_scan/stream_scan_full.json +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/data/fullscans/new_scan/metadata.json +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/data/fullscans/new_scan/stream_scan.json +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/data/repos/repo_info_error.json +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/data/repos/repo_info_no_head.json +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/data/repos/repo_info_success.json +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/data/settings/security-policy.json +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/unit/__init__.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/unit/test_cli_config.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/unit/test_client.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/unit/test_config.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/unit/test_gitlab_auth.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/unit/test_gitlab_auth_fallback.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/tests/unit/test_output.py +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/workflows/bitbucket-pipelines.yml +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/workflows/github-actions.yml +0 -0
- {socketsecurity-2.2.57 → socketsecurity-2.2.60}/workflows/gitlab-ci.yml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: socketsecurity
|
|
3
|
-
Version: 2.2.
|
|
3
|
+
Version: 2.2.60
|
|
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>
|
|
@@ -35,12 +35,13 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
35
35
|
Requires-Python: >=3.10
|
|
36
36
|
Requires-Dist: bs4>=0.0.2
|
|
37
37
|
Requires-Dist: gitpython
|
|
38
|
+
Requires-Dist: markdown>=3.10
|
|
38
39
|
Requires-Dist: mdutils
|
|
39
40
|
Requires-Dist: packaging
|
|
40
41
|
Requires-Dist: prettytable
|
|
41
42
|
Requires-Dist: python-dotenv
|
|
42
43
|
Requires-Dist: requests
|
|
43
|
-
Requires-Dist: socketdev<4.0.0,>=3.0.
|
|
44
|
+
Requires-Dist: socketdev<4.0.0,>=3.0.25
|
|
44
45
|
Provides-Extra: dev
|
|
45
46
|
Requires-Dist: hatch; extra == 'dev'
|
|
46
47
|
Requires-Dist: pre-commit; extra == 'dev'
|
|
@@ -158,14 +159,14 @@ socketcli [-h] [--api-token API_TOKEN] [--repo REPO] [--repo-is-public] [--branc
|
|
|
158
159
|
[--only-facts-file] [--version]
|
|
159
160
|
````
|
|
160
161
|
|
|
161
|
-
If you don't want to provide the Socket API Token every time then you can use the environment variable `
|
|
162
|
+
If you don't want to provide the Socket API Token every time then you can use the environment variable `SOCKET_SECURITY_API_TOKEN`
|
|
162
163
|
|
|
163
164
|
### Parameters
|
|
164
165
|
|
|
165
166
|
#### Authentication
|
|
166
|
-
| Parameter | Required | Default | Description
|
|
167
|
-
|
|
168
|
-
| --api-token | False | | Socket Security API token (can also be set via
|
|
167
|
+
| Parameter | Required | Default | Description |
|
|
168
|
+
|:------------|:---------|:--------|:----------------------------------------------------------------------------------|
|
|
169
|
+
| --api-token | False | | Socket Security API token (can also be set via SOCKET_SECURITY_API_TOKEN env var) |
|
|
169
170
|
|
|
170
171
|
#### Repository
|
|
171
172
|
| Parameter | Required | Default | Description |
|
|
@@ -278,15 +279,43 @@ Example `SOCKET_JIRA_CONFIG_JSON` value
|
|
|
278
279
|
|
|
279
280
|
| Environment Variable | Required | Default | Description |
|
|
280
281
|
|:-------------------------|:---------|:--------|:-----------------------------------|
|
|
281
|
-
|
|
|
282
|
-
| SOCKET_SLACK_CONFIG_JSON | True | None | Required if the Plugin is enabled. |
|
|
282
|
+
| SOCKET_SLACK_CONFIG_JSON | False | None | Slack webhook configuration (enables plugin when set). Alternatively, use --slack-webhook CLI flag. |
|
|
283
283
|
|
|
284
|
-
Example `SOCKET_SLACK_CONFIG_JSON` value
|
|
284
|
+
Example `SOCKET_SLACK_CONFIG_JSON` value (simple webhook):
|
|
285
285
|
|
|
286
286
|
````json
|
|
287
287
|
{"url": "https://REPLACE_ME_WEBHOOK"}
|
|
288
288
|
````
|
|
289
289
|
|
|
290
|
+
Example with advanced filtering (reachability-only alerts):
|
|
291
|
+
|
|
292
|
+
````json
|
|
293
|
+
{
|
|
294
|
+
"url": [
|
|
295
|
+
{
|
|
296
|
+
"name": "prod_alerts",
|
|
297
|
+
"url": "https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
|
|
298
|
+
}
|
|
299
|
+
],
|
|
300
|
+
"url_configs": {
|
|
301
|
+
"prod_alerts": {
|
|
302
|
+
"reachability_alerts_only": true,
|
|
303
|
+
"always_send_reachability": true
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
````
|
|
308
|
+
|
|
309
|
+
**Advanced Configuration Options:**
|
|
310
|
+
|
|
311
|
+
The `url_configs` object allows per-webhook filtering:
|
|
312
|
+
|
|
313
|
+
- `reachability_alerts_only` (boolean, default: false): When `--reach` is enabled, only send blocking alerts (error=true) from diff scans
|
|
314
|
+
- `always_send_reachability` (boolean, default: true): Send reachability alerts even on non-diff scans when `--reach` is enabled. Set to false to only send reachability alerts when there are diff alerts.
|
|
315
|
+
- `repos` (array): Only send alerts for specific repositories (e.g., `["owner/repo1", "owner/repo2"]`)
|
|
316
|
+
- `alert_types` (array): Only send specific alert types (e.g., `["malware", "typosquat"]`)
|
|
317
|
+
- `severities` (array): Only send alerts with specific severities (e.g., `["high", "critical"]`)
|
|
318
|
+
|
|
290
319
|
## Automatic Git Detection
|
|
291
320
|
|
|
292
321
|
The CLI now automatically detects repository information from your git environment, significantly simplifying usage in CI/CD pipelines:
|
|
@@ -547,7 +576,8 @@ Implementation targets:
|
|
|
547
576
|
### Environment Variables
|
|
548
577
|
|
|
549
578
|
#### Core Configuration
|
|
550
|
-
- `
|
|
579
|
+
- `SOCKET_SECURITY_API_TOKEN`: Socket Security API token (alternative to --api-token parameter)
|
|
580
|
+
- For backwards compatibility, also accepts: `SOCKET_SECURITY_API_KEY`, `SOCKET_API_KEY`, `SOCKET_API_TOKEN`
|
|
551
581
|
- `SOCKET_SDK_PATH`: Path to local socketdev repository (default: ../socketdev)
|
|
552
582
|
|
|
553
583
|
#### GitLab Integration
|
|
@@ -101,14 +101,14 @@ socketcli [-h] [--api-token API_TOKEN] [--repo REPO] [--repo-is-public] [--branc
|
|
|
101
101
|
[--only-facts-file] [--version]
|
|
102
102
|
````
|
|
103
103
|
|
|
104
|
-
If you don't want to provide the Socket API Token every time then you can use the environment variable `
|
|
104
|
+
If you don't want to provide the Socket API Token every time then you can use the environment variable `SOCKET_SECURITY_API_TOKEN`
|
|
105
105
|
|
|
106
106
|
### Parameters
|
|
107
107
|
|
|
108
108
|
#### Authentication
|
|
109
|
-
| Parameter | Required | Default | Description
|
|
110
|
-
|
|
111
|
-
| --api-token | False | | Socket Security API token (can also be set via
|
|
109
|
+
| Parameter | Required | Default | Description |
|
|
110
|
+
|:------------|:---------|:--------|:----------------------------------------------------------------------------------|
|
|
111
|
+
| --api-token | False | | Socket Security API token (can also be set via SOCKET_SECURITY_API_TOKEN env var) |
|
|
112
112
|
|
|
113
113
|
#### Repository
|
|
114
114
|
| Parameter | Required | Default | Description |
|
|
@@ -221,15 +221,43 @@ Example `SOCKET_JIRA_CONFIG_JSON` value
|
|
|
221
221
|
|
|
222
222
|
| Environment Variable | Required | Default | Description |
|
|
223
223
|
|:-------------------------|:---------|:--------|:-----------------------------------|
|
|
224
|
-
|
|
|
225
|
-
| SOCKET_SLACK_CONFIG_JSON | True | None | Required if the Plugin is enabled. |
|
|
224
|
+
| SOCKET_SLACK_CONFIG_JSON | False | None | Slack webhook configuration (enables plugin when set). Alternatively, use --slack-webhook CLI flag. |
|
|
226
225
|
|
|
227
|
-
Example `SOCKET_SLACK_CONFIG_JSON` value
|
|
226
|
+
Example `SOCKET_SLACK_CONFIG_JSON` value (simple webhook):
|
|
228
227
|
|
|
229
228
|
````json
|
|
230
229
|
{"url": "https://REPLACE_ME_WEBHOOK"}
|
|
231
230
|
````
|
|
232
231
|
|
|
232
|
+
Example with advanced filtering (reachability-only alerts):
|
|
233
|
+
|
|
234
|
+
````json
|
|
235
|
+
{
|
|
236
|
+
"url": [
|
|
237
|
+
{
|
|
238
|
+
"name": "prod_alerts",
|
|
239
|
+
"url": "https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
|
|
240
|
+
}
|
|
241
|
+
],
|
|
242
|
+
"url_configs": {
|
|
243
|
+
"prod_alerts": {
|
|
244
|
+
"reachability_alerts_only": true,
|
|
245
|
+
"always_send_reachability": true
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
````
|
|
250
|
+
|
|
251
|
+
**Advanced Configuration Options:**
|
|
252
|
+
|
|
253
|
+
The `url_configs` object allows per-webhook filtering:
|
|
254
|
+
|
|
255
|
+
- `reachability_alerts_only` (boolean, default: false): When `--reach` is enabled, only send blocking alerts (error=true) from diff scans
|
|
256
|
+
- `always_send_reachability` (boolean, default: true): Send reachability alerts even on non-diff scans when `--reach` is enabled. Set to false to only send reachability alerts when there are diff alerts.
|
|
257
|
+
- `repos` (array): Only send alerts for specific repositories (e.g., `["owner/repo1", "owner/repo2"]`)
|
|
258
|
+
- `alert_types` (array): Only send specific alert types (e.g., `["malware", "typosquat"]`)
|
|
259
|
+
- `severities` (array): Only send alerts with specific severities (e.g., `["high", "critical"]`)
|
|
260
|
+
|
|
233
261
|
## Automatic Git Detection
|
|
234
262
|
|
|
235
263
|
The CLI now automatically detects repository information from your git environment, significantly simplifying usage in CI/CD pipelines:
|
|
@@ -490,7 +518,8 @@ Implementation targets:
|
|
|
490
518
|
### Environment Variables
|
|
491
519
|
|
|
492
520
|
#### Core Configuration
|
|
493
|
-
- `
|
|
521
|
+
- `SOCKET_SECURITY_API_TOKEN`: Socket Security API token (alternative to --api-token parameter)
|
|
522
|
+
- For backwards compatibility, also accepts: `SOCKET_SECURITY_API_KEY`, `SOCKET_API_KEY`, `SOCKET_API_TOKEN`
|
|
494
523
|
- `SOCKET_SDK_PATH`: Path to local socketdev repository (default: ../socketdev)
|
|
495
524
|
|
|
496
525
|
#### GitLab Integration
|
|
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
|
|
|
6
6
|
|
|
7
7
|
[project]
|
|
8
8
|
name = "socketsecurity"
|
|
9
|
-
version = "2.2.
|
|
9
|
+
version = "2.2.60"
|
|
10
10
|
requires-python = ">= 3.10"
|
|
11
11
|
license = {"file" = "LICENSE"}
|
|
12
12
|
dependencies = [
|
|
@@ -16,8 +16,9 @@ dependencies = [
|
|
|
16
16
|
'GitPython',
|
|
17
17
|
'packaging',
|
|
18
18
|
'python-dotenv',
|
|
19
|
-
|
|
19
|
+
"socketdev>=3.0.25,<4.0.0",
|
|
20
20
|
"bs4>=0.0.2",
|
|
21
|
+
"markdown>=3.10",
|
|
21
22
|
]
|
|
22
23
|
readme = "README.md"
|
|
23
24
|
description = "Socket Security CLI for CI/CD"
|
|
@@ -57,6 +57,7 @@ class CliConfig:
|
|
|
57
57
|
version: str = __version__
|
|
58
58
|
jira_plugin: PluginConfig = field(default_factory=PluginConfig)
|
|
59
59
|
slack_plugin: PluginConfig = field(default_factory=PluginConfig)
|
|
60
|
+
slack_webhook: Optional[str] = None
|
|
60
61
|
license_file_name: str = "license_output.json"
|
|
61
62
|
save_submitted_files_list: Optional[str] = None
|
|
62
63
|
save_manifest_tar: Optional[str] = None
|
|
@@ -85,8 +86,14 @@ class CliConfig:
|
|
|
85
86
|
parser = create_argument_parser()
|
|
86
87
|
args = parser.parse_args(args_list)
|
|
87
88
|
|
|
88
|
-
# Get API token from env or args
|
|
89
|
-
api_token =
|
|
89
|
+
# Get API token from env or args (check multiple env var names)
|
|
90
|
+
api_token = (
|
|
91
|
+
os.getenv("SOCKET_SECURITY_API_KEY") or
|
|
92
|
+
os.getenv("SOCKET_SECURITY_API_TOKEN") or
|
|
93
|
+
os.getenv("SOCKET_API_KEY") or
|
|
94
|
+
os.getenv("SOCKET_API_TOKEN") or
|
|
95
|
+
args.api_token
|
|
96
|
+
)
|
|
90
97
|
|
|
91
98
|
# Strip quotes from commit message if present
|
|
92
99
|
commit_message = args.commit_message
|
|
@@ -128,6 +135,7 @@ class CliConfig:
|
|
|
128
135
|
'save_manifest_tar': args.save_manifest_tar,
|
|
129
136
|
'sub_paths': args.sub_paths or [],
|
|
130
137
|
'workspace_name': args.workspace_name,
|
|
138
|
+
'slack_webhook': args.slack_webhook,
|
|
131
139
|
'reach': args.reach,
|
|
132
140
|
'reach_version': args.reach_version,
|
|
133
141
|
'reach_analysis_timeout': args.reach_analysis_timeout,
|
|
@@ -151,6 +159,11 @@ class CliConfig:
|
|
|
151
159
|
except json.JSONDecodeError:
|
|
152
160
|
logging.error(f"Unable to parse excluded_ecosystems: {config_args['excluded_ecosystems']}")
|
|
153
161
|
exit(1)
|
|
162
|
+
# Build Slack plugin config, merging CLI arg with env config
|
|
163
|
+
slack_config = get_plugin_config_from_env("SOCKET_SLACK")
|
|
164
|
+
if args.slack_webhook:
|
|
165
|
+
slack_config["url"] = args.slack_webhook
|
|
166
|
+
|
|
154
167
|
config_args.update({
|
|
155
168
|
"jira_plugin": PluginConfig(
|
|
156
169
|
enabled=os.getenv("SOCKET_JIRA_ENABLED", "false").lower() == "true",
|
|
@@ -158,9 +171,9 @@ class CliConfig:
|
|
|
158
171
|
config=get_plugin_config_from_env("SOCKET_JIRA")
|
|
159
172
|
),
|
|
160
173
|
"slack_plugin": PluginConfig(
|
|
161
|
-
enabled=
|
|
174
|
+
enabled=bool(slack_config) or bool(args.slack_webhook),
|
|
162
175
|
levels=os.getenv("SOCKET_SLACK_LEVELS", "block,warn").split(","),
|
|
163
|
-
config=
|
|
176
|
+
config=slack_config
|
|
164
177
|
)
|
|
165
178
|
})
|
|
166
179
|
|
|
@@ -212,7 +225,7 @@ def create_argument_parser() -> argparse.ArgumentParser:
|
|
|
212
225
|
"--api-token",
|
|
213
226
|
dest="api_token",
|
|
214
227
|
metavar="<token>",
|
|
215
|
-
help="Socket Security API token (can also be set via
|
|
228
|
+
help="Socket Security API token (can also be set via SOCKET_SECURITY_API_TOKEN env var)",
|
|
216
229
|
required=False
|
|
217
230
|
)
|
|
218
231
|
auth_group.add_argument(
|
|
@@ -475,6 +488,15 @@ def create_argument_parser() -> argparse.ArgumentParser:
|
|
|
475
488
|
help=argparse.SUPPRESS
|
|
476
489
|
)
|
|
477
490
|
|
|
491
|
+
# Plugin Configuration
|
|
492
|
+
plugin_group = parser.add_argument_group('Plugin Configuration')
|
|
493
|
+
plugin_group.add_argument(
|
|
494
|
+
"--slack-webhook",
|
|
495
|
+
dest="slack_webhook",
|
|
496
|
+
metavar="<url>",
|
|
497
|
+
help="Slack webhook URL for notifications (automatically enables Slack plugin)"
|
|
498
|
+
)
|
|
499
|
+
|
|
478
500
|
# Advanced Configuration
|
|
479
501
|
advanced_group = parser.add_argument_group('Advanced Configuration')
|
|
480
502
|
advanced_group.add_argument(
|
|
@@ -4,13 +4,10 @@ import sys
|
|
|
4
4
|
import tarfile
|
|
5
5
|
import tempfile
|
|
6
6
|
import time
|
|
7
|
-
import io
|
|
8
7
|
import json
|
|
9
8
|
from dataclasses import asdict
|
|
10
|
-
from
|
|
11
|
-
from
|
|
12
|
-
from pathlib import PurePath
|
|
13
|
-
from typing import BinaryIO, Dict, List, Tuple, Set, Union, TYPE_CHECKING, Optional
|
|
9
|
+
from pathlib import Path, PurePath
|
|
10
|
+
from typing import Dict, List, Tuple, Set, TYPE_CHECKING, Optional
|
|
14
11
|
|
|
15
12
|
if TYPE_CHECKING:
|
|
16
13
|
from socketsecurity.config import CliConfig
|
|
@@ -315,15 +312,18 @@ class Core:
|
|
|
315
312
|
|
|
316
313
|
for pattern in expanded_patterns:
|
|
317
314
|
case_insensitive_pattern = Core.to_case_insensitive_regex(pattern)
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
log.debug(f"Globbing {file_path}")
|
|
315
|
+
|
|
316
|
+
log.debug(f"Searching for pattern: {case_insensitive_pattern}")
|
|
321
317
|
glob_start = time.time()
|
|
322
|
-
|
|
318
|
+
|
|
319
|
+
# Use pathlib.Path.rglob() instead of glob.glob() to properly match dotfiles/dotdirs
|
|
320
|
+
base_path = Path(path)
|
|
321
|
+
glob_files = base_path.rglob(case_insensitive_pattern)
|
|
323
322
|
|
|
324
323
|
for glob_file in glob_files:
|
|
325
|
-
|
|
326
|
-
|
|
324
|
+
glob_file_str = str(glob_file)
|
|
325
|
+
if os.path.isfile(glob_file_str) and not Core.is_excluded(glob_file_str, self.config.excluded_dirs):
|
|
326
|
+
files.add(glob_file_str.replace("\\", "/"))
|
|
327
327
|
|
|
328
328
|
glob_end = time.time()
|
|
329
329
|
log.debug(f"Globbing took {glob_end - glob_start:.4f} seconds")
|
|
@@ -414,6 +414,11 @@ class Core:
|
|
|
414
414
|
# Expand brace patterns for each manifest pattern
|
|
415
415
|
expanded_patterns = Core.expand_brace_pattern(pattern_str)
|
|
416
416
|
for exp_pat in expanded_patterns:
|
|
417
|
+
# If pattern doesn't contain '/', prepend '**/' to match files in any subdirectory
|
|
418
|
+
# This ensures patterns like '*requirements.txt' match '.test/requirements.txt'
|
|
419
|
+
if '/' not in exp_pat:
|
|
420
|
+
exp_pat = f"**/{exp_pat}"
|
|
421
|
+
|
|
417
422
|
for file in norm_files:
|
|
418
423
|
# Use PurePath.match for glob-like matching
|
|
419
424
|
if PurePath(file).match(exp_pat):
|