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