From aea995c45ff057406b586144e28bd9575162b8df Mon Sep 17 00:00:00 2001 From: Andrew Keesler Date: Tue, 2 Mar 2021 14:30:42 -0500 Subject: [PATCH] exec credential provider: use stdin to detect user interaction We are not sure why this was stdout, since stdin is what the user uses to pass information to the exec plugin. There is a question of backwards compatibility here. Our take is that this is a bug, and so we are ameliorating behavior instead of breaking behavior. There are 2 main cases to consider with respect to backwards compatibility: 1. an existing exec plugin depended on stdin being hooked up to them if stdout was a terminal (e.g., echo foo | client-go-command-line-tool); we believe this is an anti-pattern, since the client-go-command-line-tool could be using stdin elsewhere (e.g., echo foo | kubectl apply -f -) 2. an existing exec plugin depended on stdin not being hooked up to them if stdout was not a terminal (e.g., client-go-command-line-tool >/dev/null); hopefully there are very few plugins that have tried to base logic off of whether stdin returned EOF immediately, since this could also happen when something else is wrong with stdin We hope to apply a stronger fix to this exec plugin user interaction stuff in a future release. Signed-off-by: Andrew Keesler --- .../src/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/staging/src/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go b/staging/src/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go index c88d17e36ab..43075bde3d1 100644 --- a/staging/src/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go +++ b/staging/src/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go @@ -198,7 +198,7 @@ func newAuthenticator(c *cache, config *api.ExecConfig, cluster *clientauthentic stdin: os.Stdin, stderr: os.Stderr, - interactive: term.IsTerminal(int(os.Stdout.Fd())), + interactive: term.IsTerminal(int(os.Stdin.Fd())), now: time.Now, environ: os.Environ,