socketsecurity 0.0.69__tar.gz → 0.0.70__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 (21) hide show
  1. {socketsecurity-0.0.69/socketsecurity.egg-info → socketsecurity-0.0.70}/PKG-INFO +1 -1
  2. {socketsecurity-0.0.69 → socketsecurity-0.0.70}/pyproject.toml +1 -1
  3. {socketsecurity-0.0.69 → socketsecurity-0.0.70}/socketsecurity/core/__init__.py +1 -1
  4. {socketsecurity-0.0.69 → socketsecurity-0.0.70}/socketsecurity/core/github.py +19 -11
  5. {socketsecurity-0.0.69 → socketsecurity-0.0.70}/socketsecurity/core/gitlab.py +19 -11
  6. {socketsecurity-0.0.69 → socketsecurity-0.0.70}/socketsecurity/socketcli.py +13 -1
  7. {socketsecurity-0.0.69 → socketsecurity-0.0.70/socketsecurity.egg-info}/PKG-INFO +1 -1
  8. {socketsecurity-0.0.69 → socketsecurity-0.0.70}/LICENSE +0 -0
  9. {socketsecurity-0.0.69 → socketsecurity-0.0.70}/README.md +0 -0
  10. {socketsecurity-0.0.69 → socketsecurity-0.0.70}/setup.cfg +0 -0
  11. {socketsecurity-0.0.69 → socketsecurity-0.0.70}/socketsecurity/__init__.py +0 -0
  12. {socketsecurity-0.0.69 → socketsecurity-0.0.70}/socketsecurity/core/classes.py +0 -0
  13. {socketsecurity-0.0.69 → socketsecurity-0.0.70}/socketsecurity/core/exceptions.py +0 -0
  14. {socketsecurity-0.0.69 → socketsecurity-0.0.70}/socketsecurity/core/issues.py +0 -0
  15. {socketsecurity-0.0.69 → socketsecurity-0.0.70}/socketsecurity/core/licenses.py +0 -0
  16. {socketsecurity-0.0.69 → socketsecurity-0.0.70}/socketsecurity/core/messages.py +0 -0
  17. {socketsecurity-0.0.69 → socketsecurity-0.0.70}/socketsecurity.egg-info/SOURCES.txt +0 -0
  18. {socketsecurity-0.0.69 → socketsecurity-0.0.70}/socketsecurity.egg-info/dependency_links.txt +0 -0
  19. {socketsecurity-0.0.69 → socketsecurity-0.0.70}/socketsecurity.egg-info/entry_points.txt +0 -0
  20. {socketsecurity-0.0.69 → socketsecurity-0.0.70}/socketsecurity.egg-info/requires.txt +0 -0
  21. {socketsecurity-0.0.69 → socketsecurity-0.0.70}/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.69
3
+ Version: 0.0.70
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.69"
7
+ version = "0.0.70"
8
8
  requires-python = ">= 3.9"
9
9
  dependencies = [
10
10
  'requests',
@@ -25,7 +25,7 @@ import time
25
25
 
26
26
 
27
27
  __author__ = 'socket.dev'
28
- __version__ = '0.0.69'
28
+ __version__ = '0.0.70'
29
29
  __all__ = [
30
30
  "Core",
31
31
  "log",
@@ -163,19 +163,27 @@ class Github:
163
163
  return event_type
164
164
 
165
165
  @staticmethod
166
- def add_socket_comments(security_comment: str, overview_comment: str, comments: dict) -> None:
166
+ def add_socket_comments(
167
+ security_comment: str,
168
+ overview_comment: str,
169
+ comments: dict,
170
+ new_security_comment: bool = True,
171
+ new_overview_comment: bool = True
172
+ ) -> None:
167
173
  existing_overview_comment = comments.get("overview")
168
174
  existing_security_comment = comments.get("security")
169
- if existing_overview_comment is not None:
170
- existing_overview_comment: GithubComment
171
- Github.update_comment(overview_comment, str(existing_overview_comment.id))
172
- else:
173
- Github.post_comment(overview_comment)
174
- if existing_security_comment is not None:
175
- existing_security_comment: GithubComment
176
- Github.update_comment(security_comment, str(existing_security_comment.id))
177
- else:
178
- Github.post_comment(security_comment)
175
+ if new_overview_comment:
176
+ if existing_overview_comment is not None:
177
+ existing_overview_comment: GithubComment
178
+ Github.update_comment(overview_comment, str(existing_overview_comment.id))
179
+ else:
180
+ Github.post_comment(overview_comment)
181
+ if new_security_comment:
182
+ if existing_security_comment is not None:
183
+ existing_security_comment: GithubComment
184
+ Github.update_comment(security_comment, str(existing_security_comment.id))
185
+ else:
186
+ Github.post_comment(security_comment)
179
187
 
180
188
  @staticmethod
181
189
  def post_comment(body: str) -> None:
@@ -159,19 +159,27 @@ class Gitlab:
159
159
  return event_type
160
160
 
161
161
  @staticmethod
162
- def add_socket_comments(security_comment: str, overview_comment: str, comments: dict) -> None:
162
+ def add_socket_comments(
163
+ security_comment: str,
164
+ overview_comment: str,
165
+ comments: dict,
166
+ new_security_comment: bool = True,
167
+ new_overview_comment: bool = True
168
+ ) -> None:
163
169
  existing_overview_comment = comments.get("overview")
164
170
  existing_security_comment = comments.get("security")
165
- if existing_overview_comment is not None:
166
- existing_overview_comment: GitlabComment
167
- Gitlab.update_comment(overview_comment, str(existing_overview_comment.id))
168
- else:
169
- Gitlab.post_comment(overview_comment)
170
- if existing_security_comment is not None:
171
- existing_security_comment: GitlabComment
172
- Gitlab.update_comment(security_comment, str(existing_security_comment.id))
173
- else:
174
- Gitlab.post_comment(security_comment)
171
+ if new_overview_comment:
172
+ if existing_overview_comment is not None:
173
+ existing_overview_comment: GitlabComment
174
+ Gitlab.update_comment(overview_comment, str(existing_overview_comment.id))
175
+ else:
176
+ Gitlab.post_comment(overview_comment)
177
+ if new_security_comment:
178
+ if existing_security_comment is not None:
179
+ existing_security_comment: GitlabComment
180
+ Gitlab.update_comment(security_comment, str(existing_security_comment.id))
181
+ else:
182
+ Gitlab.post_comment(security_comment)
175
183
 
176
184
  @staticmethod
177
185
  def post_comment(body: str) -> None:
@@ -166,7 +166,19 @@ def cli():
166
166
  diff.new_alerts = scm.remove_alerts(comments, diff.new_alerts)
167
167
  overview_comment = Messages.dependency_overview_template(diff)
168
168
  security_comment = Messages.security_comment_template(diff)
169
- scm.add_socket_comments(security_comment, overview_comment, comments)
169
+ new_security_comment = True
170
+ new_overview_comment = True
171
+ if len(diff.new_alerts) == 0:
172
+ new_security_comment = False
173
+ if len(diff.new_packages) == 0 and diff.removed_packages == 0:
174
+ new_overview_comment = False
175
+ scm.add_socket_comments(
176
+ security_comment,
177
+ overview_comment,
178
+ comments,
179
+ new_security_comment,
180
+ new_overview_comment
181
+ )
170
182
  output_console_comments(diff)
171
183
  else:
172
184
  log.info("API Mode")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: socketsecurity
3
- Version: 0.0.69
3
+ Version: 0.0.70
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>
File without changes