-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent arguments from being interpreted as options #80
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow some SQL-injection-like bugs you're fixing here. Amazing, didn't even consider these edge cases!
Can you link me to documentation that describes how -- fixes it? EDIT: nvm didn't realize this is a POSIX thing which is easy to Google https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02 is where it's described |
Doesn't __fzf_search_shell_variables.fish have the same problem? |
It's included. |
I really don't see it... |
@kidonng Oh LOL I typoed. You probably thought I was crazy. I meant __fzf_search_git_status.fish |
Right, I forgot that it will insert paths eventually. |
Nice, thanks! I was about to ask why you didn't add |
) Just like #80, solves an issue introduced in https://github.com/PatrickF1/fzf.fish/pull/119/files#diff-fd01aaa375d8928720283f620b157dd451536fe8ef06d837110f2502b2f1660eR9. This one is when the current token is --option when executing the search files feature.
Prevent errors that can happen if the current token, selected path, or selected command, beings with a `-`. Examples where fzf.fish would error: - the cursor is over the token --something when the user executes search files - the cursor is over -z when the user executes search variables - the selected changed path from git status is -folder - the selected command is --function The solution is to delineate the end of options with --, which is a POSIX specification defined in https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02 (guideline 10), which is respected by Fish builtins. After --, the command will always interpret the arguments as positional arguments.
…atrickF1#132) Just like PatrickF1#80, solves an issue introduced in https://github.com/PatrickF1/fzf.fish/pull/119/files#diff-fd01aaa375d8928720283f620b157dd451536fe8ef06d837110f2502b2f1660eR9. This one is when the current token is --option when executing the search files feature.
User inputs, file names and commands can contain leading hypens (
--
), which may cause errors or the function not working.Examples where fzf.fish would error:
The solution is to delineate the end of options with --, which is a POSIX specification defined in https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02 (guideline 10), which is respected by Fish builtins. After --, the command will always interpret the arguments as positional arguments.