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