socketsecurity 2.2.7__tar.gz → 2.2.8__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.7 → socketsecurity-2.2.8}/PKG-INFO +2 -2
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/pyproject.toml +2 -2
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/__init__.py +1 -1
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/core/__init__.py +6 -5
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/core/messages.py +108 -7
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/socketcli.py +1 -1
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/uv.lock +5 -5
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/.github/CODEOWNERS +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/.github/PULL_REQUEST_TEMPLATE/bug-fix.md +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/.github/PULL_REQUEST_TEMPLATE/improvement.md +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/.github/workflows/docker-stable.yml +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/.github/workflows/pr-preview.yml +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/.github/workflows/release.yml +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/.github/workflows/version-check.yml +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/.gitignore +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/.hooks/sync_version.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/.pre-commit-config.yaml +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/.python-version +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/Dockerfile +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/LICENSE +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/Makefile +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/Pipfile.lock +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/README.md +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/docs/README.md +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/pytest.ini +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/scripts/build_container.sh +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/scripts/deploy-test-docker.sh +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/scripts/deploy-test-pypi.sh +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/scripts/run.sh +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/config.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/core/classes.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/core/cli_client.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/core/exceptions.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/core/git_interface.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/core/helper/__init__.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/core/lazy_file_loader.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/core/logging.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/core/resource_utils.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/core/scm/__init__.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/core/scm/base.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/core/scm/client.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/core/scm/github.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/core/scm/gitlab.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/core/scm_comments.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/core/socket_config.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/core/utils.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/output.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/plugins/__init__.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/plugins/base.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/plugins/jira.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/plugins/manager.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/plugins/slack.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/plugins/teams.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/socketsecurity/plugins/webhook.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/__init__.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/core/conftest.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/core/create_diff_input.json +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/core/test_diff_generation.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/core/test_package_and_alerts.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/core/test_sdk_methods.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/core/test_supporting_methods.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/data/fullscans/create_response.json +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/data/fullscans/diff/stream_diff.json +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/data/fullscans/diff/stream_diff_full.json +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/data/fullscans/head_scan/metadata.json +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/data/fullscans/head_scan/stream_scan.json +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/data/fullscans/head_scan/stream_scan_full.json +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/data/fullscans/new_scan/metadata.json +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/data/fullscans/new_scan/stream_scan.json +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/data/repos/repo_info_error.json +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/data/repos/repo_info_no_head.json +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/data/repos/repo_info_success.json +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/data/settings/security-policy.json +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/unit/__init__.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/unit/test_cli_config.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/unit/test_client.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/unit/test_config.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/unit/test_gitlab_auth.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/unit/test_gitlab_auth_fallback.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/unit/test_output.py +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/workflows/bitbucket-pipelines.yml +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/workflows/github-actions.yml +0 -0
- {socketsecurity-2.2.7 → socketsecurity-2.2.8}/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.8
|
|
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>
|
|
@@ -39,7 +39,7 @@ Requires-Dist: packaging
|
|
|
39
39
|
Requires-Dist: prettytable
|
|
40
40
|
Requires-Dist: python-dotenv
|
|
41
41
|
Requires-Dist: requests
|
|
42
|
-
Requires-Dist: socketdev<4.0.0,>=3.0.
|
|
42
|
+
Requires-Dist: socketdev<4.0.0,>=3.0.5
|
|
43
43
|
Provides-Extra: dev
|
|
44
44
|
Requires-Dist: hatch; extra == 'dev'
|
|
45
45
|
Requires-Dist: pre-commit; extra == 'dev'
|
|
@@ -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.8"
|
|
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.
|
|
19
|
+
'socketdev>=3.0.5,<4.0.0'
|
|
20
20
|
]
|
|
21
21
|
readme = "README.md"
|
|
22
22
|
description = "Socket Security CLI for CI/CD"
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
__author__ = 'socket.dev'
|
|
2
|
-
__version__ = '2.2.
|
|
2
|
+
__version__ = '2.2.8'
|
|
@@ -451,13 +451,14 @@ class Core:
|
|
|
451
451
|
log.debug(f"Created temporary empty file for baseline scan: {temp_path}")
|
|
452
452
|
return [temp_path]
|
|
453
453
|
|
|
454
|
-
def create_full_scan(self, files: List[str], params: FullScanParams) -> FullScan:
|
|
454
|
+
def create_full_scan(self, files: List[str], params: FullScanParams, base_path: str = None) -> FullScan:
|
|
455
455
|
"""
|
|
456
456
|
Creates a new full scan via the Socket API.
|
|
457
457
|
|
|
458
458
|
Args:
|
|
459
459
|
files: List of file paths to scan
|
|
460
460
|
params: Parameters for the full scan
|
|
461
|
+
base_path: Base path for the scan (optional)
|
|
461
462
|
|
|
462
463
|
Returns:
|
|
463
464
|
FullScan object with scan results
|
|
@@ -465,7 +466,7 @@ class Core:
|
|
|
465
466
|
log.info("Creating new full scan")
|
|
466
467
|
create_full_start = time.time()
|
|
467
468
|
|
|
468
|
-
res = self.sdk.fullscans.post(files, params, use_types=True, use_lazy_loading=True, max_open_files=50)
|
|
469
|
+
res = self.sdk.fullscans.post(files, params, use_types=True, use_lazy_loading=True, max_open_files=50, base_path=base_path)
|
|
469
470
|
if not res.success:
|
|
470
471
|
log.error(f"Error creating full scan: {res.message}, status: {res.status}")
|
|
471
472
|
raise Exception(f"Error creating full scan: {res.message}, status: {res.status}")
|
|
@@ -523,7 +524,7 @@ class Core:
|
|
|
523
524
|
try:
|
|
524
525
|
# Create new scan
|
|
525
526
|
new_scan_start = time.time()
|
|
526
|
-
new_full_scan = self.create_full_scan(files, params)
|
|
527
|
+
new_full_scan = self.create_full_scan(files, params, base_path=path)
|
|
527
528
|
new_scan_end = time.time()
|
|
528
529
|
log.info(f"Total time to create new full scan: {new_scan_end - new_scan_start:.2f}")
|
|
529
530
|
except APIFailure as e:
|
|
@@ -899,7 +900,7 @@ class Core:
|
|
|
899
900
|
# Create baseline scan with empty file
|
|
900
901
|
empty_files = Core.empty_head_scan_file()
|
|
901
902
|
try:
|
|
902
|
-
head_full_scan = self.create_full_scan(empty_files, tmp_params)
|
|
903
|
+
head_full_scan = self.create_full_scan(empty_files, tmp_params, base_path=path)
|
|
903
904
|
head_full_scan_id = head_full_scan.id
|
|
904
905
|
log.debug(f"Created empty baseline scan: {head_full_scan_id}")
|
|
905
906
|
|
|
@@ -922,7 +923,7 @@ class Core:
|
|
|
922
923
|
# Create new scan
|
|
923
924
|
try:
|
|
924
925
|
new_scan_start = time.time()
|
|
925
|
-
new_full_scan = self.create_full_scan(files, params)
|
|
926
|
+
new_full_scan = self.create_full_scan(files, params, base_path=path)
|
|
926
927
|
new_scan_end = time.time()
|
|
927
928
|
log.info(f"Total time to create new full scan: {new_scan_end - new_scan_start:.2f}")
|
|
928
929
|
except APIFailure as e:
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import json
|
|
2
2
|
import logging
|
|
3
|
+
import os
|
|
3
4
|
import re
|
|
4
5
|
from pathlib import Path
|
|
5
6
|
from mdutils import MdUtils
|
|
@@ -29,6 +30,92 @@ class Messages:
|
|
|
29
30
|
}
|
|
30
31
|
return severity_mapping.get(severity.lower(), "note")
|
|
31
32
|
|
|
33
|
+
@staticmethod
|
|
34
|
+
def get_manifest_file_url(diff: Diff, manifest_path: str, config=None) -> str:
|
|
35
|
+
"""
|
|
36
|
+
Generate proper URL for manifest file based on the repository type and diff URL.
|
|
37
|
+
|
|
38
|
+
:param diff: Diff object containing diff_url and report_url
|
|
39
|
+
:param manifest_path: Path to the manifest file (can contain multiple files separated by ';')
|
|
40
|
+
:param config: Configuration object to determine SCM type
|
|
41
|
+
:return: Properly formatted URL for the manifest file
|
|
42
|
+
"""
|
|
43
|
+
if not manifest_path:
|
|
44
|
+
return ""
|
|
45
|
+
|
|
46
|
+
# Handle multiple manifest files separated by ';' - use the first one
|
|
47
|
+
first_manifest = manifest_path.split(';')[0] if ';' in manifest_path else manifest_path
|
|
48
|
+
|
|
49
|
+
# Clean up the manifest path - remove build agent paths and normalize
|
|
50
|
+
clean_path = first_manifest
|
|
51
|
+
|
|
52
|
+
# Remove common build agent path prefixes
|
|
53
|
+
prefixes_to_remove = [
|
|
54
|
+
'opt/buildagent/work/',
|
|
55
|
+
'/opt/buildagent/work/',
|
|
56
|
+
'home/runner/work/',
|
|
57
|
+
'/home/runner/work/',
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
for prefix in prefixes_to_remove:
|
|
61
|
+
if clean_path.startswith(prefix):
|
|
62
|
+
# Find the part after the build ID (usually a hash)
|
|
63
|
+
parts = clean_path[len(prefix):].split('/', 2)
|
|
64
|
+
if len(parts) >= 3:
|
|
65
|
+
clean_path = parts[2] # Take everything after build ID and repo name
|
|
66
|
+
break
|
|
67
|
+
|
|
68
|
+
# Remove leading slashes
|
|
69
|
+
clean_path = clean_path.lstrip('/')
|
|
70
|
+
|
|
71
|
+
# Determine SCM type from config or diff_url
|
|
72
|
+
scm_type = "api" # Default to API
|
|
73
|
+
if config and hasattr(config, 'scm'):
|
|
74
|
+
scm_type = config.scm.lower()
|
|
75
|
+
elif hasattr(diff, 'diff_url') and diff.diff_url:
|
|
76
|
+
diff_url = diff.diff_url.lower()
|
|
77
|
+
if 'github.com' in diff_url or 'github' in diff_url:
|
|
78
|
+
scm_type = "github"
|
|
79
|
+
elif 'gitlab' in diff_url:
|
|
80
|
+
scm_type = "gitlab"
|
|
81
|
+
elif 'bitbucket' in diff_url:
|
|
82
|
+
scm_type = "bitbucket"
|
|
83
|
+
|
|
84
|
+
# Generate URL based on SCM type using config information
|
|
85
|
+
# NEVER use diff.diff_url for SCM URLs - those are Socket URLs for "View report" links
|
|
86
|
+
if scm_type == "github":
|
|
87
|
+
if config and hasattr(config, 'repo') and config.repo:
|
|
88
|
+
# Get branch from config, default to main
|
|
89
|
+
branch = getattr(config, 'branch', 'main') if hasattr(config, 'branch') and config.branch else 'main'
|
|
90
|
+
# Construct GitHub URL from repo info (could be github.com or GitHub Enterprise)
|
|
91
|
+
github_server = os.getenv('GITHUB_SERVER_URL', 'https://github.com')
|
|
92
|
+
return f"{github_server}/{config.repo}/blob/{branch}/{clean_path}"
|
|
93
|
+
|
|
94
|
+
elif scm_type == "gitlab":
|
|
95
|
+
if config and hasattr(config, 'repo') and config.repo:
|
|
96
|
+
# Get branch from config, default to main
|
|
97
|
+
branch = getattr(config, 'branch', 'main') if hasattr(config, 'branch') and config.branch else 'main'
|
|
98
|
+
# Construct GitLab URL from repo info (could be gitlab.com or self-hosted GitLab)
|
|
99
|
+
gitlab_server = os.getenv('CI_SERVER_URL', 'https://gitlab.com')
|
|
100
|
+
return f"{gitlab_server}/{config.repo}/-/blob/{branch}/{clean_path}"
|
|
101
|
+
|
|
102
|
+
elif scm_type == "bitbucket":
|
|
103
|
+
if config and hasattr(config, 'repo') and config.repo:
|
|
104
|
+
# Get branch from config, default to main
|
|
105
|
+
branch = getattr(config, 'branch', 'main') if hasattr(config, 'branch') and config.branch else 'main'
|
|
106
|
+
# Construct Bitbucket URL from repo info (could be bitbucket.org or Bitbucket Server)
|
|
107
|
+
bitbucket_server = os.getenv('BITBUCKET_SERVER_URL', 'https://bitbucket.org')
|
|
108
|
+
return f"{bitbucket_server}/{config.repo}/src/{branch}/{clean_path}"
|
|
109
|
+
|
|
110
|
+
# Fallback to Socket file view for API or unknown repository types
|
|
111
|
+
if hasattr(diff, 'report_url') and diff.report_url:
|
|
112
|
+
# Strip leading slash and URL encode for Socket dashboard
|
|
113
|
+
socket_path = clean_path.lstrip('/')
|
|
114
|
+
encoded_path = socket_path.replace('/', '%2F')
|
|
115
|
+
return f"{diff.report_url}?tab=files&file={encoded_path}"
|
|
116
|
+
|
|
117
|
+
return ""
|
|
118
|
+
|
|
32
119
|
@staticmethod
|
|
33
120
|
def find_line_in_file(packagename: str, packageversion: str, manifest_file: str) -> tuple:
|
|
34
121
|
"""
|
|
@@ -301,12 +388,13 @@ class Messages:
|
|
|
301
388
|
return output
|
|
302
389
|
|
|
303
390
|
@staticmethod
|
|
304
|
-
def security_comment_template(diff: Diff) -> str:
|
|
391
|
+
def security_comment_template(diff: Diff, config=None) -> str:
|
|
305
392
|
"""
|
|
306
393
|
Generates the security comment template in the new required format.
|
|
307
394
|
Dynamically determines placement of the alerts table if markers like `<!-- start-socket-alerts-table -->` are used.
|
|
308
395
|
|
|
309
396
|
:param diff: Diff - Contains the detected vulnerabilities and warnings.
|
|
397
|
+
:param config: Optional configuration object to determine SCM type.
|
|
310
398
|
:return: str - The formatted Markdown/HTML string.
|
|
311
399
|
"""
|
|
312
400
|
# Group license policy violations by PURL (ecosystem/package@version)
|
|
@@ -348,6 +436,8 @@ class Messages:
|
|
|
348
436
|
severity_icon = Messages.get_severity_icon(alert.severity)
|
|
349
437
|
action = "Block" if alert.error else "Warn"
|
|
350
438
|
details_open = ""
|
|
439
|
+
# Generate proper manifest URL
|
|
440
|
+
manifest_url = Messages.get_manifest_file_url(diff, alert.manifests, config)
|
|
351
441
|
# Generate a table row for each alert
|
|
352
442
|
comment += f"""
|
|
353
443
|
<!-- start-socket-alert-{alert.pkg_name}@{alert.pkg_version} -->
|
|
@@ -360,7 +450,7 @@ class Messages:
|
|
|
360
450
|
<details {details_open}>
|
|
361
451
|
<summary>{alert.pkg_name}@{alert.pkg_version} - {alert.title}</summary>
|
|
362
452
|
<p><strong>Note:</strong> {alert.description}</p>
|
|
363
|
-
<p><strong>Source:</strong> <a href="{
|
|
453
|
+
<p><strong>Source:</strong> <a href="{manifest_url}">Manifest File</a></p>
|
|
364
454
|
<p>ℹ️ Read more on:
|
|
365
455
|
<a href="{alert.purl}">This package</a> |
|
|
366
456
|
<a href="{alert.url}">This alert</a> |
|
|
@@ -405,8 +495,12 @@ class Messages:
|
|
|
405
495
|
for finding in license_findings:
|
|
406
496
|
comment += f" <li>{finding}</li>\n"
|
|
407
497
|
|
|
498
|
+
|
|
499
|
+
# Generate proper manifest URL for license violations
|
|
500
|
+
license_manifest_url = Messages.get_manifest_file_url(diff, first_alert.manifests, config)
|
|
501
|
+
|
|
408
502
|
comment += f""" </ul>
|
|
409
|
-
<p><strong>From:</strong> {
|
|
503
|
+
<p><strong>From:</strong> <a href="{license_manifest_url}">Manifest File</a></p>
|
|
410
504
|
<p>ℹ️ Read more on: <a href="{first_alert.purl}">This package</a> | <a href="https://socket.dev/alerts/license">What is a license policy violation?</a></p>
|
|
411
505
|
<blockquote>
|
|
412
506
|
<p><em>Next steps:</em> Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at <strong>support@socket.dev</strong>.</p>
|
|
@@ -420,12 +514,19 @@ class Messages:
|
|
|
420
514
|
"""
|
|
421
515
|
|
|
422
516
|
# Close table
|
|
423
|
-
|
|
517
|
+
# Use diff_url for PRs, report_url for non-PR scans
|
|
518
|
+
view_report_url = ""
|
|
519
|
+
if hasattr(diff, 'diff_url') and diff.diff_url:
|
|
520
|
+
view_report_url = diff.diff_url
|
|
521
|
+
elif hasattr(diff, 'report_url') and diff.report_url:
|
|
522
|
+
view_report_url = diff.report_url
|
|
523
|
+
|
|
524
|
+
comment += f"""
|
|
424
525
|
</tbody>
|
|
425
526
|
</table>
|
|
426
527
|
<!-- end-socket-alerts-table -->
|
|
427
528
|
|
|
428
|
-
[View full report](
|
|
529
|
+
[View full report]({view_report_url}?action=error%2Cwarn)
|
|
429
530
|
"""
|
|
430
531
|
|
|
431
532
|
return comment
|
|
@@ -519,7 +620,7 @@ class Messages:
|
|
|
519
620
|
return md
|
|
520
621
|
|
|
521
622
|
@staticmethod
|
|
522
|
-
def create_security_alert_table(diff: Diff, md: MdUtils) ->
|
|
623
|
+
def create_security_alert_table(diff: Diff, md: MdUtils) -> tuple[MdUtils, list, dict]:
|
|
523
624
|
"""
|
|
524
625
|
Creates the detected issues table based on the Security Policy
|
|
525
626
|
:param diff: Diff - Diff report with the detected issues
|
|
@@ -730,7 +831,7 @@ class Messages:
|
|
|
730
831
|
return alert_table
|
|
731
832
|
|
|
732
833
|
@staticmethod
|
|
733
|
-
def create_sources(alert: Issue, style="md") -> [str, str]:
|
|
834
|
+
def create_sources(alert: Issue, style="md") -> tuple[str, str]:
|
|
734
835
|
sources = []
|
|
735
836
|
manifests = []
|
|
736
837
|
|
|
@@ -275,7 +275,7 @@ def main_code():
|
|
|
275
275
|
overview_comment = Messages.dependency_overview_template(diff)
|
|
276
276
|
log.debug("Creating Security Issues Comment")
|
|
277
277
|
|
|
278
|
-
security_comment = Messages.security_comment_template(diff)
|
|
278
|
+
security_comment = Messages.security_comment_template(diff, config)
|
|
279
279
|
|
|
280
280
|
new_security_comment = True
|
|
281
281
|
new_overview_comment = True
|
|
@@ -1027,20 +1027,20 @@ wheels = [
|
|
|
1027
1027
|
|
|
1028
1028
|
[[package]]
|
|
1029
1029
|
name = "socketdev"
|
|
1030
|
-
version = "3.0.
|
|
1030
|
+
version = "3.0.5"
|
|
1031
1031
|
source = { registry = "https://pypi.org/simple" }
|
|
1032
1032
|
dependencies = [
|
|
1033
1033
|
{ name = "requests" },
|
|
1034
1034
|
{ name = "typing-extensions" },
|
|
1035
1035
|
]
|
|
1036
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
1036
|
+
sdist = { url = "https://files.pythonhosted.org/packages/19/b7/fe90d55105df76e9ff3af025f64b2d2b515c30ac0866a9973a093f25c5ed/socketdev-3.0.5.tar.gz", hash = "sha256:58cbe8613c3c892cdbae4941cb53f065051f8e991500d9d61618b214acf4ffc2", size = 129576, upload-time = "2025-09-09T07:15:48.232Z" }
|
|
1037
1037
|
wheels = [
|
|
1038
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1038
|
+
{ url = "https://files.pythonhosted.org/packages/de/05/c3fc7d0418c2598302ad4b0baf111fa492b31a8fa14acfa394af6f55b373/socketdev-3.0.5-py3-none-any.whl", hash = "sha256:e050f50d2c6b4447107edd3368b56b053e1df62056d424cc1616e898303638ef", size = 55083, upload-time = "2025-09-09T07:15:46.52Z" },
|
|
1039
1039
|
]
|
|
1040
1040
|
|
|
1041
1041
|
[[package]]
|
|
1042
1042
|
name = "socketsecurity"
|
|
1043
|
-
version = "2.2.
|
|
1043
|
+
version = "2.2.7"
|
|
1044
1044
|
source = { editable = "." }
|
|
1045
1045
|
dependencies = [
|
|
1046
1046
|
{ name = "gitpython" },
|
|
@@ -1084,7 +1084,7 @@ requires-dist = [
|
|
|
1084
1084
|
{ name = "python-dotenv" },
|
|
1085
1085
|
{ name = "requests" },
|
|
1086
1086
|
{ name = "ruff", marker = "extra == 'dev'", specifier = ">=0.3.0" },
|
|
1087
|
-
{ name = "socketdev", specifier = ">=3.0.
|
|
1087
|
+
{ name = "socketdev", specifier = ">=3.0.5,<4.0.0" },
|
|
1088
1088
|
{ name = "twine", marker = "extra == 'dev'" },
|
|
1089
1089
|
{ name = "uv", marker = "extra == 'dev'", specifier = ">=0.1.0" },
|
|
1090
1090
|
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/data/fullscans/diff/stream_diff_full.json
RENAMED
|
File without changes
|
|
File without changes
|
{socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/data/fullscans/head_scan/stream_scan.json
RENAMED
|
File without changes
|
{socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/data/fullscans/head_scan/stream_scan_full.json
RENAMED
|
File without changes
|
|
File without changes
|
{socketsecurity-2.2.7 → socketsecurity-2.2.8}/tests/data/fullscans/new_scan/stream_scan.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|