fix: escape GIT_SSH before promoting to GIT_SSH_COMMAND#13239
fix: escape GIT_SSH before promoting to GIT_SSH_COMMAND#13239
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
3922c99 to
2d99a1e
Compare
|
Okay, so after toying around with just escaping GIT_SSH, I've found that this whole thing of taking the user's configuration and haphazardly modifying it is just a plain bad idea. Escaping hassle aside, if the user has set any of GIT_SSH, GIT_SSH_COMMAND or For example, the user in #13088 is using So my take is that we should only set I'll leave this PR here for reference and start over on a new fix. |
| // Escape the path with single quotes so it's safe to execute by a POSIX shell. | ||
| // | ||
| // Even on Windows, Git uses a POSIX(ish) shell to execute GIT_SSH_COMMAND, see https://github.com/git/git/blob/b15384c06f77bc2d34d0d3623a8a58218313a561/run-command.c#L277-L286 | ||
| let escaped_git_ssh = git_ssh.as_ref().replace("'", r"'\''"); |
There was a problem hiding this comment.
You might be able to use https://docs.rs/gix-quote/latest/gix_quote/fn.single.html .
There was a problem hiding this comment.
Thanks! Good to know that's there.
🧢 Changes
Title pretty much sums it up.
🎫 Affected issues
Fixes: #13088