Skip to content
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

In authorized_keys use double-quote for windows compatibility #10841

Merged
merged 3 commits into from Mar 27, 2020

Conversation

zeripath
Copy link
Contributor

It appears that windows OpenSSH cannot cope with single quoted strings. Use double-quotes instead.

Fix #10813

@zeripath zeripath added this to the 1.12.0 milestone Mar 26, 2020
Copy link
Member

@guillep2k guillep2k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem with " is that the content is subject to expansion in sh-like environments. Especially $ and most importantly the back tick for sub-shell executions. For example:

Expression                  Expands to
------------------------    -------------------
"this$HOME"                 this/home/git
'this$HOME'                 this$HOME
"this`echo HI!`"            thisHI!
'this`echo HI!`'            this`echo HI!`

You get the idea.

Having said that, the usage here is very restricted, and unless the admin has the peculiar idea of installing Gitea in a PATH such as

/home/my`rm -rf *`user/bin/gitea

we should be covered.

So, LG-TM.

@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Mar 27, 2020
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Mar 27, 2020
@lafriks
Copy link
Member

lafriks commented Mar 27, 2020

make lgtm work

@lafriks lafriks merged commit 453f6e6 into go-gitea:master Mar 27, 2020
@zeripath zeripath deleted the fix-10813 branch March 27, 2020 09:51
@zeripath
Copy link
Contributor Author

As @guillep2k says it may be that strconv.Quote/fmt.Sprintf("%q") does not completely quote things correctly but I guess this is a good start.

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generated authorized_keys does not work on Windows
4 participants