fix: parse quoted gcp auth-provider command args#1990
Conversation
Signed-off-by: immanuwell <pchpr.00@list.ru>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1990 +/- ##
=======================================
+ Coverage 76.7% 76.7% +0.1%
=======================================
Files 89 89
Lines 8747 8755 +8
=======================================
+ Hits 6703 6713 +10
+ Misses 2044 2042 -2
🚀 New features to boost your workflow:
|
|
Thanks for the fix. little bit worried about the new crate but, it looks stable. does this change leave any existing tests or comments stale? Since cmd-args is no longer split on spaces, it might be worth a quick pass to make sure nothing still references the old space-splitting behavior. For example, |
| let drop_env = shell_words::split(&drop_env) | ||
| .map_err(|e| Error::AuthExec(format!("invalid cmd-drop-env: {e}")))?; | ||
| let params = shell_words::split(¶ms) | ||
| .map_err(|e| Error::AuthExec(format!("invalid cmd-args: {e}")))?; |
There was a problem hiding this comment.
this would puts a new crate dep in direct control of shell out parameters and as such would be a valuable library to take over.
it's also by a quite inactive github user.
so i'm not a huge fan of this addition for a legacy provider (even though the upstream source code is very sensible right now).
Motivation
cmd-argsin the legacy gcpauth-providerpath is split on plain spaces right now. That breaks valid quoted args, so configs likesh -c 'printf %s "my token"'get mangled and auth blows up. Kinda rough, and pretty easy to hit if a kubeconfig shells through a wrapper.Repro:
cmd-path: shcmd-args: -c 'printf %s "my token"'Auth::try_from(...)Current main:
AuthExecRun ... Syntax error: Unterminated quoted stringSolution
Parse
cmd-argsandcmd-drop-envwithshell-wordsinstead ofsplit(' ').Added a regression test for quoted args, and kept the existing refresh coverage on the same path. small fix