From 4b1b0a2fa515bcfaaa6784ffa53a5918245cbd72 Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 31 Oct 2023 10:59:05 -0400 Subject: [PATCH] fix: ecr credential helper hash check (#668) Issue #, if available: #663 *Description of changes:* *Testing done:* - [x] I've reviewed the guidance in CONTRIBUTING.md #### License Acceptance By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. Signed-off-by: Justin Alvarez --- pkg/dependency/credhelper/cred_helper.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pkg/dependency/credhelper/cred_helper.go b/pkg/dependency/credhelper/cred_helper.go index 7a20a909d..a5fc1fab0 100644 --- a/pkg/dependency/credhelper/cred_helper.go +++ b/pkg/dependency/credhelper/cred_helper.go @@ -67,15 +67,24 @@ func newDeps( finchPath := fmt.Sprintf("/Users/%s/.finch/", user) const versionEcr = "0.7.0" - const hashEcr = "sha256:ff14a4da40d28a2d2d81a12a7c9c36294ddf8e6439780c4ccbc96622991f3714" + const hashARM64 = "sha256:ff14a4da40d28a2d2d81a12a7c9c36294ddf8e6439780c4ccbc96622991f3714" + const hashAMD64 = "sha256:c978912da7f54eb3bccf4a3f990c91cc758e1494a8af7a60f3faf77271b565db" credHelperURLEcr := fmt.Sprintf("https://amazon-ecr-credential-helper-releases.s3.us-east-2.amazonaws.com"+ "/%s/linux-%s/docker-credential-ecr-login", versionEcr, arch) hcEcr := helperConfig{ - binaryName: "docker-credential-ecr-login", credHelperURL: credHelperURLEcr, - hash: hashEcr, installFolder: installFolder, - finchPath: finchPath, + binaryName: "docker-credential-ecr-login", + credHelperURL: credHelperURLEcr, + installFolder: installFolder, + finchPath: finchPath, } + + if arch == "arm64" { + hcEcr.hash = hashARM64 + } else { + hcEcr.hash = hashAMD64 + } + configs["ecr-login"] = hcEcr for _, helper := range fc.CredsHelpers {