cycode 1.9.5__tar.gz → 1.9.5.dev1__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 (110) hide show
  1. {cycode-1.9.5 → cycode-1.9.5.dev1}/PKG-INFO +1 -1
  2. cycode-1.9.5.dev1/cycode/__init__.py +1 -0
  3. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/scan/code_scanner.py +10 -6
  4. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/consts.py +2 -2
  5. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cyclient/models.py +2 -5
  6. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cyclient/scan_client.py +22 -4
  7. {cycode-1.9.5 → cycode-1.9.5.dev1}/pyproject.toml +1 -1
  8. cycode-1.9.5/cycode/__init__.py +0 -1
  9. {cycode-1.9.5 → cycode-1.9.5.dev1}/README.md +0 -0
  10. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/__init__.py +0 -0
  11. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/__init__.py +0 -0
  12. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/auth/__init__.py +0 -0
  13. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/auth/auth_command.py +0 -0
  14. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/auth/auth_manager.py +0 -0
  15. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/configure/__init__.py +0 -0
  16. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/configure/configure_command.py +0 -0
  17. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/ignore/__init__.py +0 -0
  18. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/ignore/ignore_command.py +0 -0
  19. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/main_cli.py +0 -0
  20. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/report/__init__.py +0 -0
  21. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/report/report_command.py +0 -0
  22. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/report/sbom/__init__.py +0 -0
  23. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/report/sbom/common.py +0 -0
  24. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/report/sbom/path/__init__.py +0 -0
  25. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/report/sbom/path/path_command.py +0 -0
  26. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/report/sbom/repository_url/__init__.py +0 -0
  27. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/report/sbom/repository_url/repository_url_command.py +0 -0
  28. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/report/sbom/sbom_command.py +0 -0
  29. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/report/sbom/sbom_report_file.py +0 -0
  30. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/scan/__init__.py +0 -0
  31. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/scan/commit_history/__init__.py +0 -0
  32. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/scan/commit_history/commit_history_command.py +0 -0
  33. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/scan/path/__init__.py +0 -0
  34. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/scan/path/path_command.py +0 -0
  35. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/scan/pre_commit/__init__.py +0 -0
  36. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/scan/pre_commit/pre_commit_command.py +0 -0
  37. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/scan/pre_receive/__init__.py +0 -0
  38. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/scan/pre_receive/pre_receive_command.py +0 -0
  39. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/scan/repository/__init__.py +0 -0
  40. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/scan/repository/repository_command.py +0 -0
  41. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/scan/scan_ci/__init__.py +0 -0
  42. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/scan/scan_ci/ci_integrations.py +0 -0
  43. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/scan/scan_ci/scan_ci_command.py +0 -0
  44. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/scan/scan_command.py +0 -0
  45. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/version/__init__.py +0 -0
  46. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/commands/version/version_command.py +0 -0
  47. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/config.py +0 -0
  48. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/config.yaml +0 -0
  49. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/exceptions/__init__.py +0 -0
  50. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/exceptions/custom_exceptions.py +0 -0
  51. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/exceptions/handle_report_sbom_errors.py +0 -0
  52. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/exceptions/handle_scan_errors.py +0 -0
  53. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/files_collector/__init__.py +0 -0
  54. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/files_collector/excluder.py +0 -0
  55. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/files_collector/iac/__init__.py +0 -0
  56. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/files_collector/iac/tf_content_generator.py +0 -0
  57. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/files_collector/models/__init__.py +0 -0
  58. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/files_collector/models/in_memory_zip.py +0 -0
  59. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/files_collector/path_documents.py +0 -0
  60. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/files_collector/repository_documents.py +0 -0
  61. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/files_collector/sca/__init__.py +0 -0
  62. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/files_collector/sca/maven/__init__.py +0 -0
  63. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/files_collector/sca/maven/base_restore_maven_dependencies.py +0 -0
  64. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/files_collector/sca/maven/restore_gradle_dependencies.py +0 -0
  65. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/files_collector/sca/maven/restore_maven_dependencies.py +0 -0
  66. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/files_collector/sca/sca_code_scanner.py +0 -0
  67. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/files_collector/zip_documents.py +0 -0
  68. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/main.py +0 -0
  69. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/models.py +0 -0
  70. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/printers/__init__.py +0 -0
  71. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/printers/console_printer.py +0 -0
  72. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/printers/json_printer.py +0 -0
  73. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/printers/printer_base.py +0 -0
  74. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/printers/tables/__init__.py +0 -0
  75. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/printers/tables/sca_table_printer.py +0 -0
  76. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/printers/tables/table.py +0 -0
  77. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/printers/tables/table_models.py +0 -0
  78. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/printers/tables/table_printer.py +0 -0
  79. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/printers/tables/table_printer_base.py +0 -0
  80. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/printers/text_printer.py +0 -0
  81. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/user_settings/__init__.py +0 -0
  82. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/user_settings/base_file_manager.py +0 -0
  83. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/user_settings/config_file_manager.py +0 -0
  84. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/user_settings/configuration_manager.py +0 -0
  85. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/user_settings/credentials_manager.py +0 -0
  86. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/user_settings/jwt_creator.py +0 -0
  87. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/utils/__init__.py +0 -0
  88. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/utils/enum_utils.py +0 -0
  89. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/utils/get_api_client.py +0 -0
  90. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/utils/path_utils.py +0 -0
  91. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/utils/progress_bar.py +0 -0
  92. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/utils/scan_batch.py +0 -0
  93. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/utils/scan_utils.py +0 -0
  94. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/utils/shell_executor.py +0 -0
  95. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/utils/string_utils.py +0 -0
  96. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/utils/task_timer.py +0 -0
  97. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cli/utils/yaml_utils.py +0 -0
  98. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cyclient/__init__.py +0 -0
  99. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cyclient/auth_client.py +0 -0
  100. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cyclient/client_creator.py +0 -0
  101. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cyclient/config.py +0 -0
  102. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cyclient/config.yaml +0 -0
  103. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cyclient/config_dev.py +0 -0
  104. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cyclient/cycode_client.py +0 -0
  105. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cyclient/cycode_client_base.py +0 -0
  106. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cyclient/cycode_dev_based_client.py +0 -0
  107. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cyclient/cycode_token_based_client.py +0 -0
  108. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cyclient/headers.py +0 -0
  109. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cyclient/report_client.py +0 -0
  110. {cycode-1.9.5 → cycode-1.9.5.dev1}/cycode/cyclient/scan_config_base.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cycode
3
- Version: 1.9.5
3
+ Version: 1.9.5.dev1
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
@@ -0,0 +1 @@
1
+ __version__ = '1.9.5.dev1' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
@@ -116,14 +116,19 @@ def _should_use_sync_flow(scan_type: str, sync_option: bool, scan_parameters: Op
116
116
 
117
117
 
118
118
  def _enrich_scan_result_with_data_from_detection_rules(
119
- cycode_client: 'ScanClient', scan_result: ZippedFileScanResult
119
+ cycode_client: 'ScanClient', scan_type: str, scan_result: ZippedFileScanResult
120
120
  ) -> None:
121
+ # TODO(MarshalX): remove scan_type arg after migration to new backend filter
122
+ if scan_type not in {consts.SECRET_SCAN_TYPE, consts.INFRA_CONFIGURATION_SCAN_TYPE}:
123
+ # not yet
124
+ return
125
+
121
126
  detection_rule_ids = set()
122
127
  for detections_per_file in scan_result.detections_per_file:
123
128
  for detection in detections_per_file.detections:
124
129
  detection_rule_ids.add(detection.detection_rule_id)
125
130
 
126
- detection_rules = cycode_client.get_detection_rules(detection_rule_ids)
131
+ detection_rules = cycode_client.get_detection_rules(scan_type, detection_rule_ids)
127
132
  detection_rules_by_id = {detection_rule.detection_rule_id: detection_rule for detection_rule in detection_rules}
128
133
 
129
134
  for detections_per_file in scan_result.detections_per_file:
@@ -133,9 +138,9 @@ def _enrich_scan_result_with_data_from_detection_rules(
133
138
  # we want to make sure that BE returned it. better to not map data instead of failed scan
134
139
  continue
135
140
 
136
- if not detection.severity and detection_rule.classification_data:
141
+ if detection_rule.classification_data:
137
142
  # it's fine to take the first one, because:
138
- # - for "secrets" and "iac" there is only one classification rule per-detection rule
143
+ # - for "secrets" and "iac" there is only one classification rule per detection rule
139
144
  # - for "sca" and "sast" we get severity from detection service
140
145
  detection.severity = detection_rule.classification_data[0].severity
141
146
 
@@ -143,7 +148,6 @@ def _enrich_scan_result_with_data_from_detection_rules(
143
148
  detection.detection_details['custom_remediation_guidelines'] = detection_rule.custom_remediation_guidelines
144
149
  detection.detection_details['remediation_guidelines'] = detection_rule.remediation_guidelines
145
150
  detection.detection_details['description'] = detection_rule.description
146
- detection.detection_details['policy_display_name'] = detection_rule.display_name
147
151
 
148
152
 
149
153
  def _get_scan_documents_thread_func(
@@ -183,7 +187,7 @@ def _get_scan_documents_thread_func(
183
187
  should_use_sync_flow,
184
188
  )
185
189
 
186
- _enrich_scan_result_with_data_from_detection_rules(cycode_client, scan_result)
190
+ _enrich_scan_result_with_data_from_detection_rules(cycode_client, scan_type, scan_result)
187
191
 
188
192
  local_scan_result = create_local_scan_result(
189
193
  scan_result, batch, command_scan_type, scan_type, severity_threshold
@@ -127,8 +127,8 @@ EXCLUSIONS_BY_PATH_SECTION_NAME = 'paths'
127
127
  EXCLUSIONS_BY_RULE_SECTION_NAME = 'rules'
128
128
  EXCLUSIONS_BY_PACKAGE_SECTION_NAME = 'packages'
129
129
 
130
- # 5MB in bytes (in decimal)
131
- FILE_MAX_SIZE_LIMIT_IN_BYTES = 5000000
130
+ # 1MB in bytes (in decimal)
131
+ FILE_MAX_SIZE_LIMIT_IN_BYTES = 1000000
132
132
 
133
133
  # 20MB in bytes (in binary)
134
134
  ZIP_MAX_SIZE_LIMIT_IN_BYTES = 20971520
@@ -38,7 +38,8 @@ class DetectionSchema(Schema):
38
38
 
39
39
  message = fields.String()
40
40
  type = fields.String()
41
- severity = fields.String(missing=None)
41
+ severity = fields.String(missing='High')
42
+ # TODO(MarshalX): Remove "missing" arg when IaC and Secrets scans will have classifications
42
43
  detection_type_id = fields.String()
43
44
  detection_details = fields.Dict()
44
45
  detection_rule_id = fields.String()
@@ -441,8 +442,6 @@ class DetectionRule:
441
442
  custom_remediation_guidelines: Optional[str] = None
442
443
  remediation_guidelines: Optional[str] = None
443
444
  description: Optional[str] = None
444
- policy_name: Optional[str] = None
445
- display_name: Optional[str] = None
446
445
 
447
446
 
448
447
  class DetectionRuleSchema(Schema):
@@ -454,8 +453,6 @@ class DetectionRuleSchema(Schema):
454
453
  custom_remediation_guidelines = fields.String(allow_none=True)
455
454
  remediation_guidelines = fields.String(allow_none=True)
456
455
  description = fields.String(allow_none=True)
457
- policy_name = fields.String(allow_none=True)
458
- display_name = fields.String(allow_none=True)
459
456
 
460
457
  @post_load
461
458
  def build_dto(self, data: Dict[str, Any], **_) -> DetectionRule:
@@ -164,7 +164,7 @@ class ScanClient:
164
164
  return (
165
165
  f'{self.scan_config.get_detections_prefix()}/'
166
166
  f'{self.POLICIES_SERVICE_CONTROLLER_PATH_V3}/'
167
- f'detection_rules/byIds'
167
+ f'detection_rules'
168
168
  )
169
169
 
170
170
  @staticmethod
@@ -181,18 +181,36 @@ class ScanClient:
181
181
 
182
182
  return scan_type_to_policy_type[scan_type]
183
183
 
184
+ @staticmethod
185
+ def _filter_detection_rules_by_ids(
186
+ detection_rules: List[models.DetectionRule], detection_rules_ids: Union[Set[str], List[str]]
187
+ ) -> List[models.DetectionRule]:
188
+ ids = set(detection_rules_ids) # cast to set to perform faster search
189
+ return [rule for rule in detection_rules if rule.detection_rule_id in ids]
190
+
184
191
  @staticmethod
185
192
  def parse_detection_rules_response(response: Response) -> List[models.DetectionRule]:
186
193
  return models.DetectionRuleSchema().load(response.json(), many=True)
187
194
 
188
- def get_detection_rules(self, detection_rules_ids: Union[Set[str], List[str]]) -> List[models.DetectionRule]:
195
+ def get_detection_rules(
196
+ self, scan_type: str, detection_rules_ids: Union[Set[str], List[str]]
197
+ ) -> List[models.DetectionRule]:
198
+ # TODO(MarshalX): use filter by list of IDs instead of policy_type when BE will be ready
199
+ params = {
200
+ 'include_hidden': False,
201
+ 'include_only_enabled_detection_rules': True,
202
+ 'page_number': 0,
203
+ 'page_size': 5000,
204
+ 'policy_types_v2': self._get_policy_type_by_scan_type(scan_type),
205
+ }
189
206
  response = self.scan_cycode_client.get(
190
207
  url_path=self.get_detection_rules_path(),
191
- params={'ids': detection_rules_ids},
208
+ params=params,
192
209
  hide_response_content_log=self._hide_response_log,
193
210
  )
194
211
 
195
- return self.parse_detection_rules_response(response)
212
+ # we are filtering rules by ids in-place for smooth migration when backend will be ready
213
+ return self._filter_detection_rules_by_ids(self.parse_detection_rules_response(response), detection_rules_ids)
196
214
 
197
215
  def get_scan_detections_path(self, scan_type: str) -> str:
198
216
  return f'{self.scan_config.get_detections_prefix()}/{self.get_detections_service_controller_path(scan_type)}'
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "cycode"
3
- version = "1.9.5" # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
3
+ version = "1.9.5.dev1" # 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__ = '1.9.5' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
File without changes
File without changes
File without changes
File without changes