fix(security): command injection via az aks command invoke - #560
Merged
Suneha Bose (bosesuneha) merged 1 commit intoAug 26, 2026
Merged
Conversation
David Gamero (davidgamero)
force-pushed
the
sanitize-private-cluster-command
branch
from
August 26, 2026 14:45
2afa703 to
41f4b65
Compare
David Gamero (davidgamero)
force-pushed
the
sanitize-private-cluster-command
branch
from
August 26, 2026 14:45
41f4b65 to
51dc0ee
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PrivateKubectl.execute flattened its argv array with args.join(' ') and passed the result to
az aks command invoke --command.The run-command pod uses its own high-privilege service account, so this escapes whatever RBAC the workflow's kubeconfig was scoped to.
Values reaching the command string:
Fix: rewrite filename arguments positionally on the argv array, then POSIX-quote every element before joining. Quoting is only possible once the filename rewriting no longer needs to re-parse a flattened string, so the two changes are inseparable.
This also removes the minimist re-parse and the '-f ' substring test, which mis-handled any value containing a space and could rewrite unrelated arguments.
Also honours the caller's
silentflag: command output was previously written to the debug log unconditionally, including for callers such as getAllPods() that explicitly request silence.Tests verify the fix by executing the generated command in a real POSIX shell with kubectl stubbed to dump its argv, then asserting it reconstructs the original array exactly, for payloads carried in annotations, resource names, namespaces and filenames.
Also removes minimist as it's unused dependency