socketsecurity 2.2.11__tar.gz → 2.2.15__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.11 → socketsecurity-2.2.15}/.github/workflows/pr-preview.yml +8 -8
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/.github/workflows/release.yml +7 -7
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/.github/workflows/version-check.yml +2 -2
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/PKG-INFO +1 -1
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/pyproject.toml +1 -1
- socketsecurity-2.2.15/socketsecurity/__init__.py +3 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/core/__init__.py +2 -1
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/core/cli_client.py +2 -1
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/core/resource_utils.py +21 -8
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/core/scm/client.py +3 -2
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/core/scm/github.py +2 -1
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/core/scm/gitlab.py +8 -7
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/socketcli.py +1 -1
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/unit/test_gitlab_auth.py +2 -1
- socketsecurity-2.2.11/Pipfile.lock +0 -20
- socketsecurity-2.2.11/socketsecurity/__init__.py +0 -2
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/.github/CODEOWNERS +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/.github/PULL_REQUEST_TEMPLATE/bug-fix.md +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/.github/PULL_REQUEST_TEMPLATE/feature.md +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/.github/PULL_REQUEST_TEMPLATE/improvement.md +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/.github/workflows/docker-stable.yml +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/.gitignore +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/.hooks/sync_version.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/.pre-commit-config.yaml +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/.python-version +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/Dockerfile +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/LICENSE +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/Makefile +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/README.md +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/docs/README.md +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/pytest.ini +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/scripts/build_container.sh +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/scripts/deploy-test-docker.sh +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/scripts/deploy-test-pypi.sh +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/scripts/run.sh +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/config.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/core/classes.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/core/exceptions.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/core/git_interface.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/core/helper/__init__.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/core/lazy_file_loader.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/core/logging.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/core/messages.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/core/scm/__init__.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/core/scm/base.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/core/scm_comments.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/core/socket_config.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/core/utils.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/output.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/plugins/__init__.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/plugins/base.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/plugins/jira.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/plugins/manager.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/plugins/slack.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/plugins/teams.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/socketsecurity/plugins/webhook.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/__init__.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/core/conftest.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/core/create_diff_input.json +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/core/test_diff_generation.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/core/test_package_and_alerts.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/core/test_sdk_methods.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/core/test_supporting_methods.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/data/fullscans/create_response.json +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/data/fullscans/diff/stream_diff.json +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/data/fullscans/diff/stream_diff_full.json +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/data/fullscans/head_scan/metadata.json +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/data/fullscans/head_scan/stream_scan.json +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/data/fullscans/head_scan/stream_scan_full.json +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/data/fullscans/new_scan/metadata.json +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/data/fullscans/new_scan/stream_scan.json +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/data/repos/repo_info_error.json +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/data/repos/repo_info_no_head.json +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/data/repos/repo_info_success.json +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/data/settings/security-policy.json +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/unit/__init__.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/unit/test_cli_config.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/unit/test_client.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/unit/test_config.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/unit/test_gitlab_auth_fallback.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/unit/test_output.py +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/uv.lock +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/workflows/bitbucket-pipelines.yml +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/workflows/github-actions.yml +0 -0
- {socketsecurity-2.2.11 → socketsecurity-2.2.15}/workflows/gitlab-ci.yml +0 -0
|
@@ -11,10 +11,10 @@ jobs:
|
|
|
11
11
|
contents: read
|
|
12
12
|
pull-requests: write
|
|
13
13
|
steps:
|
|
14
|
-
- uses: actions/checkout@
|
|
14
|
+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
|
|
15
15
|
with:
|
|
16
16
|
fetch-depth: 0
|
|
17
|
-
- uses: actions/setup-python@
|
|
17
|
+
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3
|
|
18
18
|
with:
|
|
19
19
|
python-version: '3.x'
|
|
20
20
|
|
|
@@ -43,14 +43,14 @@ jobs:
|
|
|
43
43
|
|
|
44
44
|
- name: Publish to Test PyPI
|
|
45
45
|
if: steps.version_check.outputs.exists != 'true'
|
|
46
|
-
uses: pypa/gh-action-pypi-publish@
|
|
46
|
+
uses: pypa/gh-action-pypi-publish@ab69e431e9c9f48a3310be0a56527c679f56e04d
|
|
47
47
|
with:
|
|
48
48
|
repository-url: https://test.pypi.org/legacy/
|
|
49
49
|
verbose: true
|
|
50
50
|
|
|
51
51
|
- name: Comment on PR
|
|
52
52
|
if: steps.version_check.outputs.exists != 'true'
|
|
53
|
-
uses: actions/github-script@
|
|
53
|
+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
|
|
54
54
|
env:
|
|
55
55
|
VERSION: ${{ env.VERSION }}
|
|
56
56
|
with:
|
|
@@ -120,21 +120,21 @@ jobs:
|
|
|
120
120
|
exit 1
|
|
121
121
|
|
|
122
122
|
- name: Set up QEMU
|
|
123
|
-
uses: docker/setup-qemu-action@
|
|
123
|
+
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf
|
|
124
124
|
|
|
125
125
|
- name: Set up Docker Buildx
|
|
126
|
-
uses: docker/setup-buildx-action@
|
|
126
|
+
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349
|
|
127
127
|
|
|
128
128
|
- name: Login to Docker Hub with Organization Token
|
|
129
129
|
if: steps.verify_package.outputs.success == 'true'
|
|
130
|
-
uses: docker/login-action@
|
|
130
|
+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
|
|
131
131
|
with:
|
|
132
132
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
133
133
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
134
134
|
|
|
135
135
|
- name: Build & Push Docker Preview
|
|
136
136
|
if: steps.verify_package.outputs.success == 'true'
|
|
137
|
-
uses: docker/build-push-action@
|
|
137
|
+
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75
|
|
138
138
|
env:
|
|
139
139
|
VERSION: ${{ env.VERSION }}
|
|
140
140
|
with:
|
|
@@ -10,10 +10,10 @@ jobs:
|
|
|
10
10
|
id-token: write
|
|
11
11
|
contents: read
|
|
12
12
|
steps:
|
|
13
|
-
- uses: actions/checkout@
|
|
13
|
+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
|
|
14
14
|
with:
|
|
15
15
|
fetch-depth: 0
|
|
16
|
-
- uses: actions/setup-python@
|
|
16
|
+
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3
|
|
17
17
|
with:
|
|
18
18
|
python-version: '3.x'
|
|
19
19
|
|
|
@@ -66,16 +66,16 @@ jobs:
|
|
|
66
66
|
|
|
67
67
|
- name: Publish to PyPI
|
|
68
68
|
if: steps.version_check.outputs.pypi_exists != 'true'
|
|
69
|
-
uses: pypa/gh-action-pypi-publish@
|
|
69
|
+
uses: pypa/gh-action-pypi-publish@ab69e431e9c9f48a3310be0a56527c679f56e04d
|
|
70
70
|
|
|
71
71
|
- name: Set up QEMU
|
|
72
|
-
uses: docker/setup-qemu-action@
|
|
72
|
+
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf
|
|
73
73
|
|
|
74
74
|
- name: Set up Docker Buildx
|
|
75
|
-
uses: docker/setup-buildx-action@
|
|
75
|
+
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349
|
|
76
76
|
|
|
77
77
|
- name: Login to Docker Hub with Organization Token
|
|
78
|
-
uses: docker/login-action@
|
|
78
|
+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
|
|
79
79
|
with:
|
|
80
80
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
81
81
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
@@ -102,7 +102,7 @@ jobs:
|
|
|
102
102
|
if: |
|
|
103
103
|
steps.verify_package.outputs.success == 'true' &&
|
|
104
104
|
steps.docker_check.outputs.docker_exists != 'true'
|
|
105
|
-
uses: docker/build-push-action@
|
|
105
|
+
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75
|
|
106
106
|
env:
|
|
107
107
|
VERSION: ${{ env.VERSION }}
|
|
108
108
|
with:
|
|
@@ -11,7 +11,7 @@ jobs:
|
|
|
11
11
|
check_version:
|
|
12
12
|
runs-on: ubuntu-latest
|
|
13
13
|
steps:
|
|
14
|
-
- uses: actions/checkout@
|
|
14
|
+
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871
|
|
15
15
|
with:
|
|
16
16
|
fetch-depth: 0 # Fetch all history for all branches
|
|
17
17
|
|
|
@@ -39,7 +39,7 @@ jobs:
|
|
|
39
39
|
"
|
|
40
40
|
|
|
41
41
|
- name: Manage PR Comment
|
|
42
|
-
uses: actions/github-script@
|
|
42
|
+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
|
|
43
43
|
if: always()
|
|
44
44
|
env:
|
|
45
45
|
MAIN_VERSION: ${{ env.MAIN_VERSION }}
|
|
@@ -18,7 +18,7 @@ from socketdev.org import Organization
|
|
|
18
18
|
from socketdev.repos import RepositoryInfo
|
|
19
19
|
from socketdev.settings import SecurityPolicyRule
|
|
20
20
|
import copy
|
|
21
|
-
from socketsecurity import __version__
|
|
21
|
+
from socketsecurity import __version__, USER_AGENT
|
|
22
22
|
from socketsecurity.core.classes import (
|
|
23
23
|
Alert,
|
|
24
24
|
Diff,
|
|
@@ -39,6 +39,7 @@ __all__ = [
|
|
|
39
39
|
"Core",
|
|
40
40
|
"log",
|
|
41
41
|
"__version__",
|
|
42
|
+
"USER_AGENT",
|
|
42
43
|
]
|
|
43
44
|
|
|
44
45
|
version = __version__
|
|
@@ -4,6 +4,7 @@ from typing import Dict, List, Optional, Union
|
|
|
4
4
|
|
|
5
5
|
import requests
|
|
6
6
|
|
|
7
|
+
from socketsecurity import USER_AGENT
|
|
7
8
|
from .exceptions import APIFailure
|
|
8
9
|
from .socket_config import SocketConfig
|
|
9
10
|
|
|
@@ -31,7 +32,7 @@ class CliClient:
|
|
|
31
32
|
|
|
32
33
|
default_headers = {
|
|
33
34
|
'Authorization': f"Basic {self._encoded_key}",
|
|
34
|
-
'User-Agent':
|
|
35
|
+
'User-Agent': USER_AGENT,
|
|
35
36
|
"accept": "application/json"
|
|
36
37
|
}
|
|
37
38
|
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
"""
|
|
2
2
|
System resource utilities for the Socket Security CLI.
|
|
3
3
|
"""
|
|
4
|
-
import resource
|
|
5
4
|
import logging
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
# The resource module is only available on Unix-like systems
|
|
8
|
+
resource_available = False
|
|
9
|
+
try:
|
|
10
|
+
import resource
|
|
11
|
+
resource_available = True
|
|
12
|
+
except ImportError:
|
|
13
|
+
# On Windows, the resource module is not available
|
|
14
|
+
pass
|
|
6
15
|
|
|
7
16
|
log = logging.getLogger("socketdev")
|
|
8
17
|
|
|
@@ -10,10 +19,14 @@ log = logging.getLogger("socketdev")
|
|
|
10
19
|
def get_file_descriptor_limit():
|
|
11
20
|
"""
|
|
12
21
|
Get the current file descriptor limit (equivalent to ulimit -n)
|
|
13
|
-
|
|
22
|
+
|
|
14
23
|
Returns:
|
|
15
|
-
tuple: (soft_limit, hard_limit) or (None, None) if error
|
|
24
|
+
tuple: (soft_limit, hard_limit) or (None, None) if error or on Windows
|
|
16
25
|
"""
|
|
26
|
+
if not resource_available:
|
|
27
|
+
# On Windows, resource module is not available
|
|
28
|
+
return None, None
|
|
29
|
+
|
|
17
30
|
try:
|
|
18
31
|
soft_limit, hard_limit = resource.getrlimit(resource.RLIMIT_NOFILE)
|
|
19
32
|
return soft_limit, hard_limit
|
|
@@ -25,26 +38,26 @@ def get_file_descriptor_limit():
|
|
|
25
38
|
def check_file_count_against_ulimit(file_count, buffer_size=100):
|
|
26
39
|
"""
|
|
27
40
|
Check if the number of files would exceed the file descriptor limit
|
|
28
|
-
|
|
41
|
+
|
|
29
42
|
Args:
|
|
30
43
|
file_count (int): Number of files to check
|
|
31
44
|
buffer_size (int): Safety buffer to leave for other file operations
|
|
32
|
-
|
|
45
|
+
|
|
33
46
|
Returns:
|
|
34
47
|
dict: Information about the check
|
|
35
48
|
"""
|
|
36
49
|
soft_limit, hard_limit = get_file_descriptor_limit()
|
|
37
|
-
|
|
50
|
+
|
|
38
51
|
if soft_limit is None:
|
|
39
52
|
return {
|
|
40
53
|
"can_check": False,
|
|
41
54
|
"error": "Could not determine file descriptor limit",
|
|
42
55
|
"safe_to_process": True # Assume safe if we can't check
|
|
43
56
|
}
|
|
44
|
-
|
|
57
|
+
|
|
45
58
|
available_fds = soft_limit - buffer_size
|
|
46
59
|
would_exceed = file_count > available_fds
|
|
47
|
-
|
|
60
|
+
|
|
48
61
|
return {
|
|
49
62
|
"can_check": True,
|
|
50
63
|
"file_count": file_count,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from abc import abstractmethod
|
|
2
2
|
from typing import Dict
|
|
3
3
|
|
|
4
|
+
from socketsecurity import USER_AGENT
|
|
4
5
|
from ..cli_client import CliClient
|
|
5
6
|
|
|
6
7
|
|
|
@@ -28,7 +29,7 @@ class GithubClient(ScmClient):
|
|
|
28
29
|
def get_headers(self) -> Dict:
|
|
29
30
|
return {
|
|
30
31
|
'Authorization': f"Bearer {self.token}",
|
|
31
|
-
'User-Agent':
|
|
32
|
+
'User-Agent': USER_AGENT,
|
|
32
33
|
"accept": "application/json"
|
|
33
34
|
}
|
|
34
35
|
|
|
@@ -52,7 +53,7 @@ class GitlabClient(ScmClient):
|
|
|
52
53
|
import os
|
|
53
54
|
|
|
54
55
|
base_headers = {
|
|
55
|
-
'User-Agent':
|
|
56
|
+
'User-Agent': USER_AGENT,
|
|
56
57
|
"accept": "application/json"
|
|
57
58
|
}
|
|
58
59
|
|
|
@@ -5,6 +5,7 @@ from dataclasses import dataclass
|
|
|
5
5
|
|
|
6
6
|
from git import Optional
|
|
7
7
|
|
|
8
|
+
from socketsecurity import USER_AGENT
|
|
8
9
|
from socketsecurity.core import log
|
|
9
10
|
from socketsecurity.core.classes import Comment
|
|
10
11
|
from socketsecurity.core.scm_comments import Comments
|
|
@@ -83,7 +84,7 @@ class GithubConfig:
|
|
|
83
84
|
event_action=event_action,
|
|
84
85
|
headers={
|
|
85
86
|
'Authorization': f"Bearer {token}",
|
|
86
|
-
'User-Agent':
|
|
87
|
+
'User-Agent': USER_AGENT,
|
|
87
88
|
"accept": "application/json"
|
|
88
89
|
}
|
|
89
90
|
)
|
|
@@ -3,6 +3,7 @@ import sys
|
|
|
3
3
|
from dataclasses import dataclass
|
|
4
4
|
from typing import Optional
|
|
5
5
|
|
|
6
|
+
from socketsecurity import USER_AGENT
|
|
6
7
|
from socketsecurity.core import log
|
|
7
8
|
from socketsecurity.core.classes import Comment
|
|
8
9
|
from socketsecurity.core.scm_comments import Comments
|
|
@@ -79,7 +80,7 @@ class GitlabConfig:
|
|
|
79
80
|
- Other tokens: Use PRIVATE-TOKEN as fallback
|
|
80
81
|
"""
|
|
81
82
|
base_headers = {
|
|
82
|
-
'User-Agent':
|
|
83
|
+
'User-Agent': USER_AGENT,
|
|
83
84
|
"accept": "application/json"
|
|
84
85
|
}
|
|
85
86
|
|
|
@@ -150,7 +151,7 @@ class Gitlab:
|
|
|
150
151
|
If using Bearer, fallback to PRIVATE-TOKEN and vice versa.
|
|
151
152
|
"""
|
|
152
153
|
base_headers = {
|
|
153
|
-
'User-Agent':
|
|
154
|
+
'User-Agent': USER_AGENT,
|
|
154
155
|
"accept": "application/json"
|
|
155
156
|
}
|
|
156
157
|
|
|
@@ -171,11 +172,11 @@ class Gitlab:
|
|
|
171
172
|
}
|
|
172
173
|
|
|
173
174
|
# No fallback available
|
|
174
|
-
return
|
|
175
|
+
return {}
|
|
175
176
|
|
|
176
177
|
def check_event_type(self) -> str:
|
|
177
178
|
pipeline_source = self.config.pipeline_source.lower()
|
|
178
|
-
if pipeline_source in ["web", 'merge_request_event', "push", "api"]:
|
|
179
|
+
if pipeline_source in ["web", 'merge_request_event', "push", "api", 'pipeline']:
|
|
179
180
|
if not self.config.mr_iid:
|
|
180
181
|
return "main"
|
|
181
182
|
return "diff"
|
|
@@ -234,8 +235,8 @@ class Gitlab:
|
|
|
234
235
|
new_security_comment: bool = True,
|
|
235
236
|
new_overview_comment: bool = True
|
|
236
237
|
) -> None:
|
|
237
|
-
existing_overview_comment = comments.get("overview")
|
|
238
|
-
existing_security_comment = comments.get("security")
|
|
238
|
+
existing_overview_comment = comments.get("overview", "")
|
|
239
|
+
existing_security_comment = comments.get("security", "")
|
|
239
240
|
if new_overview_comment:
|
|
240
241
|
log.debug("New Dependency Overview comment")
|
|
241
242
|
if existing_overview_comment is not None:
|
|
@@ -256,7 +257,7 @@ class Gitlab:
|
|
|
256
257
|
self.post_comment(security_comment)
|
|
257
258
|
|
|
258
259
|
def remove_comment_alerts(self, comments: dict):
|
|
259
|
-
security_alert = comments.get("security")
|
|
260
|
+
security_alert = comments.get("security", "")
|
|
260
261
|
if security_alert is not None:
|
|
261
262
|
security_alert: Comment
|
|
262
263
|
new_body = Comments.process_security_comment(security_alert, comments)
|
|
@@ -3,6 +3,7 @@ import os
|
|
|
3
3
|
import pytest
|
|
4
4
|
from unittest.mock import patch, MagicMock
|
|
5
5
|
|
|
6
|
+
from socketsecurity import USER_AGENT
|
|
6
7
|
from socketsecurity.core.scm.gitlab import GitlabConfig
|
|
7
8
|
|
|
8
9
|
|
|
@@ -58,7 +59,7 @@ class TestGitlabAuthHeaders:
|
|
|
58
59
|
|
|
59
60
|
for token in test_tokens:
|
|
60
61
|
headers = GitlabConfig._get_auth_headers(token)
|
|
61
|
-
assert headers['User-Agent'] ==
|
|
62
|
+
assert headers['User-Agent'] == USER_AGENT
|
|
62
63
|
assert headers['accept'] == 'application/json'
|
|
63
64
|
|
|
64
65
|
@patch.dict(os.environ, {'CI_JOB_TOKEN': 'ci-token-123'})
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"_meta": {
|
|
3
|
-
"hash": {
|
|
4
|
-
"sha256": "7e8ad3d0508bf0c279a648ee7a1873fc16334cf0b711f30b2dc54a1da68fef6c"
|
|
5
|
-
},
|
|
6
|
-
"pipfile-spec": 6,
|
|
7
|
-
"requires": {
|
|
8
|
-
"python_version": "3.12"
|
|
9
|
-
},
|
|
10
|
-
"sources": [
|
|
11
|
-
{
|
|
12
|
-
"name": "pypi",
|
|
13
|
-
"url": "https://pypi.org/socketsecurity",
|
|
14
|
-
"verify_ssl": true
|
|
15
|
-
}
|
|
16
|
-
]
|
|
17
|
-
},
|
|
18
|
-
"default": {},
|
|
19
|
-
"develop": {}
|
|
20
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{socketsecurity-2.2.11 → socketsecurity-2.2.15}/.github/PULL_REQUEST_TEMPLATE/improvement.md
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
|
|
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.11 → socketsecurity-2.2.15}/tests/data/fullscans/diff/stream_diff_full.json
RENAMED
|
File without changes
|
{socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/data/fullscans/head_scan/metadata.json
RENAMED
|
File without changes
|
{socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/data/fullscans/head_scan/stream_scan.json
RENAMED
|
File without changes
|
{socketsecurity-2.2.11 → socketsecurity-2.2.15}/tests/data/fullscans/head_scan/stream_scan_full.json
RENAMED
|
File without changes
|
|
File without changes
|
{socketsecurity-2.2.11 → socketsecurity-2.2.15}/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
|