cycode 1.10.9__tar.gz → 1.10.10.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.
- {cycode-1.10.9 → cycode-1.10.10.dev1}/PKG-INFO +1 -1
- cycode-1.10.10.dev1/cycode/__init__.py +1 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/scan/code_scanner.py +24 -17
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/scan/repository/repository_command.py +3 -4
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cyclient/cycode_token_based_client.py +8 -1
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cyclient/scan_client.py +22 -5
- {cycode-1.10.9 → cycode-1.10.10.dev1}/pyproject.toml +1 -1
- cycode-1.10.9/cycode/__init__.py +0 -1
- {cycode-1.10.9 → cycode-1.10.10.dev1}/README.md +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/auth/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/auth/auth_command.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/auth/auth_manager.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/configure/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/configure/configure_command.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/ignore/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/ignore/ignore_command.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/main_cli.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/report/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/report/report_command.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/report/sbom/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/report/sbom/common.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/report/sbom/path/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/report/sbom/path/path_command.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/report/sbom/repository_url/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/report/sbom/repository_url/repository_url_command.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/report/sbom/sbom_command.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/report/sbom/sbom_report_file.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/scan/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/scan/commit_history/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/scan/commit_history/commit_history_command.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/scan/path/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/scan/path/path_command.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/scan/pre_commit/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/scan/pre_commit/pre_commit_command.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/scan/pre_receive/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/scan/pre_receive/pre_receive_command.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/scan/repository/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/scan/scan_ci/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/scan/scan_ci/ci_integrations.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/scan/scan_ci/scan_ci_command.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/scan/scan_command.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/version/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/version/version_command.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/config.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/config.yaml +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/consts.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/exceptions/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/exceptions/custom_exceptions.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/exceptions/handle_report_sbom_errors.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/exceptions/handle_scan_errors.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/files_collector/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/files_collector/excluder.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/files_collector/iac/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/files_collector/iac/tf_content_generator.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/files_collector/models/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/files_collector/models/in_memory_zip.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/files_collector/path_documents.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/files_collector/repository_documents.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/files_collector/sca/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/files_collector/sca/maven/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/files_collector/sca/maven/base_restore_maven_dependencies.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/files_collector/sca/maven/restore_gradle_dependencies.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/files_collector/sca/maven/restore_maven_dependencies.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/files_collector/sca/sca_code_scanner.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/files_collector/zip_documents.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/main.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/models.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/printers/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/printers/console_printer.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/printers/json_printer.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/printers/printer_base.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/printers/tables/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/printers/tables/sca_table_printer.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/printers/tables/table.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/printers/tables/table_models.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/printers/tables/table_printer.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/printers/tables/table_printer_base.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/printers/text_printer.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/sentry.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/user_settings/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/user_settings/base_file_manager.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/user_settings/config_file_manager.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/user_settings/configuration_manager.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/user_settings/credentials_manager.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/user_settings/jwt_creator.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/utils/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/utils/enum_utils.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/utils/get_api_client.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/utils/git_proxy.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/utils/jwt_utils.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/utils/path_utils.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/utils/progress_bar.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/utils/scan_batch.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/utils/scan_utils.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/utils/shell_executor.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/utils/string_utils.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/utils/task_timer.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/utils/yaml_utils.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cyclient/__init__.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cyclient/auth_client.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cyclient/client_creator.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cyclient/config.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cyclient/config.yaml +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cyclient/config_dev.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cyclient/cycode_client.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cyclient/cycode_client_base.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cyclient/cycode_dev_based_client.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cyclient/headers.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cyclient/models.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cyclient/report_client.py +0 -0
- {cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cyclient/scan_config_base.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '1.10.10.dev1' # DON'T TOUCH. Placeholder. Will be filled automatically on poetry build from Git Tag
|
|
@@ -100,12 +100,17 @@ def _should_use_scan_service(scan_type: str, scan_parameters: dict) -> bool:
|
|
|
100
100
|
return scan_type == consts.SECRET_SCAN_TYPE and scan_parameters.get('report') is True
|
|
101
101
|
|
|
102
102
|
|
|
103
|
-
def _should_use_sync_flow(
|
|
103
|
+
def _should_use_sync_flow(
|
|
104
|
+
command_scan_type: str, scan_type: str, sync_option: bool, scan_parameters: Optional[dict] = None
|
|
105
|
+
) -> bool:
|
|
104
106
|
if not sync_option:
|
|
105
107
|
return False
|
|
106
108
|
|
|
107
|
-
if
|
|
108
|
-
raise ValueError(f'Sync
|
|
109
|
+
if command_scan_type not in {'path', 'repository'}:
|
|
110
|
+
raise ValueError(f'Sync flow is not available for "{command_scan_type}" command type. Remove --sync option.')
|
|
111
|
+
|
|
112
|
+
if scan_type is consts.SAST_SCAN_TYPE:
|
|
113
|
+
raise ValueError('Sync scan is not available for SAST scan type.')
|
|
109
114
|
|
|
110
115
|
if scan_parameters.get('report') is True:
|
|
111
116
|
raise ValueError('You can not use sync flow with report option. Either remove "report" or "sync" option.')
|
|
@@ -163,7 +168,7 @@ def _get_scan_documents_thread_func(
|
|
|
163
168
|
scan_completed = False
|
|
164
169
|
|
|
165
170
|
should_use_scan_service = _should_use_scan_service(scan_type, scan_parameters)
|
|
166
|
-
should_use_sync_flow = _should_use_sync_flow(scan_type, sync_option, scan_parameters)
|
|
171
|
+
should_use_sync_flow = _should_use_sync_flow(command_scan_type, scan_type, sync_option, scan_parameters)
|
|
167
172
|
|
|
168
173
|
try:
|
|
169
174
|
logger.debug('Preparing local files, %s', {'batch_size': len(batch)})
|
|
@@ -217,7 +222,7 @@ def _get_scan_documents_thread_func(
|
|
|
217
222
|
zip_file_size,
|
|
218
223
|
command_scan_type,
|
|
219
224
|
error_message,
|
|
220
|
-
should_use_scan_service,
|
|
225
|
+
should_use_scan_service or should_use_sync_flow, # sync flow implies scan service
|
|
221
226
|
)
|
|
222
227
|
|
|
223
228
|
return scan_id, error, local_scan_result
|
|
@@ -359,6 +364,8 @@ def scan_commit_range_documents(
|
|
|
359
364
|
scan_parameters: Optional[dict] = None,
|
|
360
365
|
timeout: Optional[int] = None,
|
|
361
366
|
) -> None:
|
|
367
|
+
"""Used by SCA only"""
|
|
368
|
+
|
|
362
369
|
cycode_client = context.obj['client']
|
|
363
370
|
scan_type = context.obj['scan_type']
|
|
364
371
|
severity_threshold = context.obj['severity_threshold']
|
|
@@ -484,7 +491,8 @@ def perform_scan(
|
|
|
484
491
|
should_use_sync_flow: bool = False,
|
|
485
492
|
) -> ZippedFileScanResult:
|
|
486
493
|
if should_use_sync_flow:
|
|
487
|
-
|
|
494
|
+
# it does not support commit range scans; should_use_sync_flow handles it
|
|
495
|
+
return perform_scan_sync(cycode_client, zipped_documents, scan_type, scan_parameters, is_git_diff)
|
|
488
496
|
|
|
489
497
|
if scan_type in (consts.SCA_SCAN_TYPE, consts.SAST_SCAN_TYPE) or should_use_scan_service:
|
|
490
498
|
return perform_scan_async(cycode_client, zipped_documents, scan_type, scan_parameters, is_commit_range)
|
|
@@ -520,12 +528,13 @@ def perform_scan_sync(
|
|
|
520
528
|
zipped_documents: 'InMemoryZip',
|
|
521
529
|
scan_type: str,
|
|
522
530
|
scan_parameters: dict,
|
|
531
|
+
is_git_diff: bool = False,
|
|
523
532
|
) -> ZippedFileScanResult:
|
|
524
|
-
scan_results = cycode_client.zipped_file_scan_sync(zipped_documents, scan_type, scan_parameters)
|
|
533
|
+
scan_results = cycode_client.zipped_file_scan_sync(zipped_documents, scan_type, scan_parameters, is_git_diff)
|
|
525
534
|
logger.debug('Sync scan request has been triggered successfully, %s', {'scan_id': scan_results.id})
|
|
526
535
|
return ZippedFileScanResult(
|
|
527
536
|
did_detect=True,
|
|
528
|
-
detections_per_file=_map_detections_per_file_and_commit_id(scan_results.detection_messages),
|
|
537
|
+
detections_per_file=_map_detections_per_file_and_commit_id(scan_type, scan_results.detection_messages),
|
|
529
538
|
scan_id=scan_results.id,
|
|
530
539
|
)
|
|
531
540
|
|
|
@@ -610,7 +619,7 @@ def get_document_detections(
|
|
|
610
619
|
commit_id = detections_per_file.commit_id
|
|
611
620
|
|
|
612
621
|
logger.debug(
|
|
613
|
-
'Going to find the document of the violated file
|
|
622
|
+
'Going to find the document of the violated file, %s', {'file_name': file_name, 'commit_id': commit_id}
|
|
614
623
|
)
|
|
615
624
|
|
|
616
625
|
document = _get_document_by_file_name(documents_to_scan, file_name, commit_id)
|
|
@@ -874,7 +883,7 @@ def _get_scan_result(
|
|
|
874
883
|
|
|
875
884
|
return ZippedFileScanResult(
|
|
876
885
|
did_detect=True,
|
|
877
|
-
detections_per_file=_map_detections_per_file_and_commit_id(scan_raw_detections),
|
|
886
|
+
detections_per_file=_map_detections_per_file_and_commit_id(scan_type, scan_raw_detections),
|
|
878
887
|
scan_id=scan_id,
|
|
879
888
|
report_url=_try_get_report_url_if_needed(cycode_client, should_get_report, scan_id, scan_type),
|
|
880
889
|
)
|
|
@@ -904,7 +913,7 @@ def _try_get_report_url_if_needed(
|
|
|
904
913
|
logger.debug('Failed to get report URL', exc_info=e)
|
|
905
914
|
|
|
906
915
|
|
|
907
|
-
def _map_detections_per_file_and_commit_id(raw_detections: List[dict]) -> List[DetectionsPerFile]:
|
|
916
|
+
def _map_detections_per_file_and_commit_id(scan_type: str, raw_detections: List[dict]) -> List[DetectionsPerFile]:
|
|
908
917
|
"""Converts list of detections (async flow) to list of DetectionsPerFile objects (sync flow).
|
|
909
918
|
|
|
910
919
|
Args:
|
|
@@ -923,7 +932,7 @@ def _map_detections_per_file_and_commit_id(raw_detections: List[dict]) -> List[D
|
|
|
923
932
|
# FIXME(MarshalX): investigate this field mapping
|
|
924
933
|
raw_detection['message'] = raw_detection['correlation_message']
|
|
925
934
|
|
|
926
|
-
file_name = _get_file_name_from_detection(raw_detection)
|
|
935
|
+
file_name = _get_file_name_from_detection(scan_type, raw_detection)
|
|
927
936
|
detection: Detection = DetectionSchema().load(raw_detection)
|
|
928
937
|
commit_id: Optional[str] = detection.detection_details.get('commit_id') # could be None
|
|
929
938
|
group_by_key = (file_name, commit_id)
|
|
@@ -942,12 +951,10 @@ def _map_detections_per_file_and_commit_id(raw_detections: List[dict]) -> List[D
|
|
|
942
951
|
]
|
|
943
952
|
|
|
944
953
|
|
|
945
|
-
def _get_file_name_from_detection(raw_detection: dict) -> str:
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
if category == 'SAST':
|
|
954
|
+
def _get_file_name_from_detection(scan_type: str, raw_detection: dict) -> str:
|
|
955
|
+
if scan_type == consts.SAST_SCAN_TYPE:
|
|
949
956
|
return raw_detection['detection_details']['file_path']
|
|
950
|
-
if
|
|
957
|
+
if scan_type == consts.SECRET_SCAN_TYPE:
|
|
951
958
|
return _get_secret_file_name_from_detection(raw_detection)
|
|
952
959
|
|
|
953
960
|
return raw_detection['detection_details']['file_name']
|
{cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/scan/repository/repository_command.py
RENAMED
|
@@ -53,11 +53,10 @@ def repository_command(context: click.Context, path: str, branch: str) -> None:
|
|
|
53
53
|
|
|
54
54
|
documents_to_scan = exclude_irrelevant_documents_to_scan(scan_type, documents_to_scan)
|
|
55
55
|
|
|
56
|
-
perform_pre_scan_documents_actions(context, scan_type, documents_to_scan
|
|
56
|
+
perform_pre_scan_documents_actions(context, scan_type, documents_to_scan)
|
|
57
57
|
|
|
58
58
|
logger.debug('Found all relevant files for scanning %s', {'path': path, 'branch': branch})
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
)
|
|
59
|
+
scan_parameters = get_scan_parameters(context, (path,))
|
|
60
|
+
scan_documents(context, documents_to_scan, scan_parameters=scan_parameters)
|
|
62
61
|
except Exception as e:
|
|
63
62
|
handle_scan_exception(context, e)
|
|
@@ -8,6 +8,12 @@ from cycode.cli.user_settings.credentials_manager import CredentialsManager
|
|
|
8
8
|
from cycode.cli.user_settings.jwt_creator import JwtCreator
|
|
9
9
|
from cycode.cyclient.cycode_client import CycodeClient
|
|
10
10
|
|
|
11
|
+
_NGINX_PLAIN_ERRORS = [
|
|
12
|
+
b'Invalid JWT Token',
|
|
13
|
+
b'JWT Token Needed',
|
|
14
|
+
b'JWT Token validation failed',
|
|
15
|
+
]
|
|
16
|
+
|
|
11
17
|
|
|
12
18
|
class CycodeTokenBasedClient(CycodeClient):
|
|
13
19
|
"""Send requests with JWT."""
|
|
@@ -82,7 +88,8 @@ class CycodeTokenBasedClient(CycodeClient):
|
|
|
82
88
|
response = super()._execute(*args, **kwargs)
|
|
83
89
|
|
|
84
90
|
# backend returns 200 and plain text. no way to catch it with .raise_for_status()
|
|
85
|
-
|
|
91
|
+
nginx_error_response = any(response.content.startswith(plain_error) for plain_error in _NGINX_PLAIN_ERRORS)
|
|
92
|
+
if response.status_code == 200 and nginx_error_response:
|
|
86
93
|
# if cached token is invalid, try to refresh it and retry the request
|
|
87
94
|
self.refresh_access_token()
|
|
88
95
|
response = super()._execute(*args, **kwargs)
|
|
@@ -31,7 +31,7 @@ class ScanClient:
|
|
|
31
31
|
self._hide_response_log = hide_response_log
|
|
32
32
|
|
|
33
33
|
def get_scan_controller_path(self, scan_type: str, should_use_scan_service: bool = False) -> str:
|
|
34
|
-
if scan_type == consts.INFRA_CONFIGURATION_SCAN_TYPE:
|
|
34
|
+
if not should_use_scan_service and scan_type == consts.INFRA_CONFIGURATION_SCAN_TYPE:
|
|
35
35
|
# we don't use async flow for IaC scan yet
|
|
36
36
|
return self._SCAN_SERVICE_CONTROLLER_PATH
|
|
37
37
|
if not should_use_scan_service and scan_type == consts.SECRET_SCAN_TYPE:
|
|
@@ -106,14 +106,31 @@ class ScanClient:
|
|
|
106
106
|
)
|
|
107
107
|
return f'{scan_service_url_path}/{async_scan_type}/{async_entity_type}'
|
|
108
108
|
|
|
109
|
+
def get_zipped_file_scan_sync_url_path(self, scan_type: str) -> str:
|
|
110
|
+
server_scan_type = self.scan_config.get_async_scan_type(scan_type)
|
|
111
|
+
scan_service_url_path = self.get_scan_service_url_path(
|
|
112
|
+
scan_type, should_use_scan_service=True, should_use_sync_flow=True
|
|
113
|
+
)
|
|
114
|
+
return f'{scan_service_url_path}/{server_scan_type}/repository'
|
|
115
|
+
|
|
109
116
|
def zipped_file_scan_sync(
|
|
110
|
-
self,
|
|
117
|
+
self,
|
|
118
|
+
zip_file: InMemoryZip,
|
|
119
|
+
scan_type: str,
|
|
120
|
+
scan_parameters: dict,
|
|
121
|
+
is_git_diff: bool = False,
|
|
111
122
|
) -> models.ScanResultsSyncFlow:
|
|
112
123
|
files = {'file': ('multiple_files_scan.zip', zip_file.read())}
|
|
113
|
-
|
|
124
|
+
|
|
125
|
+
if 'report' in scan_parameters:
|
|
126
|
+
del scan_parameters['report'] # BE raises validation error instead of ignoring it
|
|
127
|
+
|
|
114
128
|
response = self.scan_cycode_client.post(
|
|
115
|
-
url_path=self.
|
|
116
|
-
data={
|
|
129
|
+
url_path=self.get_zipped_file_scan_sync_url_path(scan_type),
|
|
130
|
+
data={
|
|
131
|
+
'is_git_diff': is_git_diff,
|
|
132
|
+
'scan_parameters': json.dumps(scan_parameters),
|
|
133
|
+
},
|
|
117
134
|
files=files,
|
|
118
135
|
hide_response_content_log=self._hide_response_log,
|
|
119
136
|
timeout=60,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "cycode"
|
|
3
|
-
version = "1.10.
|
|
3
|
+
version = "1.10.10.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>"]
|
cycode-1.10.9/cycode/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '1.10.9' # 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
|
|
File without changes
|
{cycode-1.10.9 → cycode-1.10.10.dev1}/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.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/scan/pre_commit/pre_commit_command.py
RENAMED
|
File without changes
|
|
File without changes
|
{cycode-1.10.9 → cycode-1.10.10.dev1}/cycode/cli/commands/scan/pre_receive/pre_receive_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
|
|
File without changes
|
{cycode-1.10.9 → cycode-1.10.10.dev1}/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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|