Skip to content

Commit ea4bf5b

Browse files
fix: handle empty input regions (#4842)
Co-authored-by: Sergio Garcia <[email protected]>
1 parent 6c56ce6 commit ea4bf5b

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

prowler/providers/aws/aws_provider.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def __init__(self, arguments: Namespace):
7878
# MFA Configuration (false by default)
7979
input_mfa = getattr(arguments, "mfa", None)
8080
input_profile = getattr(arguments, "profile", None)
81-
input_regions = set(getattr(arguments, "region", set()))
81+
input_regions = set(getattr(arguments, "region", []) or [])
8282
organizations_role_arn = getattr(arguments, "organizations_role", None)
8383

8484
# Set if unused services must be scanned

tests/providers/aws/aws_provider_test.py

+8
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,14 @@ def test_aws_provider_mutelist_dynamodb(self):
755755
assert aws_provider.mutelist.mutelist == mutelist["Mutelist"]
756756
assert aws_provider.mutelist.mutelist_file_path == dynamodb_mutelist_path
757757

758+
@mock_aws
759+
def test_empty_input_regions_in_arguments(self):
760+
arguments = Namespace()
761+
arguments.region = None
762+
aws_provider = AwsProvider(arguments)
763+
764+
assert isinstance(aws_provider, AwsProvider)
765+
758766
@mock_aws
759767
def test_generate_regional_clients_all_enabled_regions(self):
760768
arguments = Namespace()

0 commit comments

Comments
 (0)