mirror of
https://github.com/kubernetes/kubectl.git
synced 2026-05-28 04:35:50 -04:00
* kubectl: strict check for exec command Fix https://github.com/kubernetes/kubectl/issues/1745 The current implementation doesn't properly check for arguments between the resource name and the dash separator. This can lead to unexpected behavior when using commands like 'kubectl exec -it pod-0 bash -- run.sh', which should raise an error but doesn't. This fix ensures that when a dash separator (--) is used, there are no extra arguments between the resource name and the dash. - Only allow argsLenAtDash == 0 or == 1 (exactly one arg before --) - Add test for extra args between pod and -- - Add test for flag-like args without dash separator * test: add kubectl exec container flag coverage * Apply suggestion from @soltysh Co-authored-by: Maciej Szulik <soltysh@gmail.com> --------- Co-authored-by: Maciej Szulik <soltysh@gmail.com> Kubernetes-commit: b528be0a5658083db98e4a757483a36e1a83e27c |
||
|---|---|---|
| .. | ||
| exec.go | ||
| exec_test.go | ||