From d6ebdbe108fdb4d4660c0e28bbc27a82a0f37c13 Mon Sep 17 00:00:00 2001 From: omriyoffe-panw Date: Mon, 2 Dec 2024 16:41:49 +0200 Subject: [PATCH] fix(arm): Fix resource ID generation to use variables (#6884) * change resource ID generation --- checkov/arm/runner.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/checkov/arm/runner.py b/checkov/arm/runner.py index bd5648108fa..6404bc0c5cd 100644 --- a/checkov/arm/runner.py +++ b/checkov/arm/runner.py @@ -265,6 +265,10 @@ def add_graph_check_results(self, report: Report, runner_filter: RunnerFilter) - start_line = entity[START_LINE] - 1 end_line = entity[END_LINE] - 1 + if CustomAttributes.RESOURCE_TYPE not in entity or CustomAttributes.BLOCK_NAME not in entity: + logging.debug(f"Could not determine 'resource_id' of Entity {entity_file_path}") + continue + self.build_record( report=report, check=check, @@ -273,7 +277,7 @@ def add_graph_check_results(self, report: Report, runner_filter: RunnerFilter) - file_path=self.extract_file_path_from_abs_path(clean_file_path(Path(entity_file_path))), file_abs_path=str(file_abs_path), file_line_range=[start_line - 1, end_line - 1], - resource_id=entity[CustomAttributes.ID], + resource_id=f'{entity[CustomAttributes.RESOURCE_TYPE]}.{entity[CustomAttributes.BLOCK_NAME]}', ) def build_record(