From 17d57833f031b6d88c48161f8f28eb36a39dbbc4 Mon Sep 17 00:00:00 2001 From: "Jeffrey T. Walraven" Date: Wed, 22 Jun 2022 18:49:35 -0400 Subject: [PATCH] Don't require amazonaws.com in ECR url pattern Some deployments of AWS are served behind a proxy or have an alternative domain name. The current code checks for `amazonaws.com` in the domain name when it gets matches via the regex (see https://github.com/awslabs/amazon-ecr-credential-helper/blob/main/ecr-login/api/client.go#L40). The domain name does not appear to be used in the matches argument and could be removed to enable using this against proxy, alternative, or iso region deployments of AWS. --- ecr-login/api/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ecr-login/api/client.go b/ecr-login/api/client.go index 02ed9762..17c76ad7 100644 --- a/ecr-login/api/client.go +++ b/ecr-login/api/client.go @@ -37,7 +37,7 @@ const ( ecrPublicEndpoint = proxyEndpointScheme + ecrPublicName ) -var ecrPattern = regexp.MustCompile(`(^[a-zA-Z0-9][a-zA-Z0-9-_]*)\.dkr\.ecr(-fips)?\.([a-zA-Z0-9][a-zA-Z0-9-_]*)\.amazonaws\.com(\.cn)?$`) +var ecrPattern = regexp.MustCompile(`(^[a-zA-Z0-9][a-zA-Z0-9-_]*)\.dkr\.ecr(-fips)?\.([a-zA-Z0-9][a-zA-Z0-9-_]*).+$`) type Service string