diff --git a/prowler/lib/check/models.py b/prowler/lib/check/models.py index 0b1a6ba2fd..b7a6ac4e89 100644 --- a/prowler/lib/check/models.py +++ b/prowler/lib/check/models.py @@ -416,12 +416,16 @@ class Check_Report: Args: metadata: The metadata of the check. resource: Basic information about the resource. Defaults to None. - Only accepted BaseModels (dict attribute), custom models (to_dict attribute) or objects with __dict__. + Only accepted dict, list, BaseModels (dict attribute), custom models (with to_dict attribute) or objects with __dict__. """ self.status = "" self.check_metadata = CheckMetadata.parse_raw(metadata) - if hasattr(resource, "dict"): + if isinstance(resource, dict): + self.resource_metadata = resource + elif isinstance(resource, list): + self.resource_metadata = dict(enumerate(resource)) + elif hasattr(resource, "dict"): self.resource_metadata = resource.dict() elif hasattr(resource, "to_dict"): self.resource_metadata = resource.to_dict() diff --git a/prowler/providers/azure/services/appinsights/appinsights_ensure_is_configured/appinsights_ensure_is_configured.py b/prowler/providers/azure/services/appinsights/appinsights_ensure_is_configured/appinsights_ensure_is_configured.py index b14f1726c0..04e72f794f 100644 --- a/prowler/providers/azure/services/appinsights/appinsights_ensure_is_configured/appinsights_ensure_is_configured.py +++ b/prowler/providers/azure/services/appinsights/appinsights_ensure_is_configured/appinsights_ensure_is_configured.py @@ -9,7 +9,7 @@ class appinsights_ensure_is_configured(Check): findings = [] for subscription_name, components in appinsights_client.components.items(): - report = Check_Report_Azure(self.metadata()) + report = Check_Report_Azure(metadata=self.metadata(), resource_metadata={}) report.status = "PASS" report.subscription = subscription_name report.resource_name = "AppInsights"