fix: quote arguments for passing to auto completion server#20
Merged
43081j merged 1 commit intobombshell-dev:mainfrom Apr 5, 2025
Merged
fix: quote arguments for passing to auto completion server#2043081j merged 1 commit intobombshell-dev:mainfrom
43081j merged 1 commit intobombshell-dev:mainfrom
Conversation
|
commit: |
43081j
approved these changes
Apr 5, 2025
Collaborator
43081j
left a comment
There was a problem hiding this comment.
looks good to me 👍
good catch. we should also have some tests around this eventually, I'll create a separate issue for that
dreyfus92
approved these changes
Apr 5, 2025
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.
I realized there was code in the zsh completion generation code that caused vulnerabilities.
tab/src/zsh.ts
Line 61 in d5659d5
Here, the
requestCompvariable contains the words that the user entered on the command line(${words[2,-1]}).The eval command reinterprets this string as a shell command and executes it.
issue point
If the user enters a string containing shell metacharacters (e.g.
;,&,|,$(), etc.) as a command line argument, eval will interpret these metacharacters as command delimiters or subcommand execution with special meaning.This may cause unintended arbitrary commands to be executed.
example
Suppose the user types the following (name is mycli, and exec is mycli):
mycli some-command '; rm -rf ~ #'In this case,
requestCompwould be a string like“mycli complete -- some-command '; rm -rf ~ #”. If eval executes this, the following commands may be executed in order.As you can see, because the user input is not properly escaped or quoted, there is a risk that arbitrary commands could be injected by using
eval.tab case may be a rare case, but if it is input in some way, it could cause comm