From a69d0d16c0bfdd9898e3d404fa12ada229da145e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20De=20la=20Torre=20Vico?= Date: Wed, 23 Jul 2025 11:11:04 +0200 Subject: [PATCH] fix(azure/storage): handle when Azure API set values to None (#8325) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Pedro Martín Co-authored-by: Sergio Garcia --- prowler/CHANGELOG.md | 7 +++ .../azure/services/storage/storage_service.py | 43 +++++++++++++++---- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/prowler/CHANGELOG.md b/prowler/CHANGELOG.md index 1883fe67f9..86f91170bb 100644 --- a/prowler/CHANGELOG.md +++ b/prowler/CHANGELOG.md @@ -10,6 +10,13 @@ All notable changes to the **Prowler SDK** are documented in this file. --- +## [v5.9.3] (Prowler UNRELEASED) + +### Fixed +- Add more validations to Azure Storage models when some values are None to avoid serialization issues [(#8325)](https://github.com/prowler-cloud/prowler/pull/8325) + +--- + ## [v5.9.2] (Prowler v5.9.2) ### Fixed diff --git a/prowler/providers/azure/services/storage/storage_service.py b/prowler/providers/azure/services/storage/storage_service.py index 887fb80b7b..e93b920380 100644 --- a/prowler/providers/azure/services/storage/storage_service.py +++ b/prowler/providers/azure/services/storage/storage_service.py @@ -70,17 +70,44 @@ class Storage(AzureService): ], key_expiration_period_in_days=key_expiration_period_in_days, location=storage_account.location, - default_to_entra_authorization=getattr( - storage_account, - "default_to_o_auth_authentication", - False, + default_to_entra_authorization=( + False + if getattr( + storage_account, + "default_to_o_auth_authentication", + False, + ) + is None + else getattr( + storage_account, + "default_to_o_auth_authentication", + False, + ) ), replication_settings=replication_settings, - allow_cross_tenant_replication=getattr( - storage_account, "allow_cross_tenant_replication", True + allow_cross_tenant_replication=( + True + if getattr( + storage_account, + "allow_cross_tenant_replication", + True, + ) + is None + else getattr( + storage_account, + "allow_cross_tenant_replication", + True, + ) ), - allow_shared_key_access=getattr( - storage_account, "allow_shared_key_access", True + allow_shared_key_access=( + True + if getattr( + storage_account, "allow_shared_key_access", True + ) + is None + else getattr( + storage_account, "allow_shared_key_access", True + ) ), ) )