Skip to content

Commit

Permalink
fix: handle empty input regions (#4842)
Browse files Browse the repository at this point in the history
Co-authored-by: Sergio Garcia <[email protected]>
  • Loading branch information
github-actions[bot] and sergargar authored Aug 22, 2024
1 parent 6c56ce6 commit ea4bf5b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion prowler/providers/aws/aws_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(self, arguments: Namespace):
# MFA Configuration (false by default)
input_mfa = getattr(arguments, "mfa", None)
input_profile = getattr(arguments, "profile", None)
input_regions = set(getattr(arguments, "region", set()))
input_regions = set(getattr(arguments, "region", []) or [])
organizations_role_arn = getattr(arguments, "organizations_role", None)

# Set if unused services must be scanned
Expand Down
8 changes: 8 additions & 0 deletions tests/providers/aws/aws_provider_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,14 @@ def test_aws_provider_mutelist_dynamodb(self):
assert aws_provider.mutelist.mutelist == mutelist["Mutelist"]
assert aws_provider.mutelist.mutelist_file_path == dynamodb_mutelist_path

@mock_aws
def test_empty_input_regions_in_arguments(self):
arguments = Namespace()
arguments.region = None
aws_provider = AwsProvider(arguments)

assert isinstance(aws_provider, AwsProvider)

@mock_aws
def test_generate_regional_clients_all_enabled_regions(self):
arguments = Namespace()
Expand Down

0 comments on commit ea4bf5b

Please sign in to comment.