socketsecurity 1.0.4__tar.gz → 1.0.6__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 (23) hide show
  1. {socketsecurity-1.0.4/socketsecurity.egg-info → socketsecurity-1.0.6}/PKG-INFO +1 -1
  2. {socketsecurity-1.0.4 → socketsecurity-1.0.6}/socketsecurity/__init__.py +1 -1
  3. {socketsecurity-1.0.4 → socketsecurity-1.0.6}/socketsecurity/core/__init__.py +7 -1
  4. {socketsecurity-1.0.4 → socketsecurity-1.0.6}/socketsecurity/core/github.py +1 -1
  5. {socketsecurity-1.0.4 → socketsecurity-1.0.6}/socketsecurity/socketcli.py +23 -7
  6. {socketsecurity-1.0.4 → socketsecurity-1.0.6/socketsecurity.egg-info}/PKG-INFO +1 -1
  7. {socketsecurity-1.0.4 → socketsecurity-1.0.6}/LICENSE +0 -0
  8. {socketsecurity-1.0.4 → socketsecurity-1.0.6}/README.md +0 -0
  9. {socketsecurity-1.0.4 → socketsecurity-1.0.6}/pyproject.toml +0 -0
  10. {socketsecurity-1.0.4 → socketsecurity-1.0.6}/setup.cfg +0 -0
  11. {socketsecurity-1.0.4 → socketsecurity-1.0.6}/socketsecurity/core/classes.py +0 -0
  12. {socketsecurity-1.0.4 → socketsecurity-1.0.6}/socketsecurity/core/exceptions.py +0 -0
  13. {socketsecurity-1.0.4 → socketsecurity-1.0.6}/socketsecurity/core/git_interface.py +0 -0
  14. {socketsecurity-1.0.4 → socketsecurity-1.0.6}/socketsecurity/core/gitlab.py +0 -0
  15. {socketsecurity-1.0.4 → socketsecurity-1.0.6}/socketsecurity/core/issues.py +0 -0
  16. {socketsecurity-1.0.4 → socketsecurity-1.0.6}/socketsecurity/core/licenses.py +0 -0
  17. {socketsecurity-1.0.4 → socketsecurity-1.0.6}/socketsecurity/core/messages.py +0 -0
  18. {socketsecurity-1.0.4 → socketsecurity-1.0.6}/socketsecurity/core/scm_comments.py +0 -0
  19. {socketsecurity-1.0.4 → socketsecurity-1.0.6}/socketsecurity.egg-info/SOURCES.txt +0 -0
  20. {socketsecurity-1.0.4 → socketsecurity-1.0.6}/socketsecurity.egg-info/dependency_links.txt +0 -0
  21. {socketsecurity-1.0.4 → socketsecurity-1.0.6}/socketsecurity.egg-info/entry_points.txt +0 -0
  22. {socketsecurity-1.0.4 → socketsecurity-1.0.6}/socketsecurity.egg-info/requires.txt +0 -0
  23. {socketsecurity-1.0.4 → socketsecurity-1.0.6}/socketsecurity.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: socketsecurity
3
- Version: 1.0.4
3
+ Version: 1.0.6
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>
@@ -1,2 +1,2 @@
1
1
  __author__ = 'socket.dev'
2
- __version__ = '1.0.4'
2
+ __version__ = '1.0.6'
@@ -82,6 +82,9 @@ socket_globs = {
82
82
  "pyproject.toml": {
83
83
  "pattern": "pyproject.toml"
84
84
  },
85
+ "poetry.lock": {
86
+ "pattern": "poetry.lock"
87
+ },
85
88
  "requirements.txt": {
86
89
  "pattern": "*requirements.txt"
87
90
  },
@@ -394,12 +397,15 @@ class Core:
394
397
  :return:
395
398
  """
396
399
  all_files = []
400
+ files_provided = False
401
+ if files is not None and len(files) > 0:
402
+ files_provided = True
397
403
  for ecosystem in socket_globs:
398
404
  patterns = socket_globs[ecosystem]
399
405
  for file_name in patterns:
400
406
  pattern = patterns[file_name]["pattern"]
401
407
  file_path = f"{path}/**/{pattern}"
402
- if files is None or len(files) == 0:
408
+ if not files_provided:
403
409
  files = glob(file_path, recursive=True)
404
410
  else:
405
411
  files = Core.match_supported_files(path, files)
@@ -111,7 +111,7 @@ class Github:
111
111
  @staticmethod
112
112
  def check_event_type() -> str:
113
113
  if github_event_name.lower() == "push":
114
- if pr_number is None or pr_number == "":
114
+ if pr_number is None or pr_number == "" or pr_number == "0":
115
115
  event_type = "main"
116
116
  else:
117
117
  event_type = "diff"
@@ -263,6 +263,7 @@ def main_code():
263
263
  is_repo = True
264
264
  except InvalidGitRepositoryError:
265
265
  is_repo = False
266
+ ignore_commit_files = True
266
267
  pass
267
268
  except NoSuchPathError:
268
269
  raise Exception(f"Unable to find path {target_path}")
@@ -284,12 +285,15 @@ def main_code():
284
285
  if scm is not None:
285
286
  default_branch = scm.is_default_branch
286
287
 
287
- if is_repo and files is not None and len(files) == 0 and not ignore_commit_files:
288
- no_change = True
289
- else:
290
- no_change = False
291
288
  base_api_url = os.getenv("BASE_API_URL") or None
292
289
  core = Core(token=api_token, request_timeout=6000, base_api_url=base_api_url)
290
+ no_change = True
291
+ if ignore_commit_files:
292
+ no_change = False
293
+ elif is_repo and files is not None and len(files) > 0:
294
+ if len(core.match_supported_files(target_path, files)) > 0:
295
+ no_change = False
296
+
293
297
  set_as_pending_head = False
294
298
  if default_branch:
295
299
  set_as_pending_head = True
@@ -314,7 +318,9 @@ def main_code():
314
318
  log.info("Push initiated flow")
315
319
  diff: Diff
316
320
  diff = core.create_new_diff(target_path, params, workspace=target_path, new_files=files, no_change=no_change)
317
- if scm.check_event_type() == "diff":
321
+ if no_change:
322
+ log.info("No dependency changes")
323
+ elif scm.check_event_type() == "diff":
318
324
  log.info("Starting comment logic for PR/MR event")
319
325
  log.debug(f"Getting comments for Repo {scm.repository} for PR {scm.pr_number}")
320
326
  comments = scm.get_comments_for_pr(repo, str(pr_number))
@@ -326,14 +332,24 @@ def main_code():
326
332
  security_comment = Messages.security_comment_template(diff)
327
333
  new_security_comment = True
328
334
  new_overview_comment = True
335
+ update_old_security_comment = (
336
+ security_comment is None or
337
+ security_comment == "" or
338
+ (len(comments) != 0 and comments.get("security") is not None)
339
+ )
340
+ update_old_overview_comment = (
341
+ overview_comment is None or
342
+ overview_comment == "" or
343
+ (len(comments) != 0 and comments.get("overview") is not None)
344
+ )
329
345
  if len(diff.new_alerts) == 0 or disable_security_issue:
330
- if security_comment is None or security_comment == "":
346
+ if not update_old_security_comment:
331
347
  new_security_comment = False
332
348
  log.debug("No new alerts or security issue comment disabled")
333
349
  else:
334
350
  log.debug("Updated security comment with no new alerts")
335
351
  if (len(diff.new_packages) == 0 and len(diff.removed_packages) == 0) or disable_overview:
336
- if overview_comment is None or overview_comment == "":
352
+ if not update_old_overview_comment:
337
353
  new_overview_comment = False
338
354
  log.debug("No new/removed packages or Dependency Overview comment disabled")
339
355
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: socketsecurity
3
- Version: 1.0.4
3
+ Version: 1.0.6
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
File without changes
File without changes