cycode 1.11.1.dev1__tar.gz → 1.11.1.dev4__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 (117) hide show
  1. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/PKG-INFO +8 -13
  2. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/README.md +1 -6
  3. cycode-1.11.1.dev4/cycode/__init__.py +1 -0
  4. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/scan/code_scanner.py +1 -3
  5. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/consts.py +4 -1
  6. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/exceptions/custom_exceptions.py +4 -8
  7. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/files_collector/excluder.py +1 -4
  8. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/files_collector/sca/base_restore_dependencies.py +16 -5
  9. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/files_collector/sca/maven/restore_gradle_dependencies.py +1 -1
  10. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/files_collector/sca/maven/restore_maven_dependencies.py +2 -1
  11. cycode-1.11.1.dev4/cycode/cli/files_collector/sca/npm/restore_npm_dependencies.py +39 -0
  12. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/files_collector/sca/sca_code_scanner.py +3 -0
  13. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/user_settings/base_file_manager.py +1 -2
  14. cycode-1.11.1.dev4/cycode/cli/utils/__init__.py +0 -0
  15. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/utils/git_proxy.py +4 -8
  16. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/utils/progress_bar.py +7 -14
  17. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/utils/shell_executor.py +3 -9
  18. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/utils/task_timer.py +1 -1
  19. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cyclient/scan_config_base.py +2 -4
  20. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/pyproject.toml +16 -14
  21. cycode-1.11.1.dev1/cycode/__init__.py +0 -1
  22. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/__init__.py +0 -0
  23. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/__init__.py +0 -0
  24. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/auth/__init__.py +0 -0
  25. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/auth/auth_command.py +0 -0
  26. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/auth/auth_manager.py +0 -0
  27. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/configure/__init__.py +0 -0
  28. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/configure/configure_command.py +0 -0
  29. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/ignore/__init__.py +0 -0
  30. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/ignore/ignore_command.py +0 -0
  31. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/main_cli.py +0 -0
  32. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/report/__init__.py +0 -0
  33. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/report/report_command.py +0 -0
  34. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/report/sbom/__init__.py +0 -0
  35. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/report/sbom/common.py +0 -0
  36. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/report/sbom/path/__init__.py +0 -0
  37. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/report/sbom/path/path_command.py +0 -0
  38. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/report/sbom/repository_url/__init__.py +0 -0
  39. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/report/sbom/repository_url/repository_url_command.py +0 -0
  40. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/report/sbom/sbom_command.py +0 -0
  41. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/report/sbom/sbom_report_file.py +0 -0
  42. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/scan/__init__.py +0 -0
  43. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/scan/commit_history/__init__.py +0 -0
  44. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/scan/commit_history/commit_history_command.py +0 -0
  45. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/scan/path/__init__.py +0 -0
  46. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/scan/path/path_command.py +0 -0
  47. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/scan/pre_commit/__init__.py +0 -0
  48. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/scan/pre_commit/pre_commit_command.py +0 -0
  49. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/scan/pre_receive/__init__.py +0 -0
  50. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/scan/pre_receive/pre_receive_command.py +0 -0
  51. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/scan/repository/__init__.py +0 -0
  52. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/scan/repository/repository_command.py +0 -0
  53. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/scan/scan_ci/__init__.py +0 -0
  54. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/scan/scan_ci/ci_integrations.py +0 -0
  55. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/scan/scan_ci/scan_ci_command.py +0 -0
  56. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/scan/scan_command.py +0 -0
  57. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/version/__init__.py +0 -0
  58. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/commands/version/version_command.py +0 -0
  59. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/config.py +0 -0
  60. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/config.yaml +0 -0
  61. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/exceptions/__init__.py +0 -0
  62. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/exceptions/handle_report_sbom_errors.py +0 -0
  63. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/exceptions/handle_scan_errors.py +0 -0
  64. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/files_collector/__init__.py +0 -0
  65. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/files_collector/iac/__init__.py +0 -0
  66. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/files_collector/iac/tf_content_generator.py +0 -0
  67. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/files_collector/models/__init__.py +0 -0
  68. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/files_collector/models/in_memory_zip.py +0 -0
  69. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/files_collector/path_documents.py +0 -0
  70. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/files_collector/repository_documents.py +0 -0
  71. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/files_collector/sca/__init__.py +0 -0
  72. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/files_collector/sca/maven/__init__.py +0 -0
  73. {cycode-1.11.1.dev1/cycode/cli/files_collector/sca/nuget → cycode-1.11.1.dev4/cycode/cli/files_collector/sca/npm}/__init__.py +0 -0
  74. {cycode-1.11.1.dev1/cycode/cli/printers/tables → cycode-1.11.1.dev4/cycode/cli/files_collector/sca/nuget}/__init__.py +0 -0
  75. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/files_collector/sca/nuget/restore_nuget_dependencies.py +0 -0
  76. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/files_collector/zip_documents.py +0 -0
  77. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/main.py +0 -0
  78. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/models.py +0 -0
  79. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/printers/__init__.py +0 -0
  80. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/printers/console_printer.py +0 -0
  81. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/printers/json_printer.py +0 -0
  82. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/printers/printer_base.py +0 -0
  83. {cycode-1.11.1.dev1/cycode/cli/user_settings → cycode-1.11.1.dev4/cycode/cli/printers/tables}/__init__.py +0 -0
  84. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/printers/tables/sca_table_printer.py +0 -0
  85. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/printers/tables/table.py +0 -0
  86. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/printers/tables/table_models.py +0 -0
  87. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/printers/tables/table_printer.py +0 -0
  88. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/printers/tables/table_printer_base.py +0 -0
  89. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/printers/text_printer.py +0 -0
  90. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/sentry.py +0 -0
  91. {cycode-1.11.1.dev1/cycode/cli/utils → cycode-1.11.1.dev4/cycode/cli/user_settings}/__init__.py +0 -0
  92. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/user_settings/config_file_manager.py +0 -0
  93. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/user_settings/configuration_manager.py +0 -0
  94. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/user_settings/credentials_manager.py +0 -0
  95. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/user_settings/jwt_creator.py +0 -0
  96. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/utils/enum_utils.py +0 -0
  97. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/utils/get_api_client.py +0 -0
  98. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/utils/jwt_utils.py +0 -0
  99. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/utils/path_utils.py +0 -0
  100. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/utils/scan_batch.py +0 -0
  101. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/utils/scan_utils.py +0 -0
  102. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/utils/string_utils.py +0 -0
  103. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cli/utils/yaml_utils.py +0 -0
  104. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cyclient/__init__.py +0 -0
  105. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cyclient/auth_client.py +0 -0
  106. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cyclient/client_creator.py +0 -0
  107. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cyclient/config.py +0 -0
  108. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cyclient/config.yaml +0 -0
  109. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cyclient/config_dev.py +0 -0
  110. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cyclient/cycode_client.py +0 -0
  111. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cyclient/cycode_client_base.py +0 -0
  112. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cyclient/cycode_dev_based_client.py +0 -0
  113. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cyclient/cycode_token_based_client.py +0 -0
  114. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cyclient/headers.py +0 -0
  115. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cyclient/models.py +0 -0
  116. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cyclient/report_client.py +0 -0
  117. {cycode-1.11.1.dev1 → cycode-1.11.1.dev4}/cycode/cyclient/scan_client.py +0 -0
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cycode
3
- Version: 1.11.1.dev1
3
+ Version: 1.11.1.dev4
4
4
  Summary: Boost security in your dev lifecycle via SAST, SCA, Secrets & IaC scanning.
5
5
  Home-page: https://github.com/cycodehq/cycode-cli
6
6
  License: MIT
7
7
  Keywords: secret-scan,cycode,devops,token,secret,security,cycode,code
8
8
  Author: Cycode
9
9
  Author-email: support@cycode.com
10
- Requires-Python: >=3.7,<3.13
10
+ Requires-Python: >=3.8,<3.14
11
11
  Classifier: Development Status :: 5 - Production/Stable
12
12
  Classifier: Environment :: Console
13
13
  Classifier: License :: OSI Approved :: MIT License
@@ -15,23 +15,23 @@ Classifier: Natural Language :: English
15
15
  Classifier: Operating System :: OS Independent
16
16
  Classifier: Programming Language :: Python
17
17
  Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.7
19
18
  Classifier: Programming Language :: Python :: 3.8
20
19
  Classifier: Programming Language :: Python :: 3.9
21
20
  Classifier: Programming Language :: Python :: 3.10
22
21
  Classifier: Programming Language :: Python :: 3.11
23
22
  Classifier: Programming Language :: Python :: 3 :: Only
24
23
  Classifier: Programming Language :: Python :: 3.12
25
- Requires-Dist: arrow (>=1.0.0,<1.3.0)
24
+ Classifier: Programming Language :: Python :: 3.13
25
+ Requires-Dist: arrow (>=1.0.0,<1.4.0)
26
26
  Requires-Dist: binaryornot (>=0.4.4,<0.5.0)
27
27
  Requires-Dist: click (>=8.1.0,<8.2.0)
28
28
  Requires-Dist: colorama (>=0.4.3,<0.5.0)
29
29
  Requires-Dist: gitpython (>=3.1.30,<3.2.0)
30
- Requires-Dist: marshmallow (>=3.15.0,<3.21.0)
31
- Requires-Dist: pathspec (>=0.11.1,<0.12.0)
30
+ Requires-Dist: marshmallow (>=3.15.0,<3.23.0)
31
+ Requires-Dist: pathspec (>=0.11.1,<0.13.0)
32
32
  Requires-Dist: pyjwt (>=2.8.0,<3.0)
33
33
  Requires-Dist: pyyaml (>=6.0,<7.0)
34
- Requires-Dist: requests (>=2.24,<3.0)
34
+ Requires-Dist: requests (>=2.32.2,<3.0)
35
35
  Requires-Dist: sentry-sdk (>=2.8.0,<3.0)
36
36
  Requires-Dist: texttable (>=1.6.7,<1.8.0)
37
37
  Requires-Dist: urllib3 (==1.26.19)
@@ -92,12 +92,7 @@ This guide will guide you through both installation and usage.
92
92
 
93
93
  # Prerequisites
94
94
 
95
- > [!WARNING]
96
- > Python 3.7 end-of-life was on 2023-06-27.
97
- > It is recommended to use Python 3.8 or later.
98
- > We will drop support for Python 3.7 soon.
99
-
100
- - The Cycode CLI application requires Python version 3.7 or later.
95
+ - The Cycode CLI application requires Python version 3.8 or later.
101
96
  - Use the [`cycode auth` command](#using-the-auth-command) to authenticate to Cycode with the CLI
102
97
  - Alternatively, you can obtain a Cycode Client ID and Client Secret Key by following the steps detailed in the [Service Account Token](https://docs.cycode.com/reference/creating-a-service-account-access-token) and [Personal Access Token](https://docs.cycode.com/reference/creating-a-personal-access-token-1) pages, which contain details on obtaining these values.
103
98
 
@@ -52,12 +52,7 @@ This guide will guide you through both installation and usage.
52
52
 
53
53
  # Prerequisites
54
54
 
55
- > [!WARNING]
56
- > Python 3.7 end-of-life was on 2023-06-27.
57
- > It is recommended to use Python 3.8 or later.
58
- > We will drop support for Python 3.7 soon.
59
-
60
- - The Cycode CLI application requires Python version 3.7 or later.
55
+ - The Cycode CLI application requires Python version 3.8 or later.
61
56
  - Use the [`cycode auth` command](#using-the-auth-command) to authenticate to Cycode with the CLI
62
57
  - Alternatively, you can obtain a Cycode Client ID and Client Secret Key by following the steps detailed in the [Service Account Token](https://docs.cycode.com/reference/creating-a-service-account-access-token) and [Personal Access Token](https://docs.cycode.com/reference/creating-a-personal-access-token-1) pages, which contain details on obtaining these values.
63
58
 
@@ -0,0 +1 @@
1
+ __version__ = '1.11.1.dev4' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
@@ -253,8 +253,7 @@ def scan_commit_range(
253
253
 
254
254
  progress_bar.set_section_length(ScanProgressBarSection.PREPARE_LOCAL_FILES, total_commits_count)
255
255
 
256
- scanned_commits_count = 0
257
- for commit in repo.iter_commits(rev=commit_range):
256
+ for scanned_commits_count, commit in enumerate(repo.iter_commits(rev=commit_range)):
258
257
  if _does_reach_to_max_commits_to_scan_limit(commit_ids_to_scan, max_commits_count):
259
258
  logger.debug('Reached to max commits to scan count. Going to scan only %s last commits', max_commits_count)
260
259
  progress_bar.update(ScanProgressBarSection.PREPARE_LOCAL_FILES, total_commits_count - scanned_commits_count)
@@ -284,7 +283,6 @@ def scan_commit_range(
284
283
  )
285
284
 
286
285
  documents_to_scan.extend(exclude_irrelevant_documents_to_scan(scan_type, commit_documents_to_scan))
287
- scanned_commits_count += 1
288
286
 
289
287
  logger.debug('List of commit ids to scan, %s', {'commit_ids': commit_ids_to_scan})
290
288
  logger.debug('Starting to scan commit range (it may take a few minutes)')
@@ -48,7 +48,7 @@ SECRET_SCAN_FILE_EXTENSIONS_TO_IGNORE = (
48
48
  '.model',
49
49
  )
50
50
 
51
- SCA_CONFIGURATION_SCAN_SUPPORTED_FILES = (
51
+ SCA_CONFIGURATION_SCAN_SUPPORTED_FILES = ( # keep in lowercase
52
52
  'cargo.lock',
53
53
  'cargo.toml',
54
54
  'composer.json',
@@ -82,6 +82,8 @@ SCA_CONFIGURATION_SCAN_SUPPORTED_FILES = (
82
82
  'setup.py',
83
83
  'mix.exs',
84
84
  'mix.lock',
85
+ 'package.swift',
86
+ 'package.resolved',
85
87
  )
86
88
 
87
89
  SCA_EXCLUDED_PATHS = ('node_modules',)
@@ -101,6 +103,7 @@ PROJECT_FILES_BY_ECOSYSTEM_MAP = {
101
103
  'pypi_requirements': ['requirements.txt'],
102
104
  'pypi_setup': ['setup.py'],
103
105
  'hex': ['mix.exs', 'mix.lock'],
106
+ 'swift_pm': ['Package.swift', 'Package.resolved'],
104
107
  }
105
108
 
106
109
  COMMIT_RANGE_SCAN_SUPPORTED_SCAN_TYPES = [SECRET_SCAN_TYPE, SCA_SCAN_TYPE]
@@ -7,20 +7,16 @@ class CycodeError(Exception):
7
7
  """Base class for all custom exceptions"""
8
8
 
9
9
 
10
- class RequestError(CycodeError):
11
- ...
10
+ class RequestError(CycodeError): ...
12
11
 
13
12
 
14
- class RequestTimeout(RequestError):
15
- ...
13
+ class RequestTimeout(RequestError): ...
16
14
 
17
15
 
18
- class RequestConnectionError(RequestError):
19
- ...
16
+ class RequestConnectionError(RequestError): ...
20
17
 
21
18
 
22
- class RequestSslError(RequestConnectionError):
23
- ...
19
+ class RequestSslError(RequestConnectionError): ...
24
20
 
25
21
 
26
22
  class RequestHttpError(RequestError):
@@ -94,10 +94,7 @@ def _is_relevant_file_to_scan(scan_type: str, filename: str) -> bool:
94
94
  )
95
95
  return False
96
96
 
97
- if scan_type == consts.SCA_SCAN_TYPE and not _is_file_relevant_for_sca_scan(filename):
98
- return False
99
-
100
- return True
97
+ return not (scan_type == consts.SCA_SCAN_TYPE and not _is_file_relevant_for_sca_scan(filename))
101
98
 
102
99
 
103
100
  def _is_file_relevant_for_sca_scan(filename: str) -> bool:
@@ -13,9 +13,15 @@ def build_dep_tree_path(path: str, generated_file_name: str) -> str:
13
13
  return join_paths(get_file_dir(path), generated_file_name)
14
14
 
15
15
 
16
- def execute_command(command: List[str], file_name: str, command_timeout: int) -> Optional[str]:
16
+ def execute_command(
17
+ command: List[str], file_name: str, command_timeout: int, dependencies_file_name: Optional[str] = None
18
+ ) -> Optional[str]:
17
19
  try:
18
- dependencies = shell(command, command_timeout)
20
+ dependencies = shell(command=command, timeout=command_timeout)
21
+ # Write stdout output to the file if output_file_path is provided
22
+ if dependencies_file_name:
23
+ with open(dependencies_file_name, 'w') as output_file:
24
+ output_file.write(dependencies)
19
25
  except Exception as e:
20
26
  logger.debug('Failed to restore dependencies via shell command, %s', {'filename': file_name}, exc_info=e)
21
27
  return None
@@ -24,10 +30,13 @@ def execute_command(command: List[str], file_name: str, command_timeout: int) ->
24
30
 
25
31
 
26
32
  class BaseRestoreDependencies(ABC):
27
- def __init__(self, context: click.Context, is_git_diff: bool, command_timeout: int) -> None:
33
+ def __init__(
34
+ self, context: click.Context, is_git_diff: bool, command_timeout: int, create_output_file_manually: bool = False
35
+ ) -> None:
28
36
  self.context = context
29
37
  self.is_git_diff = is_git_diff
30
38
  self.command_timeout = command_timeout
39
+ self.create_output_file_manually = create_output_file_manually
31
40
 
32
41
  def restore(self, document: Document) -> Optional[Document]:
33
42
  return self.try_restore_dependencies(document)
@@ -46,9 +55,11 @@ class BaseRestoreDependencies(ABC):
46
55
  if self.verify_restore_file_already_exist(restore_file_path):
47
56
  restore_file_content = get_file_content(restore_file_path)
48
57
  else:
49
- restore_file_content = execute_command(
50
- self.get_command(manifest_file_path), manifest_file_path, self.command_timeout
58
+ output_file_path = restore_file_path if self.create_output_file_manually else None
59
+ execute_command(
60
+ self.get_command(manifest_file_path), manifest_file_path, self.command_timeout, output_file_path
51
61
  )
62
+ restore_file_content = get_file_content(restore_file_path)
52
63
 
53
64
  return Document(restore_file_path, restore_file_content, self.is_git_diff)
54
65
 
@@ -13,7 +13,7 @@ BUILD_GRADLE_DEP_TREE_FILE_NAME = 'gradle-dependencies-generated.txt'
13
13
 
14
14
  class RestoreGradleDependencies(BaseRestoreDependencies):
15
15
  def __init__(self, context: click.Context, is_git_diff: bool, command_timeout: int) -> None:
16
- super().__init__(context, is_git_diff, command_timeout)
16
+ super().__init__(context, is_git_diff, command_timeout, create_output_file_manually=True)
17
17
 
18
18
  def is_project(self, document: Document) -> bool:
19
19
  return document.path.endswith(BUILD_GRADLE_FILE_NAME) or document.path.endswith(BUILD_GRADLE_KTS_FILE_NAME)
@@ -1,3 +1,4 @@
1
+ import os
1
2
  from os import path
2
3
  from typing import List, Optional
3
4
 
@@ -30,7 +31,7 @@ class RestoreMavenDependencies(BaseRestoreDependencies):
30
31
  return join_paths('target', MAVEN_CYCLONE_DEP_TREE_FILE_NAME)
31
32
 
32
33
  def verify_restore_file_already_exist(self, restore_file_path: str) -> bool:
33
- return False
34
+ return os.path.isfile(restore_file_path)
34
35
 
35
36
  def try_restore_dependencies(self, document: Document) -> Optional[Document]:
36
37
  restore_dependencies_document = super().try_restore_dependencies(document)
@@ -0,0 +1,39 @@
1
+ import os
2
+ from typing import List
3
+
4
+ import click
5
+
6
+ from cycode.cli.files_collector.sca.base_restore_dependencies import BaseRestoreDependencies
7
+ from cycode.cli.models import Document
8
+
9
+ NPM_PROJECT_FILE_EXTENSIONS = ['.json']
10
+ NPM_LOCK_FILE_NAME = 'package-lock.json'
11
+ NPM_MANIFEST_FILE_NAME = 'package.json'
12
+
13
+
14
+ class RestoreNpmDependencies(BaseRestoreDependencies):
15
+ def __init__(self, context: click.Context, is_git_diff: bool, command_timeout: int) -> None:
16
+ super().__init__(context, is_git_diff, command_timeout)
17
+
18
+ def is_project(self, document: Document) -> bool:
19
+ return any(document.path.endswith(ext) for ext in NPM_PROJECT_FILE_EXTENSIONS)
20
+
21
+ def get_command(self, manifest_file_path: str) -> List[str]:
22
+ return [
23
+ 'npm',
24
+ 'install',
25
+ '--prefix',
26
+ self.prepare_manifest_file_path_for_command(manifest_file_path),
27
+ '--package-lock-only',
28
+ '--ignore-scripts',
29
+ '--no-audit',
30
+ ]
31
+
32
+ def get_lock_file_name(self) -> str:
33
+ return NPM_LOCK_FILE_NAME
34
+
35
+ def verify_restore_file_already_exist(self, restore_file_path: str) -> bool:
36
+ return os.path.isfile(restore_file_path)
37
+
38
+ def prepare_manifest_file_path_for_command(self, manifest_file_path: str) -> str:
39
+ return manifest_file_path.replace(os.sep + NPM_MANIFEST_FILE_NAME, '')
@@ -7,6 +7,7 @@ from cycode.cli import consts
7
7
  from cycode.cli.files_collector.sca.base_restore_dependencies import BaseRestoreDependencies
8
8
  from cycode.cli.files_collector.sca.maven.restore_gradle_dependencies import RestoreGradleDependencies
9
9
  from cycode.cli.files_collector.sca.maven.restore_maven_dependencies import RestoreMavenDependencies
10
+ from cycode.cli.files_collector.sca.npm.restore_npm_dependencies import RestoreNpmDependencies
10
11
  from cycode.cli.files_collector.sca.nuget.restore_nuget_dependencies import RestoreNugetDependencies
11
12
  from cycode.cli.models import Document
12
13
  from cycode.cli.utils.git_proxy import git_proxy
@@ -18,6 +19,7 @@ if TYPE_CHECKING:
18
19
 
19
20
  BUILD_GRADLE_DEP_TREE_TIMEOUT = 180
20
21
  BUILD_NUGET_DEP_TREE_TIMEOUT = 180
22
+ BUILD_NPM_DEP_TREE_TIMEOUT = 180
21
23
 
22
24
 
23
25
  def perform_pre_commit_range_scan_actions(
@@ -132,6 +134,7 @@ def restore_handlers(context: click.Context, is_git_diff: bool) -> List[BaseRest
132
134
  RestoreGradleDependencies(context, is_git_diff, BUILD_GRADLE_DEP_TREE_TIMEOUT),
133
135
  RestoreMavenDependencies(context, is_git_diff, BUILD_GRADLE_DEP_TREE_TIMEOUT),
134
136
  RestoreNugetDependencies(context, is_git_diff, BUILD_NUGET_DEP_TREE_TIMEOUT),
137
+ RestoreNpmDependencies(context, is_git_diff, BUILD_NPM_DEP_TREE_TIMEOUT),
135
138
  ]
136
139
 
137
140
 
@@ -7,8 +7,7 @@ from cycode.cli.utils.yaml_utils import read_file, update_file
7
7
 
8
8
  class BaseFileManager(ABC):
9
9
  @abstractmethod
10
- def get_filename(self) -> str:
11
- ...
10
+ def get_filename(self) -> str: ...
12
11
 
13
12
  def read_file(self) -> Dict[Hashable, Any]:
14
13
  return read_file(self.get_filename())
File without changes
@@ -25,20 +25,16 @@ class GitProxyError(Exception):
25
25
 
26
26
  class _AbstractGitProxy(ABC):
27
27
  @abstractmethod
28
- def get_repo(self, path: Optional['PathLike'] = None, *args, **kwargs) -> 'Repo':
29
- ...
28
+ def get_repo(self, path: Optional['PathLike'] = None, *args, **kwargs) -> 'Repo': ...
30
29
 
31
30
  @abstractmethod
32
- def get_null_tree(self) -> object:
33
- ...
31
+ def get_null_tree(self) -> object: ...
34
32
 
35
33
  @abstractmethod
36
- def get_invalid_git_repository_error(self) -> Type[BaseException]:
37
- ...
34
+ def get_invalid_git_repository_error(self) -> Type[BaseException]: ...
38
35
 
39
36
  @abstractmethod
40
- def get_git_command_error(self) -> Type[BaseException]:
41
- ...
37
+ def get_git_command_error(self) -> Type[BaseException]: ...
42
38
 
43
39
 
44
40
  class _DummyGitProxy(_AbstractGitProxy):
@@ -92,32 +92,25 @@ class BaseProgressBar(ABC):
92
92
  pass
93
93
 
94
94
  @abstractmethod
95
- def __enter__(self) -> 'BaseProgressBar':
96
- ...
95
+ def __enter__(self) -> 'BaseProgressBar': ...
97
96
 
98
97
  @abstractmethod
99
- def __exit__(self, *args, **kwargs) -> None:
100
- ...
98
+ def __exit__(self, *args, **kwargs) -> None: ...
101
99
 
102
100
  @abstractmethod
103
- def start(self) -> None:
104
- ...
101
+ def start(self) -> None: ...
105
102
 
106
103
  @abstractmethod
107
- def stop(self) -> None:
108
- ...
104
+ def stop(self) -> None: ...
109
105
 
110
106
  @abstractmethod
111
- def set_section_length(self, section: 'ProgressBarSection', length: int = 0) -> None:
112
- ...
107
+ def set_section_length(self, section: 'ProgressBarSection', length: int = 0) -> None: ...
113
108
 
114
109
  @abstractmethod
115
- def update(self, section: 'ProgressBarSection') -> None:
116
- ...
110
+ def update(self, section: 'ProgressBarSection') -> None: ...
117
111
 
118
112
  @abstractmethod
119
- def update_label(self, label: Optional[str] = None) -> None:
120
- ...
113
+ def update_label(self, label: Optional[str] = None) -> None: ...
121
114
 
122
115
 
123
116
  class DummyProgressBar(BaseProgressBar):
@@ -8,18 +8,12 @@ from cycode.cyclient import logger
8
8
  _SUBPROCESS_DEFAULT_TIMEOUT_SEC = 60
9
9
 
10
10
 
11
- def shell(
12
- command: Union[str, List[str]], timeout: int = _SUBPROCESS_DEFAULT_TIMEOUT_SEC, execute_in_shell: bool = False
13
- ) -> Optional[str]:
11
+ def shell(command: Union[str, List[str]], timeout: int = _SUBPROCESS_DEFAULT_TIMEOUT_SEC) -> Optional[str]:
14
12
  logger.debug('Executing shell command: %s', command)
15
13
 
16
14
  try:
17
- result = subprocess.run(
18
- command,
19
- timeout=timeout,
20
- shell=execute_in_shell, # noqa: S603
21
- check=True,
22
- capture_output=True,
15
+ result = subprocess.run( # noqa: S603
16
+ command, timeout=timeout, check=True, capture_output=True
23
17
  )
24
18
 
25
19
  return result.stdout.decode('UTF-8').strip()
@@ -73,7 +73,7 @@ class TimeoutAfter:
73
73
 
74
74
  # catch the exception of interrupt_main before exiting
75
75
  # the with statement and throw timeout error instead
76
- if exc_type == KeyboardInterrupt:
76
+ if exc_type is KeyboardInterrupt:
77
77
  raise TimeoutError(f'Task timed out after {self.timeout} seconds')
78
78
 
79
79
  def timeout_function(self) -> None:
@@ -5,8 +5,7 @@ from cycode.cli import consts
5
5
 
6
6
  class ScanConfigBase(ABC):
7
7
  @abstractmethod
8
- def get_service_name(self, scan_type: str, should_use_scan_service: bool = False) -> str:
9
- ...
8
+ def get_service_name(self, scan_type: str, should_use_scan_service: bool = False) -> str: ...
10
9
 
11
10
  @staticmethod
12
11
  def get_async_scan_type(scan_type: str) -> str:
@@ -25,8 +24,7 @@ class ScanConfigBase(ABC):
25
24
  return 'repository'
26
25
 
27
26
  @abstractmethod
28
- def get_detections_prefix(self) -> str:
29
- ...
27
+ def get_detections_prefix(self) -> str: ...
30
28
 
31
29
 
32
30
  class DevScanConfig(ScanConfigBase):
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cycode"
3
- version = "1.11.1.dev1" # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
3
+ version = "1.11.1.dev4" # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
4
4
  description = "Boost security in your dev lifecycle via SAST, SCA, Secrets & IaC scanning."
5
5
  keywords=["secret-scan", "cycode", "devops", "token", "secret", "security", "cycode", "code"]
6
6
  authors = ["Cycode <support@cycode.com>"]
@@ -15,29 +15,29 @@ classifiers = [
15
15
  "Operating System :: OS Independent",
16
16
  "Programming Language :: Python",
17
17
  "Programming Language :: Python :: 3 :: Only",
18
- "Programming Language :: Python :: 3.7",
19
18
  "Programming Language :: Python :: 3.8",
20
19
  "Programming Language :: Python :: 3.9",
21
20
  "Programming Language :: Python :: 3.10",
22
21
  "Programming Language :: Python :: 3.11",
23
22
  "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
24
24
  ]
25
25
 
26
26
  [tool.poetry.scripts]
27
27
  cycode = "cycode.cli.main:main_cli"
28
28
 
29
29
  [tool.poetry.dependencies]
30
- python = ">=3.7,<3.13"
30
+ python = ">=3.8,<3.14"
31
31
  click = ">=8.1.0,<8.2.0"
32
32
  colorama = ">=0.4.3,<0.5.0"
33
33
  pyyaml = ">=6.0,<7.0"
34
- marshmallow = ">=3.15.0,<3.21.0"
35
- pathspec = ">=0.11.1,<0.12.0"
34
+ marshmallow = ">=3.15.0,<3.23.0" # 3.23 dropped support for Python 3.8
35
+ pathspec = ">=0.11.1,<0.13.0"
36
36
  gitpython = ">=3.1.30,<3.2.0"
37
- arrow = ">=1.0.0,<1.3.0"
37
+ arrow = ">=1.0.0,<1.4.0"
38
38
  binaryornot = ">=0.4.4,<0.5.0"
39
39
  texttable = ">=1.6.7,<1.8.0"
40
- requests = ">=2.24,<3.0"
40
+ requests = ">=2.32.2,<3.0"
41
41
  urllib3 = "1.26.19" # lock v1 to avoid issues with openssl and old Python versions (<3.9.11) on macOS
42
42
  sentry-sdk = ">=2.8.0,<3.0"
43
43
  pyjwt = ">=2.8.0,<3.0"
@@ -50,11 +50,11 @@ coverage = ">=7.2.3,<7.3.0"
50
50
  responses = ">=0.23.1,<0.24.0"
51
51
 
52
52
  [tool.poetry.group.executable.dependencies]
53
- pyinstaller = ">=5.13.2,<5.14.0"
54
- dunamai = ">=1.18.0,<1.19.0"
53
+ pyinstaller = {version=">=5.13.2,<5.14.0", python=">=3.8,<3.13"}
54
+ dunamai = ">=1.18.0,<1.22.0"
55
55
 
56
56
  [tool.poetry.group.dev.dependencies]
57
- ruff = "0.1.11"
57
+ ruff = "0.6.9"
58
58
 
59
59
  [tool.pytest.ini_options]
60
60
  log_cli = true
@@ -70,6 +70,10 @@ vcs = "git"
70
70
  style = "pep440"
71
71
 
72
72
  [tool.ruff]
73
+ line-length = 120
74
+ target-version = "py38"
75
+
76
+ [tool.ruff.lint]
73
77
  extend-select = [
74
78
  "E", # pycodestyle errors
75
79
  "W", # pycodestyle warnings
@@ -100,8 +104,6 @@ extend-select = [
100
104
  "YTT",
101
105
  "G",
102
106
  ]
103
- line-length = 120
104
- target-version = "py37"
105
107
  ignore = [
106
108
  "ANN002", # Missing type annotation for `*args`
107
109
  "ANN003", # Missing type annotation for `**kwargs`
@@ -111,7 +113,7 @@ ignore = [
111
113
  "ISC001", # Conflicts with ruff format
112
114
  ]
113
115
 
114
- [tool.ruff.flake8-quotes]
116
+ [tool.ruff.lint.flake8-quotes]
115
117
  docstring-quotes = "double"
116
118
  multiline-quotes = "double"
117
119
  inline-quotes = "single"
@@ -119,7 +121,7 @@ inline-quotes = "single"
119
121
  [tool.ruff.lint.flake8-tidy-imports]
120
122
  ban-relative-imports = "all"
121
123
 
122
- [tool.ruff.per-file-ignores]
124
+ [tool.ruff.lint.per-file-ignores]
123
125
  "tests/*.py" = ["S101", "S105"]
124
126
  "cycode/*.py" = ["BLE001"]
125
127
 
@@ -1 +0,0 @@
1
- __version__ = '1.11.1.dev1' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag