fix(kubernetes): prevent command injection in application remove#595
Merged
Conversation
The marketplace application name supplied by the user was interpolated directly into a shell command string passed to /bin/bash -c, allowing arbitrary command execution. Fetch the uninstall script over HTTP and pipe it to 'bash -s' via stdin instead, with the app name URL-escaped and only ever used as a URL path segment. Also validate the HTTP status before executing so a missing script is not piped to the shell. Add a table-driven test for getMarketplaceAppUninstallScript using an httptest server. Signed-off-by: hlts2 <hiroto.funakoshi.hiroto@gmail.com>
Member
Author
Manual verificationConfirmed the normal install/uninstall flow still works end-to-end (k3s cluster). Install → actually installed. Remove → the release is gone. |
Member
Author
When no official
|
giornetta
approved these changes
Jun 22, 2026
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.
What this does
Removes a shell-based command construction in
civo kubernetes applications removethat interpolated the user-supplied application name into a string passed to/bin/bash -c, which allowed shell command injection.Changes
uninstall.shover HTTP and pipe it tobash -svia stdin, instead of building abash <(curl ...)string for/bin/bash -c.url.PathEscape) and only ever used as a URL path segment — it never reaches a shell command string.getMarketplaceAppUninstallScript(baseURL, appName)and add a table-driven test using anhttptestserver.Notes