From 5bca115dab272e1257db11dfb63858deb87ae34d Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Mon, 5 Apr 2021 12:27:36 -0400 Subject: [PATCH] Verify existence of auth file if specified Fixes: https://github.com/containers/podman/issues/9572 Signed-off-by: Daniel J Walsh Signed-off-by: Matthew Heon --- cmd/podman/images/build.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/podman/images/build.go b/cmd/podman/images/build.go index da6d556b19..7bb05e9b1c 100644 --- a/cmd/podman/images/build.go +++ b/cmd/podman/images/build.go @@ -11,6 +11,7 @@ import ( "github.com/containers/buildah/define" buildahCLI "github.com/containers/buildah/pkg/cli" "github.com/containers/buildah/pkg/parse" + "github.com/containers/common/pkg/auth" "github.com/containers/common/pkg/completion" "github.com/containers/common/pkg/config" encconfig "github.com/containers/ocicrypt/config" @@ -330,6 +331,12 @@ func buildFlagsWrapperToOptions(c *cobra.Command, contextDir string, flags *buil pullPolicy = define.PullNever } + if c.Flag("authfile").Changed { + if err := auth.CheckAuthFile(flags.Authfile); err != nil { + return nil, err + } + } + args := make(map[string]string) if c.Flag("build-arg").Changed { for _, arg := range flags.BuildArg {