socketsecurity 1.0.4__tar.gz → 1.0.5__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.5}/PKG-INFO +1 -1
  2. {socketsecurity-1.0.4 → socketsecurity-1.0.5}/socketsecurity/__init__.py +1 -1
  3. {socketsecurity-1.0.4 → socketsecurity-1.0.5}/socketsecurity/core/__init__.py +7 -1
  4. {socketsecurity-1.0.4 → socketsecurity-1.0.5}/socketsecurity/core/github.py +1 -1
  5. {socketsecurity-1.0.4 → socketsecurity-1.0.5}/socketsecurity/socketcli.py +22 -7
  6. {socketsecurity-1.0.4 → socketsecurity-1.0.5/socketsecurity.egg-info}/PKG-INFO +1 -1
  7. {socketsecurity-1.0.4 → socketsecurity-1.0.5}/LICENSE +0 -0
  8. {socketsecurity-1.0.4 → socketsecurity-1.0.5}/README.md +0 -0
  9. {socketsecurity-1.0.4 → socketsecurity-1.0.5}/pyproject.toml +0 -0
  10. {socketsecurity-1.0.4 → socketsecurity-1.0.5}/setup.cfg +0 -0
  11. {socketsecurity-1.0.4 → socketsecurity-1.0.5}/socketsecurity/core/classes.py +0 -0
  12. {socketsecurity-1.0.4 → socketsecurity-1.0.5}/socketsecurity/core/exceptions.py +0 -0
  13. {socketsecurity-1.0.4 → socketsecurity-1.0.5}/socketsecurity/core/git_interface.py +0 -0
  14. {socketsecurity-1.0.4 → socketsecurity-1.0.5}/socketsecurity/core/gitlab.py +0 -0
  15. {socketsecurity-1.0.4 → socketsecurity-1.0.5}/socketsecurity/core/issues.py +0 -0
  16. {socketsecurity-1.0.4 → socketsecurity-1.0.5}/socketsecurity/core/licenses.py +0 -0
  17. {socketsecurity-1.0.4 → socketsecurity-1.0.5}/socketsecurity/core/messages.py +0 -0
  18. {socketsecurity-1.0.4 → socketsecurity-1.0.5}/socketsecurity/core/scm_comments.py +0 -0
  19. {socketsecurity-1.0.4 → socketsecurity-1.0.5}/socketsecurity.egg-info/SOURCES.txt +0 -0
  20. {socketsecurity-1.0.4 → socketsecurity-1.0.5}/socketsecurity.egg-info/dependency_links.txt +0 -0
  21. {socketsecurity-1.0.4 → socketsecurity-1.0.5}/socketsecurity.egg-info/entry_points.txt +0 -0
  22. {socketsecurity-1.0.4 → socketsecurity-1.0.5}/socketsecurity.egg-info/requires.txt +0 -0
  23. {socketsecurity-1.0.4 → socketsecurity-1.0.5}/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.5
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.5'
@@ -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"
@@ -284,12 +284,15 @@ def main_code():
284
284
  if scm is not None:
285
285
  default_branch = scm.is_default_branch
286
286
 
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
287
  base_api_url = os.getenv("BASE_API_URL") or None
292
288
  core = Core(token=api_token, request_timeout=6000, base_api_url=base_api_url)
289
+ no_change = True
290
+ if ignore_commit_files:
291
+ no_change = False
292
+ elif is_repo and files is not None and len(files) > 0:
293
+ if len(core.match_supported_files(target_path, files)) > 0:
294
+ no_change = False
295
+
293
296
  set_as_pending_head = False
294
297
  if default_branch:
295
298
  set_as_pending_head = True
@@ -314,7 +317,9 @@ def main_code():
314
317
  log.info("Push initiated flow")
315
318
  diff: Diff
316
319
  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":
320
+ if no_change:
321
+ log.info("No dependency changes")
322
+ elif scm.check_event_type() == "diff":
318
323
  log.info("Starting comment logic for PR/MR event")
319
324
  log.debug(f"Getting comments for Repo {scm.repository} for PR {scm.pr_number}")
320
325
  comments = scm.get_comments_for_pr(repo, str(pr_number))
@@ -326,14 +331,24 @@ def main_code():
326
331
  security_comment = Messages.security_comment_template(diff)
327
332
  new_security_comment = True
328
333
  new_overview_comment = True
334
+ update_old_security_comment = (
335
+ security_comment is None or
336
+ security_comment == "" or
337
+ (len(comments) != 0 and comments.get("security") is not None)
338
+ )
339
+ update_old_overview_comment = (
340
+ overview_comment is None or
341
+ overview_comment == "" or
342
+ (len(comments) != 0 and comments.get("overview") is not None)
343
+ )
329
344
  if len(diff.new_alerts) == 0 or disable_security_issue:
330
- if security_comment is None or security_comment == "":
345
+ if not update_old_security_comment:
331
346
  new_security_comment = False
332
347
  log.debug("No new alerts or security issue comment disabled")
333
348
  else:
334
349
  log.debug("Updated security comment with no new alerts")
335
350
  if (len(diff.new_packages) == 0 and len(diff.removed_packages) == 0) or disable_overview:
336
- if overview_comment is None or overview_comment == "":
351
+ if not update_old_overview_comment:
337
352
  new_overview_comment = False
338
353
  log.debug("No new/removed packages or Dependency Overview comment disabled")
339
354
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: socketsecurity
3
- Version: 1.0.4
3
+ Version: 1.0.5
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