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.
Files changed (20) hide show
  1. {socketsecurity-0.0.59 → socketsecurity-0.0.61}/PKG-INFO +1 -1
  2. {socketsecurity-0.0.59 → socketsecurity-0.0.61}/pyproject.toml +1 -1
  3. {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity/core/__init__.py +1 -1
  4. socketsecurity-0.0.59/socketsecurity/core/glitlab.py → socketsecurity-0.0.61/socketsecurity/core/gitlab.py +1 -1
  5. {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity/socketcli.py +22 -10
  6. {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity.egg-info/PKG-INFO +1 -1
  7. {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity.egg-info/SOURCES.txt +1 -1
  8. {socketsecurity-0.0.59 → socketsecurity-0.0.61}/README.md +0 -0
  9. {socketsecurity-0.0.59 → socketsecurity-0.0.61}/setup.cfg +0 -0
  10. {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity/__init__.py +0 -0
  11. {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity/core/classes.py +0 -0
  12. {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity/core/exceptions.py +0 -0
  13. {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity/core/github.py +0 -0
  14. {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity/core/issues.py +0 -0
  15. {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity/core/licenses.py +0 -0
  16. {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity/core/messages.py +0 -0
  17. {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity.egg-info/dependency_links.txt +0 -0
  18. {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity.egg-info/entry_points.txt +0 -0
  19. {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity.egg-info/requires.txt +0 -0
  20. {socketsecurity-0.0.59 → socketsecurity-0.0.61}/socketsecurity.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: socketsecurity
3
- Version: 0.0.59
3
+ Version: 0.0.61
4
4
  Summary: Socket Security CLI for CI/CD
5
5
  Author-email: Douglas Coburn <douglas@socket.dev>
6
6
  Maintainer-email: Douglas Coburn <douglas@socket.dev>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "socketsecurity"
7
- version = "0.0.59"
7
+ version = "0.0.61"
8
8
  requires-python = ">= 3.9"
9
9
  dependencies = [
10
10
  'requests',
@@ -23,7 +23,7 @@ import time
23
23
 
24
24
 
25
25
  __author__ = 'socket.dev'
26
- __version__ = '0.0.59'
26
+ __version__ = '0.0.61'
27
27
  __all__ = [
28
28
  "Core",
29
29
  "log",
@@ -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
- print("Security issues detected by Socket Security")
88
- print(console_security_comment)
96
+ log.info("Security issues detected by Socket Security")
97
+ log.info(console_security_comment)
89
98
  sys.exit(1)
90
99
  else:
91
- print("No New Security issues detected by Socket Security")
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
- print("Unable to find Socket API Token")
126
+ log.info("Unable to find Socket API Token")
115
127
  sys.exit(3)
116
128
  if repo is None:
117
- print("Repo name needs to be set")
129
+ log.info("Repo name needs to be set")
118
130
  sys.exit(2)
119
- print(f"Starting Socket Security Scan version {__version__}")
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.glitlab import Gitlab
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
- print("Comment initiated flow")
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
- print("Push initiated flow")
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
- print("API Mode")
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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: socketsecurity
3
- Version: 0.0.59
3
+ Version: 0.0.61
4
4
  Summary: Socket Security CLI for CI/CD
5
5
  Author-email: Douglas Coburn <douglas@socket.dev>
6
6
  Maintainer-email: Douglas Coburn <douglas@socket.dev>
@@ -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/glitlab.py
15
+ socketsecurity/core/gitlab.py
16
16
  socketsecurity/core/issues.py
17
17
  socketsecurity/core/licenses.py
18
18
  socketsecurity/core/messages.py