socketsecurity 1.0.21__tar.gz → 1.0.23__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.21/socketsecurity.egg-info → socketsecurity-1.0.23}/PKG-INFO +1 -1
  2. {socketsecurity-1.0.21 → socketsecurity-1.0.23}/socketsecurity/__init__.py +1 -1
  3. {socketsecurity-1.0.21 → socketsecurity-1.0.23}/socketsecurity/core/__init__.py +15 -1
  4. {socketsecurity-1.0.21 → socketsecurity-1.0.23}/socketsecurity/core/classes.py +2 -0
  5. {socketsecurity-1.0.21 → socketsecurity-1.0.23}/socketsecurity/core/git_interface.py +2 -0
  6. {socketsecurity-1.0.21 → socketsecurity-1.0.23}/socketsecurity/core/messages.py +13 -0
  7. {socketsecurity-1.0.21 → socketsecurity-1.0.23}/socketsecurity/socketcli.py +5 -0
  8. {socketsecurity-1.0.21 → socketsecurity-1.0.23/socketsecurity.egg-info}/PKG-INFO +1 -1
  9. {socketsecurity-1.0.21 → socketsecurity-1.0.23}/LICENSE +0 -0
  10. {socketsecurity-1.0.21 → socketsecurity-1.0.23}/README.md +0 -0
  11. {socketsecurity-1.0.21 → socketsecurity-1.0.23}/pyproject.toml +0 -0
  12. {socketsecurity-1.0.21 → socketsecurity-1.0.23}/setup.cfg +0 -0
  13. {socketsecurity-1.0.21 → socketsecurity-1.0.23}/socketsecurity/core/exceptions.py +0 -0
  14. {socketsecurity-1.0.21 → socketsecurity-1.0.23}/socketsecurity/core/github.py +0 -0
  15. {socketsecurity-1.0.21 → socketsecurity-1.0.23}/socketsecurity/core/gitlab.py +0 -0
  16. {socketsecurity-1.0.21 → socketsecurity-1.0.23}/socketsecurity/core/issues.py +0 -0
  17. {socketsecurity-1.0.21 → socketsecurity-1.0.23}/socketsecurity/core/licenses.py +0 -0
  18. {socketsecurity-1.0.21 → socketsecurity-1.0.23}/socketsecurity/core/scm_comments.py +0 -0
  19. {socketsecurity-1.0.21 → socketsecurity-1.0.23}/socketsecurity.egg-info/SOURCES.txt +0 -0
  20. {socketsecurity-1.0.21 → socketsecurity-1.0.23}/socketsecurity.egg-info/dependency_links.txt +0 -0
  21. {socketsecurity-1.0.21 → socketsecurity-1.0.23}/socketsecurity.egg-info/entry_points.txt +0 -0
  22. {socketsecurity-1.0.21 → socketsecurity-1.0.23}/socketsecurity.egg-info/requires.txt +0 -0
  23. {socketsecurity-1.0.21 → socketsecurity-1.0.23}/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.21
3
+ Version: 1.0.23
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.21'
2
+ __version__ = '1.0.23'
@@ -215,7 +215,13 @@ class Core:
215
215
  request_timeout: int
216
216
  reports: list
217
217
 
218
- def __init__(self, token: str, base_api_url=None, request_timeout=None, enable_all_alerts=False):
218
+ def __init__(
219
+ self,
220
+ token: str,
221
+ base_api_url: str = None,
222
+ request_timeout: int = None,
223
+ enable_all_alerts: bool = False
224
+ ):
219
225
  self.token = token + ":"
220
226
  encode_key(self.token)
221
227
  self.socket_date_format = "%Y-%m-%dT%H:%M:%S.%fZ"
@@ -547,6 +553,7 @@ class Core:
547
553
  total_head_time = head_end - head_start
548
554
  log.info(f"Total time to get head full-scan {total_head_time: .2f}")
549
555
  except APIResourceNotFound:
556
+ head_full_scan_id = None
550
557
  head_full_scan = []
551
558
  new_scan_start = time.time()
552
559
  new_full_scan = Core.create_full_scan(files, params, workspace)
@@ -556,7 +563,14 @@ class Core:
556
563
  log.info(f"Total time to get new full-scan {total_new_time: .2f}")
557
564
  diff_report = Core.compare_sboms(new_full_scan.sbom_artifacts, head_full_scan)
558
565
  diff_report.packages = new_full_scan.packages
566
+ # Set the diff ID and URLs
567
+ base_socket = "https://socket.dev/dashboard/org"
559
568
  diff_report.id = new_full_scan.id
569
+ diff_report.report_url = f"{base_socket}/{org_slug}/sbom/{diff_report.id}"
570
+ if head_full_scan_id is not None:
571
+ diff_report.diff_url = f"{base_socket}/{org_slug}/diff/{diff_report.id}/{head_full_scan_id}"
572
+ else:
573
+ diff_report.diff_url = diff_report.report_url
560
574
  return diff_report
561
575
 
562
576
  @staticmethod
@@ -312,6 +312,8 @@ class Diff:
312
312
  id: str
313
313
  sbom: str
314
314
  packages: dict
315
+ report_url: str
316
+ diff_url: str
315
317
 
316
318
  def __init__(self, **kwargs):
317
319
  if kwargs:
@@ -1,5 +1,6 @@
1
1
  from git import Repo
2
2
  from socketsecurity.core import log
3
+ import urllib.parse
3
4
 
4
5
 
5
6
  class Git:
@@ -15,6 +16,7 @@ class Git:
15
16
  self.repo_name = self.repo.remotes.origin.url.split('.git')[0].split('/')[-1]
16
17
  try:
17
18
  self.branch = self.head.reference
19
+ urllib.parse.unquote(str(self.branch))
18
20
  except Exception as error:
19
21
  self.branch = None
20
22
  log.debug(error)
@@ -189,8 +189,21 @@ class Messages:
189
189
  if len(diff.removed_packages) > 0:
190
190
  md = Messages.create_remove_line(diff, md)
191
191
  md.create_md_file()
192
+ if len(md.file_data_text.lstrip()) >= 65500:
193
+ md = Messages.short_dependency_overview_comment(diff)
192
194
  return md.file_data_text.lstrip()
193
195
 
196
+ @staticmethod
197
+ def short_dependency_overview_comment(diff: Diff) -> MdUtils:
198
+ md = MdUtils(file_name="markdown_overview_temp.md")
199
+ md.new_line("<!-- socket-overview-comment-actions -->")
200
+ md.new_header(level=1, title="Socket Security: Dependency Overview")
201
+ md.new_line("New and removed dependencies detected. Learn more about [socket.dev](https://socket.dev)")
202
+ md.new_line()
203
+ md.new_line("The amount of dependency changes were to long for this comment. Please check out the full report")
204
+ md.new_line(f"To view more information about this report checkout the [Full Report]({diff.diff_url})")
205
+ return md
206
+
194
207
  @staticmethod
195
208
  def create_remove_line(diff: Diff, md: MdUtils) -> MdUtils:
196
209
  """
@@ -27,6 +27,11 @@ parser.add_argument(
27
27
  help='The Socket API token can be set via SOCKET_SECURITY_API_KEY',
28
28
  required=False
29
29
  )
30
+ parser.add_argument(
31
+ '--base-url',
32
+ help='Override the base url to use with the Socket Broker',
33
+ required=False
34
+ )
30
35
  parser.add_argument(
31
36
  '--repo',
32
37
  help='The name of the repository',
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: socketsecurity
3
- Version: 1.0.21
3
+ Version: 1.0.23
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