socketsecurity 1.0.17__tar.gz → 1.0.21__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.17/socketsecurity.egg-info → socketsecurity-1.0.21}/PKG-INFO +25 -25
  2. {socketsecurity-1.0.17 → socketsecurity-1.0.21}/README.md +24 -24
  3. {socketsecurity-1.0.17 → socketsecurity-1.0.21}/socketsecurity/__init__.py +1 -1
  4. {socketsecurity-1.0.17 → socketsecurity-1.0.21}/socketsecurity/core/__init__.py +20 -24
  5. {socketsecurity-1.0.17 → socketsecurity-1.0.21}/socketsecurity/core/git_interface.py +2 -1
  6. {socketsecurity-1.0.17 → socketsecurity-1.0.21}/socketsecurity/socketcli.py +3 -4
  7. {socketsecurity-1.0.17 → socketsecurity-1.0.21/socketsecurity.egg-info}/PKG-INFO +25 -25
  8. {socketsecurity-1.0.17 → socketsecurity-1.0.21}/LICENSE +0 -0
  9. {socketsecurity-1.0.17 → socketsecurity-1.0.21}/pyproject.toml +0 -0
  10. {socketsecurity-1.0.17 → socketsecurity-1.0.21}/setup.cfg +0 -0
  11. {socketsecurity-1.0.17 → socketsecurity-1.0.21}/socketsecurity/core/classes.py +0 -0
  12. {socketsecurity-1.0.17 → socketsecurity-1.0.21}/socketsecurity/core/exceptions.py +0 -0
  13. {socketsecurity-1.0.17 → socketsecurity-1.0.21}/socketsecurity/core/github.py +0 -0
  14. {socketsecurity-1.0.17 → socketsecurity-1.0.21}/socketsecurity/core/gitlab.py +0 -0
  15. {socketsecurity-1.0.17 → socketsecurity-1.0.21}/socketsecurity/core/issues.py +0 -0
  16. {socketsecurity-1.0.17 → socketsecurity-1.0.21}/socketsecurity/core/licenses.py +0 -0
  17. {socketsecurity-1.0.17 → socketsecurity-1.0.21}/socketsecurity/core/messages.py +0 -0
  18. {socketsecurity-1.0.17 → socketsecurity-1.0.21}/socketsecurity/core/scm_comments.py +0 -0
  19. {socketsecurity-1.0.17 → socketsecurity-1.0.21}/socketsecurity.egg-info/SOURCES.txt +0 -0
  20. {socketsecurity-1.0.17 → socketsecurity-1.0.21}/socketsecurity.egg-info/dependency_links.txt +0 -0
  21. {socketsecurity-1.0.17 → socketsecurity-1.0.21}/socketsecurity.egg-info/entry_points.txt +0 -0
  22. {socketsecurity-1.0.17 → socketsecurity-1.0.21}/socketsecurity.egg-info/requires.txt +0 -0
  23. {socketsecurity-1.0.17 → socketsecurity-1.0.21}/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.17
3
+ Version: 1.0.21
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>
@@ -38,27 +38,27 @@ socketcli [-h] [--api_token API_TOKEN] [--repo REPO] [--branch BRANCH] [--commit
38
38
  If you don't want to provide the Socket API Token every time then you can use the environment variable `SOCKET_SECURITY_API_KEY`
39
39
 
40
40
 
41
- | Parameter | Alternate Name | Required | Default | Description |
42
- |:-------------------------|:---------------|:---------|:--------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------|
43
- | -h | --help | False | | Show the CLI help message |
44
- | --api_token | | False | | Provides the Socket API Token |
45
- | --repo | | True | | The string name in a git approved name for repositories. |
46
- | --branch | | False | | The string name in a git approved name for branches. |
47
- | --committer | | False | | The string name of the person doing the commit or running the CLI. Can be specified multiple times to have more than one committer |
48
- | --pr_number | | False | 0 | The integer for the PR or MR number |
49
- | --commit_message | | False | | The string for a commit message if there is one |
50
- | --default_branch | | False | False | If the flag is specified this will signal that this is the default branch. This needs to be enabled for a report to update Org Alerts and Org Dependencies |
51
- | --target_path | | False | ./ | This is the path to where the manifest files are location. The tool will recursively search for all supported manifest files |
52
- | --scm | | False | api | This is the mode that the tool is to run in. For local runs `api` would be the mode. Other options are `gitlab` and `github` |
53
- | --generate-license | | False | False | If this flag is specified it will generate a json file with the license per package and license text in the current working directory |
54
- | --version | -v | False | | Prints the version and exits |
55
- | --enable-debug | | False | False | Enables debug messaging for the CLI |
56
- | --sbom-file | | False | False | Creates a JSON file with all dependencies and alerts |
57
- | --commit-sha | | False | | The commit hash for the commit |
58
- | --generate-license | | False | False | If enabled with `--sbom-file` will include license details |
59
- | --enable-json | | False | False | If enabled will change the console output format to JSON |
60
- | --disable-overview | | False | False | If enabled will disable Dependency Overview comments |
61
- | --disable-security-issue | | False | False | If enabled will disable Security Issue Comments |
62
- | --files | | False | | If provided in the format of `["file1", "file2"]` it will only look for those files and not glob the path |
63
- | --ignore-commit-files | | False | False | If enabled then the CLI will ignore what files are changed in the commit and look for all manifest files |
64
- | --disable-blocking | | False | False | Disables failing checks and will only exit with an exit code of 0 |
41
+ | Parameter | Alternate Name | Required | Default | Description |
42
+ |:-------------------------|:---------------|:---------|:--------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
43
+ | -h | --help | False | | Show the CLI help message |
44
+ | --api_token | | False | | Provides the Socket API Token |
45
+ | --repo | | True | | The string name in a git approved name for repositories. |
46
+ | --branch | | False | | The string name in a git approved name for branches. |
47
+ | --committer | | False | | The string name of the person doing the commit or running the CLI. Can be specified multiple times to have more than one committer |
48
+ | --pr_number | | False | 0 | The integer for the PR or MR number |
49
+ | --commit_message | | False | | The string for a commit message if there is one |
50
+ | --default_branch | | False | False | If the flag is specified this will signal that this is the default branch. This needs to be enabled for a report to update Org Alerts and Org Dependencies |
51
+ | --target_path | | False | ./ | This is the path to where the manifest files are location. The tool will recursively search for all supported manifest files |
52
+ | --scm | | False | api | This is the mode that the tool is to run in. For local runs `api` would be the mode. Other options are `gitlab` and `github` |
53
+ | --generate-license | | False | False | If this flag is specified it will generate a json file with the license per package and license text in the current working directory |
54
+ | --version | -v | False | | Prints the version and exits |
55
+ | --enable-debug | | False | False | Enables debug messaging for the CLI |
56
+ | --sbom-file | | False | False | Creates a JSON file with all dependencies and alerts |
57
+ | --commit-sha | | False | | The commit hash for the commit |
58
+ | --generate-license | | False | False | If enabled with `--sbom-file` will include license details |
59
+ | --enable-json | | False | False | If enabled will change the console output format to JSON |
60
+ | --disable-overview | | False | False | If enabled will disable Dependency Overview comments |
61
+ | --disable-security-issue | | False | False | If enabled will disable Security Issue Comments |
62
+ | --files | | False | | If provided in the format of `["file1", "file2"]` will be used to determine if there have been supported file changes. This is used if it isn't a git repo and you would like to only run if it supported files have changed. |
63
+ | --ignore-commit-files | | False | False | If enabled then the CLI will ignore what files are changed in the commit and look for all manifest files |
64
+ | --disable-blocking | | False | False | Disables failing checks and will only exit with an exit code of 0 |
@@ -14,27 +14,27 @@ socketcli [-h] [--api_token API_TOKEN] [--repo REPO] [--branch BRANCH] [--commit
14
14
  If you don't want to provide the Socket API Token every time then you can use the environment variable `SOCKET_SECURITY_API_KEY`
15
15
 
16
16
 
17
- | Parameter | Alternate Name | Required | Default | Description |
18
- |:-------------------------|:---------------|:---------|:--------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------|
19
- | -h | --help | False | | Show the CLI help message |
20
- | --api_token | | False | | Provides the Socket API Token |
21
- | --repo | | True | | The string name in a git approved name for repositories. |
22
- | --branch | | False | | The string name in a git approved name for branches. |
23
- | --committer | | False | | The string name of the person doing the commit or running the CLI. Can be specified multiple times to have more than one committer |
24
- | --pr_number | | False | 0 | The integer for the PR or MR number |
25
- | --commit_message | | False | | The string for a commit message if there is one |
26
- | --default_branch | | False | False | If the flag is specified this will signal that this is the default branch. This needs to be enabled for a report to update Org Alerts and Org Dependencies |
27
- | --target_path | | False | ./ | This is the path to where the manifest files are location. The tool will recursively search for all supported manifest files |
28
- | --scm | | False | api | This is the mode that the tool is to run in. For local runs `api` would be the mode. Other options are `gitlab` and `github` |
29
- | --generate-license | | False | False | If this flag is specified it will generate a json file with the license per package and license text in the current working directory |
30
- | --version | -v | False | | Prints the version and exits |
31
- | --enable-debug | | False | False | Enables debug messaging for the CLI |
32
- | --sbom-file | | False | False | Creates a JSON file with all dependencies and alerts |
33
- | --commit-sha | | False | | The commit hash for the commit |
34
- | --generate-license | | False | False | If enabled with `--sbom-file` will include license details |
35
- | --enable-json | | False | False | If enabled will change the console output format to JSON |
36
- | --disable-overview | | False | False | If enabled will disable Dependency Overview comments |
37
- | --disable-security-issue | | False | False | If enabled will disable Security Issue Comments |
38
- | --files | | False | | If provided in the format of `["file1", "file2"]` it will only look for those files and not glob the path |
39
- | --ignore-commit-files | | False | False | If enabled then the CLI will ignore what files are changed in the commit and look for all manifest files |
40
- | --disable-blocking | | False | False | Disables failing checks and will only exit with an exit code of 0 |
17
+ | Parameter | Alternate Name | Required | Default | Description |
18
+ |:-------------------------|:---------------|:---------|:--------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
19
+ | -h | --help | False | | Show the CLI help message |
20
+ | --api_token | | False | | Provides the Socket API Token |
21
+ | --repo | | True | | The string name in a git approved name for repositories. |
22
+ | --branch | | False | | The string name in a git approved name for branches. |
23
+ | --committer | | False | | The string name of the person doing the commit or running the CLI. Can be specified multiple times to have more than one committer |
24
+ | --pr_number | | False | 0 | The integer for the PR or MR number |
25
+ | --commit_message | | False | | The string for a commit message if there is one |
26
+ | --default_branch | | False | False | If the flag is specified this will signal that this is the default branch. This needs to be enabled for a report to update Org Alerts and Org Dependencies |
27
+ | --target_path | | False | ./ | This is the path to where the manifest files are location. The tool will recursively search for all supported manifest files |
28
+ | --scm | | False | api | This is the mode that the tool is to run in. For local runs `api` would be the mode. Other options are `gitlab` and `github` |
29
+ | --generate-license | | False | False | If this flag is specified it will generate a json file with the license per package and license text in the current working directory |
30
+ | --version | -v | False | | Prints the version and exits |
31
+ | --enable-debug | | False | False | Enables debug messaging for the CLI |
32
+ | --sbom-file | | False | False | Creates a JSON file with all dependencies and alerts |
33
+ | --commit-sha | | False | | The commit hash for the commit |
34
+ | --generate-license | | False | False | If enabled with `--sbom-file` will include license details |
35
+ | --enable-json | | False | False | If enabled will change the console output format to JSON |
36
+ | --disable-overview | | False | False | If enabled will disable Dependency Overview comments |
37
+ | --disable-security-issue | | False | False | If enabled will disable Security Issue Comments |
38
+ | --files | | False | | If provided in the format of `["file1", "file2"]` will be used to determine if there have been supported file changes. This is used if it isn't a git repo and you would like to only run if it supported files have changed. |
39
+ | --ignore-commit-files | | False | False | If enabled then the CLI will ignore what files are changed in the commit and look for all manifest files |
40
+ | --disable-blocking | | False | False | Disables failing checks and will only exit with an exit code of 0 |
@@ -1,2 +1,2 @@
1
1
  __author__ = 'socket.dev'
2
- __version__ = '1.0.17'
2
+ __version__ = '1.0.21'
@@ -375,8 +375,9 @@ class Core:
375
375
  return sbom
376
376
 
377
377
  @staticmethod
378
- def match_supported_files(path: str, files: list) -> list:
379
- matched = []
378
+ def match_supported_files(files: list) -> bool:
379
+ matched_files = []
380
+ not_matched = False
380
381
  for ecosystem in socket_globs:
381
382
  patterns = socket_globs[ecosystem]
382
383
  for file_name in patterns:
@@ -386,11 +387,13 @@ class Core:
386
387
  if "\\" in file:
387
388
  file = file.replace("\\", "/")
388
389
  if PurePath(file).match(pattern):
389
- matched.append(file)
390
- return matched
390
+ matched_files.append(file)
391
+ if len(matched_files) == 0:
392
+ not_matched = True
393
+ return not_matched
391
394
 
392
395
  @staticmethod
393
- def find_files(path: str, files: list = None) -> list:
396
+ def find_files(path: str) -> list:
394
397
  """
395
398
  Globs the path for supported manifest files.
396
399
  Note: Might move the source to a JSON file
@@ -398,30 +401,25 @@ class Core:
398
401
  :param files: override finding the manifest files using the glob matcher
399
402
  :return:
400
403
  """
401
- files_provided = False
402
404
  log.debug("Starting Find Files")
403
405
  start_time = time.time()
404
- if files is not None and len(files) > 0:
405
- files_provided = True
406
+ files = []
406
407
  for ecosystem in socket_globs:
407
- if files is None:
408
- files = []
409
408
  patterns = socket_globs[ecosystem]
410
409
  for file_name in patterns:
411
410
  pattern = patterns[file_name]["pattern"]
412
411
  file_path = f"{path}/**/{pattern}"
413
412
 
414
- if not files_provided:
415
- log.debug(f"Globbing {file_path}")
416
- glob_start = time.time()
417
- test = glob(file_path, recursive=True)
418
- files = files + test
419
- glob_end = time.time()
420
- glob_total_time = glob_end - glob_start
421
- log.debug(f"Glob for pattern {file_path} took {glob_total_time:.2f} seconds")
422
- else:
423
- log.debug("Files found from commit")
424
- files = Core.match_supported_files(path, files)
413
+ log.debug(f"Globbing {file_path}")
414
+ glob_start = time.time()
415
+ glob_files = glob(file_path, recursive=True)
416
+ for glob_file in glob_files:
417
+ if glob_file not in files:
418
+ files.append(glob_file)
419
+ glob_end = time.time()
420
+ glob_total_time = glob_end - glob_start
421
+ log.debug(f"Glob for pattern {file_path} took {glob_total_time:.2f} seconds")
422
+
425
423
  log.debug("Finished Find Files")
426
424
  end_time = time.time()
427
425
  total_time = end_time - start_time
@@ -516,7 +514,6 @@ class Core:
516
514
  path: str,
517
515
  params: FullScanParams,
518
516
  workspace: str,
519
- new_files: list = None,
520
517
  no_change: bool = False
521
518
  ) -> Diff:
522
519
  """
@@ -527,7 +524,6 @@ class Core:
527
524
  :param path: Str - path of where to look for manifest files for the new Full Scan
528
525
  :param params: FullScanParams - Query params for the Full Scan endpoint
529
526
  :param workspace: str - Path for workspace
530
- :param new_files:
531
527
  :param no_change:
532
528
  :return:
533
529
  """
@@ -535,7 +531,7 @@ class Core:
535
531
  diff = Diff()
536
532
  diff.id = "no_diff_id"
537
533
  return diff
538
- files = Core.find_files(path, new_files)
534
+ files = Core.find_files(path)
539
535
  if files is None or len(files) == 0:
540
536
  diff = Diff()
541
537
  diff.id = "no_diff_id"
@@ -26,4 +26,5 @@ class Git:
26
26
  self.changed_files = []
27
27
  for item in self.show_files:
28
28
  if item != "":
29
- self.changed_files.append(item)
29
+ full_path = f"{self.path}/{item}"
30
+ self.changed_files.append(full_path)
@@ -296,8 +296,7 @@ def main_code():
296
296
  if ignore_commit_files:
297
297
  no_change = False
298
298
  elif is_repo and files is not None and len(files) > 0:
299
- if len(core.match_supported_files(target_path, files)) > 0:
300
- no_change = False
299
+ no_change = core.match_supported_files(files)
301
300
 
302
301
  set_as_pending_head = False
303
302
  if default_branch:
@@ -322,7 +321,7 @@ def main_code():
322
321
  elif scm is not None and scm.check_event_type() != "comment":
323
322
  log.info("Push initiated flow")
324
323
  diff: Diff
325
- diff = core.create_new_diff(target_path, params, workspace=target_path, new_files=files, no_change=no_change)
324
+ diff = core.create_new_diff(target_path, params, workspace=target_path, no_change=no_change)
326
325
  if no_change:
327
326
  log.info("No dependency changes")
328
327
  elif scm.check_event_type() == "diff":
@@ -377,7 +376,7 @@ def main_code():
377
376
  else:
378
377
  log.info("API Mode")
379
378
  diff: Diff
380
- diff = core.create_new_diff(target_path, params, workspace=target_path, new_files=files, no_change=no_change)
379
+ diff = core.create_new_diff(target_path, params, workspace=target_path, no_change=no_change)
381
380
  if enable_json:
382
381
  output_console_json(diff, sbom_file)
383
382
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: socketsecurity
3
- Version: 1.0.17
3
+ Version: 1.0.21
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>
@@ -38,27 +38,27 @@ socketcli [-h] [--api_token API_TOKEN] [--repo REPO] [--branch BRANCH] [--commit
38
38
  If you don't want to provide the Socket API Token every time then you can use the environment variable `SOCKET_SECURITY_API_KEY`
39
39
 
40
40
 
41
- | Parameter | Alternate Name | Required | Default | Description |
42
- |:-------------------------|:---------------|:---------|:--------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------|
43
- | -h | --help | False | | Show the CLI help message |
44
- | --api_token | | False | | Provides the Socket API Token |
45
- | --repo | | True | | The string name in a git approved name for repositories. |
46
- | --branch | | False | | The string name in a git approved name for branches. |
47
- | --committer | | False | | The string name of the person doing the commit or running the CLI. Can be specified multiple times to have more than one committer |
48
- | --pr_number | | False | 0 | The integer for the PR or MR number |
49
- | --commit_message | | False | | The string for a commit message if there is one |
50
- | --default_branch | | False | False | If the flag is specified this will signal that this is the default branch. This needs to be enabled for a report to update Org Alerts and Org Dependencies |
51
- | --target_path | | False | ./ | This is the path to where the manifest files are location. The tool will recursively search for all supported manifest files |
52
- | --scm | | False | api | This is the mode that the tool is to run in. For local runs `api` would be the mode. Other options are `gitlab` and `github` |
53
- | --generate-license | | False | False | If this flag is specified it will generate a json file with the license per package and license text in the current working directory |
54
- | --version | -v | False | | Prints the version and exits |
55
- | --enable-debug | | False | False | Enables debug messaging for the CLI |
56
- | --sbom-file | | False | False | Creates a JSON file with all dependencies and alerts |
57
- | --commit-sha | | False | | The commit hash for the commit |
58
- | --generate-license | | False | False | If enabled with `--sbom-file` will include license details |
59
- | --enable-json | | False | False | If enabled will change the console output format to JSON |
60
- | --disable-overview | | False | False | If enabled will disable Dependency Overview comments |
61
- | --disable-security-issue | | False | False | If enabled will disable Security Issue Comments |
62
- | --files | | False | | If provided in the format of `["file1", "file2"]` it will only look for those files and not glob the path |
63
- | --ignore-commit-files | | False | False | If enabled then the CLI will ignore what files are changed in the commit and look for all manifest files |
64
- | --disable-blocking | | False | False | Disables failing checks and will only exit with an exit code of 0 |
41
+ | Parameter | Alternate Name | Required | Default | Description |
42
+ |:-------------------------|:---------------|:---------|:--------|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
43
+ | -h | --help | False | | Show the CLI help message |
44
+ | --api_token | | False | | Provides the Socket API Token |
45
+ | --repo | | True | | The string name in a git approved name for repositories. |
46
+ | --branch | | False | | The string name in a git approved name for branches. |
47
+ | --committer | | False | | The string name of the person doing the commit or running the CLI. Can be specified multiple times to have more than one committer |
48
+ | --pr_number | | False | 0 | The integer for the PR or MR number |
49
+ | --commit_message | | False | | The string for a commit message if there is one |
50
+ | --default_branch | | False | False | If the flag is specified this will signal that this is the default branch. This needs to be enabled for a report to update Org Alerts and Org Dependencies |
51
+ | --target_path | | False | ./ | This is the path to where the manifest files are location. The tool will recursively search for all supported manifest files |
52
+ | --scm | | False | api | This is the mode that the tool is to run in. For local runs `api` would be the mode. Other options are `gitlab` and `github` |
53
+ | --generate-license | | False | False | If this flag is specified it will generate a json file with the license per package and license text in the current working directory |
54
+ | --version | -v | False | | Prints the version and exits |
55
+ | --enable-debug | | False | False | Enables debug messaging for the CLI |
56
+ | --sbom-file | | False | False | Creates a JSON file with all dependencies and alerts |
57
+ | --commit-sha | | False | | The commit hash for the commit |
58
+ | --generate-license | | False | False | If enabled with `--sbom-file` will include license details |
59
+ | --enable-json | | False | False | If enabled will change the console output format to JSON |
60
+ | --disable-overview | | False | False | If enabled will disable Dependency Overview comments |
61
+ | --disable-security-issue | | False | False | If enabled will disable Security Issue Comments |
62
+ | --files | | False | | If provided in the format of `["file1", "file2"]` will be used to determine if there have been supported file changes. This is used if it isn't a git repo and you would like to only run if it supported files have changed. |
63
+ | --ignore-commit-files | | False | False | If enabled then the CLI will ignore what files are changed in the commit and look for all manifest files |
64
+ | --disable-blocking | | False | False | Disables failing checks and will only exit with an exit code of 0 |
File without changes