Skip to content

Commit

Permalink
fix(aws): solve invalid ECR Registry ARN (#5622)
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCloudSec authored Nov 4, 2024
1 parent 5fbf8dd commit 84d4e4a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion prowler/providers/aws/services/ecr/ecr_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def _describe_registries_and_repositories(self, regional_client):
# The default ECR registry is assumed
self.registries[regional_client.region] = Registry(
id=self.registry_id,
arn=f"arn:{self.audited_partition}:ecr:{regional_client.region}:registry/{self.registry_id}",
arn=f"arn:{self.audited_partition}:ecr:{regional_client.region}:{self.audited_account}:registry/{self.registry_id}",
region=regional_client.region,
repositories=regional_registry_repositories,
)
Expand Down
4 changes: 4 additions & 0 deletions tests/providers/aws/services/ecr/ecr_service_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ def test_describe_registries_and_repositories(self):

assert len(ecr.registries) == 1
assert ecr.registries[AWS_REGION_EU_WEST_1].id == AWS_ACCOUNT_NUMBER
assert (
ecr.registries[AWS_REGION_EU_WEST_1].arn
== f"arn:aws:ecr:{AWS_REGION_EU_WEST_1}:{AWS_ACCOUNT_NUMBER}:registry/{AWS_ACCOUNT_NUMBER}"
)
assert ecr.registries[AWS_REGION_EU_WEST_1].region == AWS_REGION_EU_WEST_1
assert len(ecr.registries[AWS_REGION_EU_WEST_1].repositories) == 1

Expand Down

0 comments on commit 84d4e4a

Please sign in to comment.