cycode 2.2.1.dev1__tar.gz → 2.2.1.dev3__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 (134) hide show
  1. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/PKG-INFO +3 -3
  2. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/README.md +2 -2
  3. cycode-2.2.1.dev3/cycode/__init__.py +1 -0
  4. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/scan/code_scanner.py +3 -2
  5. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/scan/scan_command.py +2 -1
  6. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/consts.py +8 -6
  7. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/zip_documents.py +3 -6
  8. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/utils/scan_batch.py +9 -13
  9. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cyclient/scan_client.py +3 -3
  10. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cyclient/scan_config_base.py +6 -6
  11. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/pyproject.toml +1 -1
  12. cycode-2.2.1.dev1/cycode/__init__.py +0 -1
  13. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/LICENCE +0 -0
  14. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/__init__.py +0 -0
  15. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/__init__.py +0 -0
  16. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/ai_remediation/__init__.py +0 -0
  17. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/ai_remediation/ai_remediation_command.py +0 -0
  18. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/auth/__init__.py +0 -0
  19. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/auth/auth_command.py +0 -0
  20. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/auth/auth_manager.py +0 -0
  21. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/auth_common.py +0 -0
  22. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/configure/__init__.py +0 -0
  23. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/configure/configure_command.py +0 -0
  24. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/ignore/__init__.py +0 -0
  25. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/ignore/ignore_command.py +0 -0
  26. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/main_cli.py +0 -0
  27. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/report/__init__.py +0 -0
  28. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/report/report_command.py +0 -0
  29. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/report/sbom/__init__.py +0 -0
  30. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/report/sbom/common.py +0 -0
  31. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/report/sbom/path/__init__.py +0 -0
  32. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/report/sbom/path/path_command.py +0 -0
  33. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/report/sbom/repository_url/__init__.py +0 -0
  34. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/report/sbom/repository_url/repository_url_command.py +0 -0
  35. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/report/sbom/sbom_command.py +0 -0
  36. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/report/sbom/sbom_report_file.py +0 -0
  37. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/scan/__init__.py +0 -0
  38. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/scan/commit_history/__init__.py +0 -0
  39. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/scan/commit_history/commit_history_command.py +0 -0
  40. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/scan/path/__init__.py +0 -0
  41. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/scan/path/path_command.py +0 -0
  42. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/scan/pre_commit/__init__.py +0 -0
  43. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/scan/pre_commit/pre_commit_command.py +0 -0
  44. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/scan/pre_receive/__init__.py +0 -0
  45. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/scan/pre_receive/pre_receive_command.py +0 -0
  46. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/scan/repository/__init__.py +0 -0
  47. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/scan/repository/repository_command.py +0 -0
  48. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/scan/scan_ci/__init__.py +0 -0
  49. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/scan/scan_ci/ci_integrations.py +0 -0
  50. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/scan/scan_ci/scan_ci_command.py +0 -0
  51. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/status/__init__.py +0 -0
  52. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/status/status_command.py +0 -0
  53. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/version/__init__.py +0 -0
  54. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/version/version_checker.py +0 -0
  55. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/commands/version/version_command.py +0 -0
  56. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/config.py +0 -0
  57. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/config.yaml +0 -0
  58. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/exceptions/__init__.py +0 -0
  59. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/exceptions/common.py +0 -0
  60. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/exceptions/custom_exceptions.py +0 -0
  61. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/exceptions/handle_ai_remediation_errors.py +0 -0
  62. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/exceptions/handle_report_sbom_errors.py +0 -0
  63. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/exceptions/handle_scan_errors.py +0 -0
  64. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/__init__.py +0 -0
  65. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/excluder.py +0 -0
  66. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/iac/__init__.py +0 -0
  67. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/iac/tf_content_generator.py +0 -0
  68. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/models/__init__.py +0 -0
  69. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/models/in_memory_zip.py +0 -0
  70. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/path_documents.py +0 -0
  71. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/repository_documents.py +0 -0
  72. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/sca/__init__.py +0 -0
  73. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/sca/base_restore_dependencies.py +0 -0
  74. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/sca/go/__init__.py +0 -0
  75. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/sca/go/restore_go_dependencies.py +0 -0
  76. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/sca/maven/__init__.py +0 -0
  77. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/sca/maven/restore_gradle_dependencies.py +0 -0
  78. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/sca/maven/restore_maven_dependencies.py +0 -0
  79. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/sca/npm/__init__.py +0 -0
  80. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/sca/npm/restore_npm_dependencies.py +0 -0
  81. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/sca/nuget/__init__.py +0 -0
  82. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/sca/nuget/restore_nuget_dependencies.py +0 -0
  83. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/sca/ruby/__init__.py +0 -0
  84. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/sca/ruby/restore_ruby_dependencies.py +0 -0
  85. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/sca/sbt/__init__.py +0 -0
  86. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/sca/sbt/restore_sbt_dependencies.py +0 -0
  87. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/sca/sca_code_scanner.py +0 -0
  88. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/files_collector/walk_ignore.py +0 -0
  89. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/main.py +0 -0
  90. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/models.py +0 -0
  91. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/printers/__init__.py +0 -0
  92. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/printers/console_printer.py +0 -0
  93. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/printers/json_printer.py +0 -0
  94. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/printers/printer_base.py +0 -0
  95. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/printers/tables/__init__.py +0 -0
  96. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/printers/tables/sca_table_printer.py +0 -0
  97. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/printers/tables/table.py +0 -0
  98. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/printers/tables/table_models.py +0 -0
  99. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/printers/tables/table_printer.py +0 -0
  100. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/printers/tables/table_printer_base.py +0 -0
  101. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/printers/text_printer.py +0 -0
  102. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/sentry.py +0 -0
  103. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/user_settings/__init__.py +0 -0
  104. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/user_settings/base_file_manager.py +0 -0
  105. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/user_settings/config_file_manager.py +0 -0
  106. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/user_settings/configuration_manager.py +0 -0
  107. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/user_settings/credentials_manager.py +0 -0
  108. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/user_settings/jwt_creator.py +0 -0
  109. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/utils/__init__.py +0 -0
  110. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/utils/enum_utils.py +0 -0
  111. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/utils/get_api_client.py +0 -0
  112. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/utils/git_proxy.py +0 -0
  113. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/utils/ignore_utils.py +0 -0
  114. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/utils/jwt_utils.py +0 -0
  115. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/utils/path_utils.py +0 -0
  116. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/utils/progress_bar.py +0 -0
  117. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/utils/scan_utils.py +0 -0
  118. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/utils/shell_executor.py +0 -0
  119. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/utils/string_utils.py +0 -0
  120. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/utils/task_timer.py +0 -0
  121. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cli/utils/yaml_utils.py +0 -0
  122. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cyclient/__init__.py +0 -0
  123. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cyclient/auth_client.py +0 -0
  124. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cyclient/client_creator.py +0 -0
  125. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cyclient/config.py +0 -0
  126. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cyclient/config.yaml +0 -0
  127. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cyclient/config_dev.py +0 -0
  128. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cyclient/cycode_client.py +0 -0
  129. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cyclient/cycode_client_base.py +0 -0
  130. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cyclient/cycode_dev_based_client.py +0 -0
  131. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cyclient/cycode_token_based_client.py +0 -0
  132. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cyclient/headers.py +0 -0
  133. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cyclient/models.py +0 -0
  134. {cycode-2.2.1.dev1 → cycode-2.2.1.dev3}/cycode/cyclient/report_client.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cycode
3
- Version: 2.2.1.dev1
3
+ Version: 2.2.1.dev3
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
@@ -458,11 +458,11 @@ To limit the results of the `sca` scan to a specific severity threshold, add the
458
458
 
459
459
  Consider the following example. The following command will scan the repository for SCA policy violations that have a severity of Medium or higher:
460
460
 
461
- `cycode scan -t sca --security-threshold MEDIUM repository ~/home/git/codebase`
461
+ `cycode scan -t sca --severity-threshold MEDIUM repository ~/home/git/codebase`
462
462
 
463
463
  or:
464
464
 
465
- `cycode scan --scan-type sca --security-threshold MEDIUM repository ~/home/git/codebase`
465
+ `cycode scan --scan-type sca --severity-threshold MEDIUM repository ~/home/git/codebase`
466
466
 
467
467
  ### Path Scan
468
468
 
@@ -417,11 +417,11 @@ To limit the results of the `sca` scan to a specific severity threshold, add the
417
417
 
418
418
  Consider the following example. The following command will scan the repository for SCA policy violations that have a severity of Medium or higher:
419
419
 
420
- `cycode scan -t sca --security-threshold MEDIUM repository ~/home/git/codebase`
420
+ `cycode scan -t sca --severity-threshold MEDIUM repository ~/home/git/codebase`
421
421
 
422
422
  or:
423
423
 
424
- `cycode scan --scan-type sca --security-threshold MEDIUM repository ~/home/git/codebase`
424
+ `cycode scan --scan-type sca --severity-threshold MEDIUM repository ~/home/git/codebase`
425
425
 
426
426
  ### Path Scan
427
427
 
@@ -0,0 +1 @@
1
+ __version__ = '2.2.1.dev3' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
@@ -301,6 +301,7 @@ def scan_documents(
301
301
  if not scan_parameters:
302
302
  scan_parameters = get_default_scan_parameters(context)
303
303
 
304
+ scan_type = context.obj['scan_type']
304
305
  progress_bar = context.obj['progress_bar']
305
306
 
306
307
  if not documents_to_scan:
@@ -318,13 +319,13 @@ def scan_documents(
318
319
  context, is_git_diff, is_commit_range, scan_parameters
319
320
  )
320
321
  errors, local_scan_results = run_parallel_batched_scan(
321
- scan_batch_thread_func, documents_to_scan, progress_bar=progress_bar
322
+ scan_batch_thread_func, scan_type, documents_to_scan, progress_bar=progress_bar
322
323
  )
323
324
 
324
325
  if len(local_scan_results) > 1:
325
326
  # if we used more than one batch, we need to fetch aggregate report url
326
327
  aggregation_report_url = _try_get_aggregation_report_url_if_needed(
327
- scan_parameters, context.obj['client'], context.obj['scan_type']
328
+ scan_parameters, context.obj['client'], scan_type
328
329
  )
329
330
  set_aggregation_report_url(context, aggregation_report_url)
330
331
 
@@ -3,6 +3,7 @@ from typing import List
3
3
 
4
4
  import click
5
5
 
6
+ from cycode.cli import consts
6
7
  from cycode.cli.commands.scan.commit_history.commit_history_command import commit_history_command
7
8
  from cycode.cli.commands.scan.path.path_command import path_command
8
9
  from cycode.cli.commands.scan.pre_commit.pre_commit_command import pre_commit_command
@@ -34,7 +35,7 @@ from cycode.cli.utils.get_api_client import get_scan_cycode_client
34
35
  @click.option(
35
36
  '--scan-type',
36
37
  '-t',
37
- default='secret',
38
+ default=consts.SECRET_SCAN_TYPE,
38
39
  help='Specify the type of scan you wish to execute (the default is Secrets).',
39
40
  type=click.Choice(config['scans']['supported_scans']),
40
41
  )
@@ -136,14 +136,16 @@ EXCLUSIONS_BY_CVE_SECTION_NAME = 'cves'
136
136
  # 5MB in bytes (in decimal)
137
137
  FILE_MAX_SIZE_LIMIT_IN_BYTES = 5000000
138
138
 
139
- # 20MB in bytes (in binary)
140
- ZIP_MAX_SIZE_LIMIT_IN_BYTES = 20971520
141
- # 200MB in bytes (in binary)
142
- SCA_ZIP_MAX_SIZE_LIMIT_IN_BYTES = 209715200
139
+ DEFAULT_ZIP_MAX_SIZE_LIMIT_IN_BYTES = 20 * 1024 * 1024
140
+ ZIP_MAX_SIZE_LIMIT_IN_BYTES = {
141
+ SCA_SCAN_TYPE: 200 * 1024 * 1024,
142
+ SAST_SCAN_TYPE: 50 * 1024 * 1024,
143
+ }
143
144
 
144
145
  # scan in batches
145
- SCAN_BATCH_MAX_SIZE_IN_BYTES = 9 * 1024 * 1024
146
- SCAN_BATCH_MAX_FILES_COUNT = 1000
146
+ DEFAULT_SCAN_BATCH_MAX_SIZE_IN_BYTES = 9 * 1024 * 1024
147
+ SCAN_BATCH_MAX_SIZE_IN_BYTES = {SAST_SCAN_TYPE: 50 * 1024 * 1024}
148
+ DEFAULT_SCAN_BATCH_MAX_FILES_COUNT = 1000
147
149
  # if we increase this values, the server doesn't allow connecting (ConnectionError)
148
150
  SCAN_BATCH_MAX_PARALLEL_SCANS = 5
149
151
  SCAN_BATCH_SCANS_PER_CPU = 1
@@ -10,12 +10,9 @@ from cycode.cyclient import logger
10
10
 
11
11
 
12
12
  def _validate_zip_file_size(scan_type: str, zip_file_size: int) -> None:
13
- if scan_type == consts.SCA_SCAN_TYPE:
14
- if zip_file_size > consts.SCA_ZIP_MAX_SIZE_LIMIT_IN_BYTES:
15
- raise custom_exceptions.ZipTooLargeError(consts.SCA_ZIP_MAX_SIZE_LIMIT_IN_BYTES)
16
- else:
17
- if zip_file_size > consts.ZIP_MAX_SIZE_LIMIT_IN_BYTES:
18
- raise custom_exceptions.ZipTooLargeError(consts.ZIP_MAX_SIZE_LIMIT_IN_BYTES)
13
+ max_size_limit = consts.ZIP_MAX_SIZE_LIMIT_IN_BYTES.get(scan_type, consts.DEFAULT_ZIP_MAX_SIZE_LIMIT_IN_BYTES)
14
+ if zip_file_size > max_size_limit:
15
+ raise custom_exceptions.ZipTooLargeError(max_size_limit)
19
16
 
20
17
 
21
18
  def zip_documents(scan_type: str, documents: List[Document], zip_file: Optional[InMemoryZip] = None) -> InMemoryZip:
@@ -2,12 +2,7 @@ import os
2
2
  from multiprocessing.pool import ThreadPool
3
3
  from typing import TYPE_CHECKING, Callable, Dict, List, Tuple
4
4
 
5
- from cycode.cli.consts import (
6
- SCAN_BATCH_MAX_FILES_COUNT,
7
- SCAN_BATCH_MAX_PARALLEL_SCANS,
8
- SCAN_BATCH_MAX_SIZE_IN_BYTES,
9
- SCAN_BATCH_SCANS_PER_CPU,
10
- )
5
+ from cycode.cli import consts
11
6
  from cycode.cli.models import Document
12
7
  from cycode.cli.utils.progress_bar import ScanProgressBarSection
13
8
 
@@ -18,8 +13,8 @@ if TYPE_CHECKING:
18
13
 
19
14
  def split_documents_into_batches(
20
15
  documents: List[Document],
21
- max_size_mb: int = SCAN_BATCH_MAX_SIZE_IN_BYTES,
22
- max_files_count: int = SCAN_BATCH_MAX_FILES_COUNT,
16
+ max_size: int = consts.DEFAULT_SCAN_BATCH_MAX_SIZE_IN_BYTES,
17
+ max_files_count: int = consts.DEFAULT_SCAN_BATCH_MAX_FILES_COUNT,
23
18
  ) -> List[List[Document]]:
24
19
  batches = []
25
20
 
@@ -28,7 +23,7 @@ def split_documents_into_batches(
28
23
  for document in documents:
29
24
  document_size = len(document.content.encode('UTF-8'))
30
25
 
31
- if (current_size + document_size > max_size_mb) or (len(current_batch) >= max_files_count):
26
+ if (current_size + document_size > max_size) or (len(current_batch) >= max_files_count):
32
27
  batches.append(current_batch)
33
28
 
34
29
  current_batch = [document]
@@ -45,17 +40,18 @@ def split_documents_into_batches(
45
40
 
46
41
  def _get_threads_count() -> int:
47
42
  cpu_count = os.cpu_count() or 1
48
- return min(cpu_count * SCAN_BATCH_SCANS_PER_CPU, SCAN_BATCH_MAX_PARALLEL_SCANS)
43
+ return min(cpu_count * consts.SCAN_BATCH_SCANS_PER_CPU, consts.SCAN_BATCH_MAX_PARALLEL_SCANS)
49
44
 
50
45
 
51
46
  def run_parallel_batched_scan(
52
47
  scan_function: Callable[[List[Document]], Tuple[str, 'CliError', 'LocalScanResult']],
48
+ scan_type: str,
53
49
  documents: List[Document],
54
50
  progress_bar: 'BaseProgressBar',
55
- max_size_mb: int = SCAN_BATCH_MAX_SIZE_IN_BYTES,
56
- max_files_count: int = SCAN_BATCH_MAX_FILES_COUNT,
57
51
  ) -> Tuple[Dict[str, 'CliError'], List['LocalScanResult']]:
58
- batches = split_documents_into_batches(documents, max_size_mb, max_files_count)
52
+ max_size = consts.SCAN_BATCH_MAX_SIZE_IN_BYTES.get(scan_type, consts.DEFAULT_SCAN_BATCH_MAX_SIZE_IN_BYTES)
53
+ batches = split_documents_into_batches(documents, max_size)
54
+
59
55
  progress_bar.set_section_length(ScanProgressBarSection.SCAN, len(batches)) # * 3
60
56
  # TODO(MarshalX): we should multiply the count of batches in SCAN section because each batch has 3 steps:
61
57
  # 1. scan creation
@@ -328,11 +328,11 @@ class ScanClient:
328
328
  @staticmethod
329
329
  def get_service_name(scan_type: str) -> Optional[str]:
330
330
  # TODO(MarshalX): get_service_name should be removed from ScanClient? Because it exists in ScanConfig
331
- if scan_type == 'secret':
331
+ if scan_type == consts.SECRET_SCAN_TYPE:
332
332
  return 'secret'
333
- if scan_type == 'iac':
333
+ if scan_type == consts.INFRA_CONFIGURATION_SCAN_TYPE:
334
334
  return 'iac'
335
- if scan_type == 'sca' or scan_type == 'sast':
335
+ if scan_type == consts.SCA_SCAN_TYPE or scan_type == consts.SAST_SCAN_TYPE:
336
336
  return 'scans'
337
337
 
338
338
  return None
@@ -9,9 +9,9 @@ class ScanConfigBase(ABC):
9
9
 
10
10
  @staticmethod
11
11
  def get_async_scan_type(scan_type: str) -> str:
12
- if scan_type == 'secret':
12
+ if scan_type == consts.SECRET_SCAN_TYPE:
13
13
  return 'Secrets'
14
- if scan_type == 'iac':
14
+ if scan_type == consts.INFRA_CONFIGURATION_SCAN_TYPE:
15
15
  return 'InfraConfiguration'
16
16
 
17
17
  return scan_type.upper()
@@ -31,9 +31,9 @@ class DevScanConfig(ScanConfigBase):
31
31
  def get_service_name(self, scan_type: str, should_use_scan_service: bool = False) -> str:
32
32
  if should_use_scan_service:
33
33
  return '5004'
34
- if scan_type == 'secret':
34
+ if scan_type == consts.SECRET_SCAN_TYPE:
35
35
  return '5025'
36
- if scan_type == 'iac':
36
+ if scan_type == consts.INFRA_CONFIGURATION_SCAN_TYPE:
37
37
  return '5026'
38
38
 
39
39
  # sca and sast
@@ -47,9 +47,9 @@ class DefaultScanConfig(ScanConfigBase):
47
47
  def get_service_name(self, scan_type: str, should_use_scan_service: bool = False) -> str:
48
48
  if should_use_scan_service:
49
49
  return 'scans'
50
- if scan_type == 'secret':
50
+ if scan_type == consts.SECRET_SCAN_TYPE:
51
51
  return 'secret'
52
- if scan_type == 'iac':
52
+ if scan_type == consts.INFRA_CONFIGURATION_SCAN_TYPE:
53
53
  return 'iac'
54
54
 
55
55
  # sca and sast
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cycode"
3
- version = "2.2.1.dev1" # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
3
+ version = "2.2.1.dev3" # 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>"]
@@ -1 +0,0 @@
1
- __version__ = '2.2.1.dev1' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
File without changes