socketsecurity 0.0.59__tar.gz → 0.0.61__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-0.0.59 → socketsecurity-0.0.61}/PKG-INFO +1 -1
- {socketsecurity-0.0.59 → socketsecurity-0.0.61}/pyproject.toml +1 -1
- {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity/core/__init__.py +1 -1
- socketsecurity-0.0.59/socketsecurity/core/glitlab.py → socketsecurity-0.0.61/socketsecurity/core/gitlab.py +1 -1
- {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity/socketcli.py +22 -10
- {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity.egg-info/PKG-INFO +1 -1
- {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity.egg-info/SOURCES.txt +1 -1
- {socketsecurity-0.0.59 → socketsecurity-0.0.61}/README.md +0 -0
- {socketsecurity-0.0.59 → socketsecurity-0.0.61}/setup.cfg +0 -0
- {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity/__init__.py +0 -0
- {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity/core/classes.py +0 -0
- {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity/core/exceptions.py +0 -0
- {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity/core/github.py +0 -0
- {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity/core/issues.py +0 -0
- {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity/core/licenses.py +0 -0
- {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity/core/messages.py +0 -0
- {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity.egg-info/dependency_links.txt +0 -0
- {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity.egg-info/entry_points.txt +0 -0
- {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity.egg-info/requires.txt +0 -0
- {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity.egg-info/top_level.txt +0 -0
|
@@ -146,7 +146,7 @@ class Gitlab:
|
|
|
146
146
|
|
|
147
147
|
@staticmethod
|
|
148
148
|
def check_event_type() -> str:
|
|
149
|
-
if ci_pipeline_source.lower() == "push" or ci_pipeline_source.lower == 'merge_request_event':
|
|
149
|
+
if ci_pipeline_source.lower() == "push" or ci_pipeline_source.lower() == 'merge_request_event':
|
|
150
150
|
if ci_merge_request_iid is None or ci_merge_request_iid == "":
|
|
151
151
|
event_type = "main"
|
|
152
152
|
else:
|
|
@@ -5,7 +5,10 @@ from socketsecurity.core.classes import FullScanParams, Diff, Package
|
|
|
5
5
|
from socketsecurity.core.messages import Messages
|
|
6
6
|
import os
|
|
7
7
|
import sys
|
|
8
|
+
import logging
|
|
8
9
|
|
|
10
|
+
logging.basicConfig(level=logging.INFO)
|
|
11
|
+
log = logging.getLogger("socketcli")
|
|
9
12
|
|
|
10
13
|
parser = argparse.ArgumentParser(
|
|
11
14
|
prog="socketcli",
|
|
@@ -80,19 +83,28 @@ parser.add_argument(
|
|
|
80
83
|
help='Display the version',
|
|
81
84
|
)
|
|
82
85
|
|
|
86
|
+
parser.add_argument(
|
|
87
|
+
'--enable-debug',
|
|
88
|
+
help='Enable debug mode',
|
|
89
|
+
action='store_true',
|
|
90
|
+
default=False
|
|
91
|
+
)
|
|
83
92
|
|
|
84
93
|
def output_console_comments(diff_report) -> None:
|
|
85
94
|
console_security_comment = Messages.create_console_security_alert_table(diff_report)
|
|
86
95
|
if len(diff_report.new_alerts) > 0:
|
|
87
|
-
|
|
88
|
-
|
|
96
|
+
log.info("Security issues detected by Socket Security")
|
|
97
|
+
log.info(console_security_comment)
|
|
89
98
|
sys.exit(1)
|
|
90
99
|
else:
|
|
91
|
-
|
|
100
|
+
log.info("No New Security issues detected by Socket Security")
|
|
92
101
|
|
|
93
102
|
|
|
94
103
|
def cli():
|
|
95
104
|
arguments = parser.parse_args()
|
|
105
|
+
debug = arguments.enable_debug
|
|
106
|
+
if debug:
|
|
107
|
+
logging.basicConfig(level=logging.DEBUG)
|
|
96
108
|
repo = arguments.repo
|
|
97
109
|
branch = arguments.branch
|
|
98
110
|
commit_message = arguments.commit_message
|
|
@@ -111,18 +123,18 @@ def cli():
|
|
|
111
123
|
license_file += ".json"
|
|
112
124
|
api_token = os.getenv("SOCKET_SECURITY_API_KEY") or arguments.api_token
|
|
113
125
|
if api_token is None:
|
|
114
|
-
|
|
126
|
+
log.info("Unable to find Socket API Token")
|
|
115
127
|
sys.exit(3)
|
|
116
128
|
if repo is None:
|
|
117
|
-
|
|
129
|
+
log.info("Repo name needs to be set")
|
|
118
130
|
sys.exit(2)
|
|
119
|
-
|
|
131
|
+
log.info(f"Starting Socket Security Scan version {__version__}")
|
|
120
132
|
scm = None
|
|
121
133
|
if scm_type == "github":
|
|
122
134
|
from socketsecurity.core.github import Github
|
|
123
135
|
scm = Github()
|
|
124
136
|
elif scm_type == 'gitlab':
|
|
125
|
-
from socketsecurity.core.
|
|
137
|
+
from socketsecurity.core.gitlab import Gitlab
|
|
126
138
|
scm = Gitlab()
|
|
127
139
|
if scm is not None:
|
|
128
140
|
default_branch = scm.is_default_branch
|
|
@@ -143,11 +155,11 @@ def cli():
|
|
|
143
155
|
)
|
|
144
156
|
diff = None
|
|
145
157
|
if scm is not None and scm.check_event_type() == "comment":
|
|
146
|
-
|
|
158
|
+
log.info("Comment initiated flow")
|
|
147
159
|
comments = scm.get_comments_for_pr(scm.repository, str(scm.pr_number))
|
|
148
160
|
scm.remove_comment_alerts(comments)
|
|
149
161
|
elif scm is not None and scm.check_event_type() != "comment":
|
|
150
|
-
|
|
162
|
+
log.info("Push initiated flow")
|
|
151
163
|
diff: Diff
|
|
152
164
|
diff = core.create_new_diff(target_path, params, workspace=target_path)
|
|
153
165
|
if scm.check_event_type() == "diff":
|
|
@@ -158,7 +170,7 @@ def cli():
|
|
|
158
170
|
scm.add_socket_comments(security_comment, overview_comment, comments)
|
|
159
171
|
output_console_comments(diff)
|
|
160
172
|
else:
|
|
161
|
-
|
|
173
|
+
log.info("API Mode")
|
|
162
174
|
diff: Diff
|
|
163
175
|
diff = core.create_new_diff(target_path, params, workspace=target_path)
|
|
164
176
|
output_console_comments(diff)
|
|
@@ -12,7 +12,7 @@ socketsecurity/core/__init__.py
|
|
|
12
12
|
socketsecurity/core/classes.py
|
|
13
13
|
socketsecurity/core/exceptions.py
|
|
14
14
|
socketsecurity/core/github.py
|
|
15
|
-
socketsecurity/core/
|
|
15
|
+
socketsecurity/core/gitlab.py
|
|
16
16
|
socketsecurity/core/issues.py
|
|
17
17
|
socketsecurity/core/licenses.py
|
|
18
18
|
socketsecurity/core/messages.py
|
|
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-0.0.59 → socketsecurity-0.0.61}/socketsecurity.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|