mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-24 21:11:53 +00:00
fix(azure): remove duplicated findings in entra_user_with_vm_access_has_mfa (#9916)
Co-authored-by: Hugo Pereira Brito <101209179+HugoPBrito@users.noreply.github.com>
This commit is contained in:
+6
@@ -15,6 +15,7 @@ from prowler.providers.azure.services.iam.iam_client import iam_client
|
||||
class entra_user_with_vm_access_has_mfa(Check):
|
||||
def execute(self) -> Check_Report_Azure:
|
||||
findings = []
|
||||
already_reported = set()
|
||||
|
||||
for users in entra_client.users.values():
|
||||
for user in users.values():
|
||||
@@ -22,6 +23,9 @@ class entra_user_with_vm_access_has_mfa(Check):
|
||||
subscription_name,
|
||||
role_assigns,
|
||||
) in iam_client.role_assignments.items():
|
||||
if (user.id, subscription_name) in already_reported:
|
||||
continue
|
||||
|
||||
for assignment in role_assigns.values():
|
||||
if (
|
||||
assignment.agent_type == "User"
|
||||
@@ -48,5 +52,7 @@ class entra_user_with_vm_access_has_mfa(Check):
|
||||
report.status_extended = f"User {user.name} can access VMs in subscription {subscription_name} but it has MFA."
|
||||
|
||||
findings.append(report)
|
||||
already_reported.add((user.id, subscription_name))
|
||||
break
|
||||
|
||||
return findings
|
||||
|
||||
Reference in New Issue
Block a user