From c1799ebc5145dc6df43900cd723af07016bf95f2 Mon Sep 17 00:00:00 2001 From: Barak Fatal <35402131+bo156@users.noreply.github.com> Date: Tue, 22 Aug 2023 16:37:40 +0300 Subject: [PATCH 1/2] fix(terraform): Replaced / with os.pathsep to support windows better in terraform runner (#5473) * Replaced / with os.pathsep to support windows better in terraform runner * Used os.sep instead of os.pathsep which is the correct one --- checkov/terraform/runner.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/checkov/terraform/runner.py b/checkov/terraform/runner.py index 25d7364cfc7..de17f0f0bea 100644 --- a/checkov/terraform/runner.py +++ b/checkov/terraform/runner.py @@ -226,7 +226,7 @@ def get_connected_node(self, entity: dict[str, Any], root_folder: str) -> Option full_file_path = connected_entity[CustomAttributes.FILE_PATH] connected_node_data = {} connected_node_data['code_block'] = connected_entity_context.get('code_lines') - connected_node_data['file_path'] = f"/{os.path.relpath(full_file_path, root_folder)}" + connected_node_data['file_path'] = f"{os.sep}{os.path.relpath(full_file_path, root_folder)}" connected_node_data['file_line_range'] = [connected_entity_context.get('start_line'), connected_entity_context.get('end_line')] connected_node_data['resource'] = ".".join(connected_entity_context['definition_path']) @@ -276,7 +276,7 @@ def get_graph_checks_report(self, root_folder: str, runner_filter: RunnerFilter, check_name=check.name, check_result=copy_of_check_result, code_block=censored_code_lines, - file_path=f"/{os.path.relpath(full_file_path, root_folder)}", + file_path=f"{os.sep}{os.path.relpath(full_file_path, root_folder)}", file_line_range=[entity_context.get('start_line'), entity_context.get('end_line')], resource=resource, @@ -344,7 +344,7 @@ def check_tf_definition( full_file_path.file_path)}) abs_scanned_file = get_abs_path(full_file_path) abs_referrer = None - scanned_file = f"/{os.path.relpath(abs_scanned_file, root_folder)}" + scanned_file = f"{os.sep}{os.path.relpath(abs_scanned_file, root_folder)}" logging.debug(f"Scanning file: {scanned_file}") self.run_all_blocks(definition, self.context, full_file_path, root_folder, report, scanned_file, runner_filter, abs_referrer) @@ -415,7 +415,7 @@ def run_block( continue caller_file_line_range = [caller_context.get('start_line'), caller_context.get('end_line')] abs_caller_file = get_abs_path(module_full_path) - caller_file_path = f"/{os.path.relpath(abs_caller_file, root_folder)}" + caller_file_path = f"{os.sep}{os.path.relpath(abs_caller_file, root_folder)}" if entity_context_path_header is None: entity_context_path = [block_type] + definition_path From 8639fc62194b57001c76465a79d2d8a39d833e75 Mon Sep 17 00:00:00 2001 From: Barak Fatal <35402131+bo156@users.noreply.github.com> Date: Tue, 22 Aug 2023 16:37:40 +0300 Subject: [PATCH 2/2] fix(terraform): Replaced / with os.pathsep to support windows better in terraform runner (#5473) * Replaced / with os.pathsep to support windows better in terraform runner * Used os.sep instead of os.pathsep which is the correct one --- checkov/version.py | 2 +- kubernetes/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/checkov/version.py b/checkov/version.py index 54d3dae7613..8806e5c276f 100644 --- a/checkov/version.py +++ b/checkov/version.py @@ -1 +1 @@ -version = '2.4.5' +version = '2.4.6' diff --git a/kubernetes/requirements.txt b/kubernetes/requirements.txt index 66883adb128..4042c5bd295 100644 --- a/kubernetes/requirements.txt +++ b/kubernetes/requirements.txt @@ -1 +1 @@ -checkov==2.4.5 +checkov==2.4.6