cycode 1.7.1.dev3__tar.gz → 1.7.1.dev5__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.
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/PKG-INFO +1 -1
- cycode-1.7.1.dev5/cycode/__init__.py +1 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/scan/code_scanner.py +15 -10
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cyclient/scan_client.py +43 -26
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cyclient/scan_config_base.py +0 -10
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/pyproject.toml +1 -1
- cycode-1.7.1.dev3/cycode/__init__.py +0 -1
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/README.md +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/auth/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/auth/auth_command.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/auth/auth_manager.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/configure/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/configure/configure_command.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/ignore/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/ignore/ignore_command.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/main_cli.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/report/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/report/report_command.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/report/sbom/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/report/sbom/common.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/report/sbom/path/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/report/sbom/path/path_command.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/report/sbom/repository_url/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/report/sbom/repository_url/repository_url_command.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/report/sbom/sbom_command.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/report/sbom/sbom_report_file.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/scan/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/scan/commit_history/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/scan/commit_history/commit_history_command.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/scan/path/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/scan/path/path_command.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/scan/pre_commit/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/scan/pre_commit/pre_commit_command.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/scan/pre_receive/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/scan/pre_receive/pre_receive_command.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/scan/repository/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/scan/repository/repository_command.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/scan/scan_ci/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/scan/scan_ci/ci_integrations.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/scan/scan_ci/scan_ci_command.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/scan/scan_command.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/version/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/version/version_command.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/config.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/config.yaml +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/consts.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/exceptions/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/exceptions/custom_exceptions.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/exceptions/handle_report_sbom_errors.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/exceptions/handle_scan_errors.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/files_collector/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/files_collector/excluder.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/files_collector/iac/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/files_collector/iac/tf_content_generator.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/files_collector/models/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/files_collector/models/in_memory_zip.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/files_collector/path_documents.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/files_collector/repository_documents.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/files_collector/sca/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/files_collector/sca/maven/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/files_collector/sca/maven/base_restore_maven_dependencies.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/files_collector/sca/maven/restore_gradle_dependencies.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/files_collector/sca/maven/restore_maven_dependencies.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/files_collector/sca/sca_code_scanner.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/files_collector/zip_documents.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/main.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/models.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/printers/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/printers/console_printer.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/printers/json_printer.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/printers/printer_base.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/printers/tables/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/printers/tables/sca_table_printer.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/printers/tables/table.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/printers/tables/table_models.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/printers/tables/table_printer.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/printers/tables/table_printer_base.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/printers/text_printer.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/user_settings/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/user_settings/base_file_manager.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/user_settings/config_file_manager.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/user_settings/configuration_manager.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/user_settings/credentials_manager.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/utils/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/utils/enum_utils.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/utils/get_api_client.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/utils/path_utils.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/utils/progress_bar.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/utils/scan_batch.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/utils/scan_utils.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/utils/shell_executor.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/utils/string_utils.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/utils/task_timer.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/utils/yaml_utils.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cyclient/__init__.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cyclient/auth_client.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cyclient/client_creator.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cyclient/config.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cyclient/config.yaml +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cyclient/config_dev.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cyclient/cycode_client.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cyclient/cycode_client_base.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cyclient/cycode_dev_based_client.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cyclient/cycode_token_based_client.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cyclient/models.py +0 -0
- {cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cyclient/report_client.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '1.7.1.dev5' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
|
|
@@ -439,7 +439,7 @@ def perform_scan_async(
|
|
|
439
439
|
scan_async_result = cycode_client.zipped_file_scan_async(zipped_documents, scan_type, scan_parameters)
|
|
440
440
|
logger.debug('scan request has been triggered successfully, scan id: %s', scan_async_result.scan_id)
|
|
441
441
|
|
|
442
|
-
return poll_scan_results(cycode_client, scan_async_result.scan_id)
|
|
442
|
+
return poll_scan_results(cycode_client, scan_async_result.scan_id, scan_type)
|
|
443
443
|
|
|
444
444
|
|
|
445
445
|
def perform_commit_range_scan_async(
|
|
@@ -455,11 +455,14 @@ def perform_commit_range_scan_async(
|
|
|
455
455
|
)
|
|
456
456
|
|
|
457
457
|
logger.debug('scan request has been triggered successfully, scan id: %s', scan_async_result.scan_id)
|
|
458
|
-
return poll_scan_results(cycode_client, scan_async_result.scan_id, timeout)
|
|
458
|
+
return poll_scan_results(cycode_client, scan_async_result.scan_id, scan_type, timeout)
|
|
459
459
|
|
|
460
460
|
|
|
461
461
|
def poll_scan_results(
|
|
462
|
-
cycode_client: 'ScanClient',
|
|
462
|
+
cycode_client: 'ScanClient',
|
|
463
|
+
scan_id: str,
|
|
464
|
+
scan_type: str,
|
|
465
|
+
polling_timeout: Optional[int] = None,
|
|
463
466
|
) -> ZippedFileScanResult:
|
|
464
467
|
if polling_timeout is None:
|
|
465
468
|
polling_timeout = configuration_manager.get_scan_polling_timeout_in_seconds()
|
|
@@ -468,14 +471,14 @@ def poll_scan_results(
|
|
|
468
471
|
end_polling_time = time.time() + polling_timeout
|
|
469
472
|
|
|
470
473
|
while time.time() < end_polling_time:
|
|
471
|
-
scan_details = cycode_client.get_scan_details(scan_id)
|
|
474
|
+
scan_details = cycode_client.get_scan_details(scan_type, scan_id)
|
|
472
475
|
|
|
473
476
|
if scan_details.scan_update_at is not None and scan_details.scan_update_at != last_scan_update_at:
|
|
474
477
|
last_scan_update_at = scan_details.scan_update_at
|
|
475
478
|
print_debug_scan_details(scan_details)
|
|
476
479
|
|
|
477
480
|
if scan_details.scan_status == consts.SCAN_STATUS_COMPLETED:
|
|
478
|
-
return _get_scan_result(cycode_client, scan_id, scan_details)
|
|
481
|
+
return _get_scan_result(cycode_client, scan_type, scan_id, scan_details)
|
|
479
482
|
|
|
480
483
|
if scan_details.scan_status == consts.SCAN_STATUS_ERROR:
|
|
481
484
|
raise custom_exceptions.ScanAsyncError(
|
|
@@ -759,14 +762,14 @@ def _does_severity_match_severity_threshold(severity: str, severity_threshold: s
|
|
|
759
762
|
|
|
760
763
|
|
|
761
764
|
def _get_scan_result(
|
|
762
|
-
cycode_client: 'ScanClient', scan_id: str, scan_details: 'ScanDetailsResponse'
|
|
765
|
+
cycode_client: 'ScanClient', scan_type: str, scan_id: str, scan_details: 'ScanDetailsResponse'
|
|
763
766
|
) -> ZippedFileScanResult:
|
|
764
767
|
if not scan_details.detections_count:
|
|
765
768
|
return init_default_scan_result(scan_id, scan_details.metadata)
|
|
766
769
|
|
|
767
|
-
wait_for_detections_creation(cycode_client, scan_id, scan_details.detections_count)
|
|
770
|
+
wait_for_detections_creation(cycode_client, scan_type, scan_id, scan_details.detections_count)
|
|
768
771
|
|
|
769
|
-
scan_detections = cycode_client.get_scan_detections(scan_id)
|
|
772
|
+
scan_detections = cycode_client.get_scan_detections(scan_type, scan_id)
|
|
770
773
|
return ZippedFileScanResult(
|
|
771
774
|
did_detect=True,
|
|
772
775
|
detections_per_file=_map_detections_per_file(scan_detections),
|
|
@@ -792,7 +795,9 @@ def _try_get_report_url(metadata_json: Optional[str]) -> Optional[str]:
|
|
|
792
795
|
return None
|
|
793
796
|
|
|
794
797
|
|
|
795
|
-
def wait_for_detections_creation(
|
|
798
|
+
def wait_for_detections_creation(
|
|
799
|
+
cycode_client: 'ScanClient', scan_type: str, scan_id: str, expected_detections_count: int
|
|
800
|
+
) -> None:
|
|
796
801
|
logger.debug('Waiting for detections to be created')
|
|
797
802
|
|
|
798
803
|
scan_persisted_detections_count = 0
|
|
@@ -800,7 +805,7 @@ def wait_for_detections_creation(cycode_client: 'ScanClient', scan_id: str, expe
|
|
|
800
805
|
end_polling_time = time.time() + polling_timeout
|
|
801
806
|
|
|
802
807
|
while time.time() < end_polling_time:
|
|
803
|
-
scan_persisted_detections_count = cycode_client.get_scan_detections_count(scan_id)
|
|
808
|
+
scan_persisted_detections_count = cycode_client.get_scan_detections_count(scan_type, scan_id)
|
|
804
809
|
logger.debug(
|
|
805
810
|
f'Excepted {expected_detections_count} detections, got {scan_persisted_detections_count} detections '
|
|
806
811
|
f'({expected_detections_count - scan_persisted_detections_count} more; '
|
|
@@ -20,14 +20,35 @@ class ScanClient:
|
|
|
20
20
|
self.scan_cycode_client = scan_cycode_client
|
|
21
21
|
self.scan_config = scan_config
|
|
22
22
|
|
|
23
|
-
self.
|
|
24
|
-
self.
|
|
23
|
+
self._SCAN_CONTROLLER_PATH = 'api/v1/scan'
|
|
24
|
+
self._SCAN_CONTROLLER_PATH_SCA = 'api/v1/cli-scan'
|
|
25
|
+
|
|
26
|
+
self._DETECTIONS_SERVICE_CONTROLLER_PATH = 'api/v1/detections'
|
|
27
|
+
self._DETECTIONS_SERVICE_CONTROLLER_PATH_SCA = 'api/v1/detections/cli'
|
|
28
|
+
|
|
25
29
|
self.POLICIES_SERVICE_CONTROLLER_PATH_V3 = 'api/v3/policies'
|
|
26
30
|
|
|
27
31
|
self._hide_response_log = hide_response_log
|
|
28
32
|
|
|
33
|
+
def get_scan_controller_path(self, scan_type: str) -> str:
|
|
34
|
+
if scan_type == consts.SCA_SCAN_TYPE:
|
|
35
|
+
return self._SCAN_CONTROLLER_PATH_SCA
|
|
36
|
+
|
|
37
|
+
return self._SCAN_CONTROLLER_PATH
|
|
38
|
+
|
|
39
|
+
def get_detections_service_controller_path(self, scan_type: str) -> str:
|
|
40
|
+
if scan_type == consts.SCA_SCAN_TYPE:
|
|
41
|
+
return self._DETECTIONS_SERVICE_CONTROLLER_PATH_SCA
|
|
42
|
+
|
|
43
|
+
return self._DETECTIONS_SERVICE_CONTROLLER_PATH
|
|
44
|
+
|
|
45
|
+
def get_scan_service_url_path(self, scan_type: str) -> str:
|
|
46
|
+
service_path = self.scan_config.get_service_name(scan_type)
|
|
47
|
+
controller_path = self.get_scan_controller_path(scan_type)
|
|
48
|
+
return f'{service_path}/{controller_path}'
|
|
49
|
+
|
|
29
50
|
def content_scan(self, scan_type: str, file_name: str, content: str, is_git_diff: bool = True) -> models.ScanResult:
|
|
30
|
-
path = f'{self.
|
|
51
|
+
path = f'{self.get_scan_service_url_path(scan_type)}/content'
|
|
31
52
|
body = {'name': file_name, 'content': content, 'is_git_diff': is_git_diff}
|
|
32
53
|
response = self.scan_cycode_client.post(
|
|
33
54
|
url_path=path, body=body, hide_response_content_log=self._hide_response_log
|
|
@@ -35,7 +56,7 @@ class ScanClient:
|
|
|
35
56
|
return self.parse_scan_response(response)
|
|
36
57
|
|
|
37
58
|
def get_zipped_file_scan_url_path(self, scan_type: str) -> str:
|
|
38
|
-
return f'{self.
|
|
59
|
+
return f'{self.get_scan_service_url_path(scan_type)}/zipped-file'
|
|
39
60
|
|
|
40
61
|
def zipped_file_scan(
|
|
41
62
|
self, scan_type: str, zip_file: InMemoryZip, scan_id: str, scan_parameters: dict, is_git_diff: bool = False
|
|
@@ -54,9 +75,7 @@ class ScanClient:
|
|
|
54
75
|
def get_zipped_file_scan_async_url_path(self, scan_type: str) -> str:
|
|
55
76
|
async_scan_type = self.scan_config.get_async_scan_type(scan_type)
|
|
56
77
|
async_entity_type = self.scan_config.get_async_entity_type(scan_type)
|
|
57
|
-
|
|
58
|
-
url_prefix = self.scan_config.get_scans_prefix()
|
|
59
|
-
return f'{url_prefix}/{self.SCAN_CONTROLLER_PATH}/{async_scan_type}/{async_entity_type}'
|
|
78
|
+
return f'{self.get_scan_service_url_path(scan_type)}/{async_scan_type}/{async_entity_type}'
|
|
60
79
|
|
|
61
80
|
def zipped_file_scan_async(
|
|
62
81
|
self, zip_file: InMemoryZip, scan_type: str, scan_parameters: dict, is_git_diff: bool = False
|
|
@@ -77,9 +96,7 @@ class ScanClient:
|
|
|
77
96
|
scan_parameters: dict,
|
|
78
97
|
is_git_diff: bool = False,
|
|
79
98
|
) -> models.ScanInitializationResponse:
|
|
80
|
-
url_path = (
|
|
81
|
-
f'{self.scan_config.get_scans_prefix()}/{self.SCAN_CONTROLLER_PATH}/{scan_type}/repository/commit-range'
|
|
82
|
-
)
|
|
99
|
+
url_path = f'{self.get_scan_service_url_path(scan_type)}/{scan_type}/repository/commit-range'
|
|
83
100
|
files = {
|
|
84
101
|
'file_from_commit': ('multiple_files_scan.zip', from_commit_zip_file.read()),
|
|
85
102
|
'file_to_commit': ('multiple_files_scan.zip', to_commit_zip_file.read()),
|
|
@@ -91,11 +108,12 @@ class ScanClient:
|
|
|
91
108
|
)
|
|
92
109
|
return models.ScanInitializationResponseSchema().load(response.json())
|
|
93
110
|
|
|
94
|
-
def get_scan_details_path(self, scan_id: str) -> str:
|
|
95
|
-
return f'{self.
|
|
111
|
+
def get_scan_details_path(self, scan_type: str, scan_id: str) -> str:
|
|
112
|
+
return f'{self.get_scan_service_url_path(scan_type)}/{scan_id}'
|
|
96
113
|
|
|
97
|
-
def get_scan_details(self, scan_id: str) -> models.ScanDetailsResponse:
|
|
98
|
-
|
|
114
|
+
def get_scan_details(self, scan_type: str, scan_id: str) -> models.ScanDetailsResponse:
|
|
115
|
+
path = self.get_scan_details_path(scan_type, scan_id)
|
|
116
|
+
response = self.scan_cycode_client.get(url_path=path)
|
|
99
117
|
return models.ScanDetailsResponseSchema().load(response.json())
|
|
100
118
|
|
|
101
119
|
def get_detection_rules_path(self) -> str:
|
|
@@ -150,10 +168,10 @@ class ScanClient:
|
|
|
150
168
|
# we are filtering rules by ids in-place for smooth migration when backend will be ready
|
|
151
169
|
return self._filter_detection_rules_by_ids(self.parse_detection_rules_response(response), detection_rules_ids)
|
|
152
170
|
|
|
153
|
-
def get_scan_detections_path(self) -> str:
|
|
154
|
-
return f'{self.scan_config.get_detections_prefix()}/{self.
|
|
171
|
+
def get_scan_detections_path(self, scan_type: str) -> str:
|
|
172
|
+
return f'{self.scan_config.get_detections_prefix()}/{self.get_detections_service_controller_path(scan_type)}'
|
|
155
173
|
|
|
156
|
-
def get_scan_detections(self, scan_id: str) -> List[dict]:
|
|
174
|
+
def get_scan_detections(self, scan_type: str, scan_id: str) -> List[dict]:
|
|
157
175
|
params = {'scan_id': scan_id}
|
|
158
176
|
|
|
159
177
|
page_size = 200
|
|
@@ -166,8 +184,9 @@ class ScanClient:
|
|
|
166
184
|
params['page_size'] = page_size
|
|
167
185
|
params['page_number'] = page_number
|
|
168
186
|
|
|
187
|
+
path = f'{self.get_scan_detections_path(scan_type)}/detections'
|
|
169
188
|
response = self.scan_cycode_client.get(
|
|
170
|
-
url_path=
|
|
189
|
+
url_path=path,
|
|
171
190
|
params=params,
|
|
172
191
|
hide_response_content_log=self._hide_response_log,
|
|
173
192
|
).json()
|
|
@@ -178,21 +197,19 @@ class ScanClient:
|
|
|
178
197
|
|
|
179
198
|
return detections
|
|
180
199
|
|
|
181
|
-
def get_get_scan_detections_count_path(self) -> str:
|
|
182
|
-
return f'{self.
|
|
200
|
+
def get_get_scan_detections_count_path(self, scan_type: str) -> str:
|
|
201
|
+
return f'{self.get_scan_detections_path(scan_type)}/count'
|
|
183
202
|
|
|
184
|
-
def get_scan_detections_count(self, scan_id: str) -> int:
|
|
203
|
+
def get_scan_detections_count(self, scan_type: str, scan_id: str) -> int:
|
|
185
204
|
response = self.scan_cycode_client.get(
|
|
186
|
-
url_path=self.get_get_scan_detections_count_path(), params={'scan_id': scan_id}
|
|
205
|
+
url_path=self.get_get_scan_detections_count_path(scan_type), params={'scan_id': scan_id}
|
|
187
206
|
)
|
|
188
207
|
return response.json().get('count', 0)
|
|
189
208
|
|
|
190
209
|
def commit_range_zipped_file_scan(
|
|
191
210
|
self, scan_type: str, zip_file: InMemoryZip, scan_id: str
|
|
192
211
|
) -> models.ZippedFileScanResult:
|
|
193
|
-
url_path = (
|
|
194
|
-
f'{self.scan_config.get_service_name(scan_type)}/{self.SCAN_CONTROLLER_PATH}/commit-range-zipped-file'
|
|
195
|
-
)
|
|
212
|
+
url_path = f'{self.get_scan_service_url_path(scan_type)}/commit-range-zipped-file'
|
|
196
213
|
files = {'file': ('multiple_files_scan.zip', zip_file.read())}
|
|
197
214
|
response = self.scan_cycode_client.post(
|
|
198
215
|
url_path=url_path, data={'scan_id': scan_id}, files=files, hide_response_content_log=self._hide_response_log
|
|
@@ -200,7 +217,7 @@ class ScanClient:
|
|
|
200
217
|
return self.parse_zipped_file_scan_response(response)
|
|
201
218
|
|
|
202
219
|
def get_report_scan_status_path(self, scan_type: str, scan_id: str) -> str:
|
|
203
|
-
return f'{self.
|
|
220
|
+
return f'{self.get_scan_service_url_path(scan_type)}/{scan_id}/status'
|
|
204
221
|
|
|
205
222
|
def report_scan_status(self, scan_type: str, scan_id: str, scan_status: dict) -> None:
|
|
206
223
|
self.scan_cycode_client.post(url_path=self.get_report_scan_status_path(scan_type, scan_id), body=scan_status)
|
|
@@ -20,10 +20,6 @@ class ScanConfigBase(ABC):
|
|
|
20
20
|
# we are migrating to "zippedfile" entity type. will be used later
|
|
21
21
|
return 'repository'
|
|
22
22
|
|
|
23
|
-
@abstractmethod
|
|
24
|
-
def get_scans_prefix(self) -> str:
|
|
25
|
-
...
|
|
26
|
-
|
|
27
23
|
@abstractmethod
|
|
28
24
|
def get_detections_prefix(self) -> str:
|
|
29
25
|
...
|
|
@@ -39,9 +35,6 @@ class DevScanConfig(ScanConfigBase):
|
|
|
39
35
|
# sca and sast
|
|
40
36
|
return '5004'
|
|
41
37
|
|
|
42
|
-
def get_scans_prefix(self) -> str:
|
|
43
|
-
return '5004'
|
|
44
|
-
|
|
45
38
|
def get_detections_prefix(self) -> str:
|
|
46
39
|
return '5016'
|
|
47
40
|
|
|
@@ -56,8 +49,5 @@ class DefaultScanConfig(ScanConfigBase):
|
|
|
56
49
|
# sca and sast
|
|
57
50
|
return 'scans'
|
|
58
51
|
|
|
59
|
-
def get_scans_prefix(self) -> str:
|
|
60
|
-
return 'scans'
|
|
61
|
-
|
|
62
52
|
def get_detections_prefix(self) -> str:
|
|
63
53
|
return 'detections'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "cycode"
|
|
3
|
-
version = "1.7.1.
|
|
3
|
+
version = "1.7.1.dev5" # 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.7.1.dev3' # 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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/report/sbom/path/path_command.py
RENAMED
|
File without changes
|
{cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/report/sbom/repository_url/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/scan/pre_commit/pre_commit_command.py
RENAMED
|
File without changes
|
|
File without changes
|
{cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/scan/pre_receive/pre_receive_command.py
RENAMED
|
File without changes
|
|
File without changes
|
{cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/commands/scan/repository/repository_command.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cycode-1.7.1.dev3 → cycode-1.7.1.dev5}/cycode/cli/files_collector/iac/tf_content_generator.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|