{"thread":{"id":"24434","subject":"[http] Git error messages reveal password encoded in the URL","startedAt":"2010-07-19T17:00:20Z","lastAt":"2010-07-20T07:46:18Z","messageCount":8,"participants":["Ketan Padegaonkar","Jakub Narebski","Jacob Helwig","Tay Ray Chuan"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"145799","messageId":"4C4484A4.5010009@gmail.com","threadId":"24434","inReplyTo":null,"subject":"[http] Git error messages reveal password encoded in the URL","fromName":"Ketan Padegaonkar","fromEmail":"ketanpadegaonkar@gmail.com","sentAt":"2010-07-19T17:00:20Z","receivedAt":"2010-07-19T17:00:20Z","isPatch":false,"sender":{"key":"ketanpadegaonkar@gmail.com","avatar":null},"body":"Hi,\n\nWe use http to serve our git repos, in order for git to not ask me a \nusername/password everytime, I've put the following in my .git/config:\n\n[remote \"origin\"]\n   url = https://user:pass@host/repo.git\n\nWhat is discerning is that every time git encounters a problem \nconnecting to the repo, I get the following error containing both my \nusername and password.\n\nerror: Couldn't resolve host 'host' while accessing \nhttps://user:pass@host/repo.git/info/refs\n\nI would like to suggest that the password be removed/masked from this \nerror message.\n\n-- \nKetan\nhttp://ketan.padegaonkar.name | http://eclipse.org/swtbot\n"},{"id":"145819","messageId":"m3aapnmbid.fsf@localhost.localdomain","threadId":"24434","inReplyTo":"4C4484A4.5010009@gmail.com","subject":"Re: [http] Git error messages reveal password encoded in the URL","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-07-19T21:02:12Z","receivedAt":"2010-07-19T21:02:12Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Ketan Padegaonkar <ketanpadegaonkar@gmail.com> writes:\n\n> We use http to serve our git repos, in order for git to not ask me a\n> username/password everytime, \n\nErrr... WTF?  Can't you configure SSH (use ssh-add, perhaps together with\ntool such as keychain) to use public key based authentication?\n\n> I've put the following in my .git/config:\n> \n> [remote \"origin\"]\n>    url = https://user:pass@host/repo.git\n> \n> What is discerning is that every time git encounters a problem\n> connecting to the repo, I get the following error containing both my\n> username and password.\n> \n> error: Couldn't resolve host 'host' while accessing\n> https://user:pass@host/repo.git/info/refs\n> \n> I would like to suggest that the password be removed/masked from this\n> error message.\n\nWhich git version do you use?  I recall vaguely that something was\ndone in this direction (masking passwords in URLs).\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"145820","messageId":"AANLkTikP3eNVs34ZcB9gHqV60-aqexfCPgcyBWSGn_Y7@mail.gmail.com","threadId":"24434","inReplyTo":"m3aapnmbid.fsf@localhost.localdomain","subject":"Re: [http] Git error messages reveal password encoded in the URL","fromName":"Jacob Helwig","fromEmail":"jacob.helwig@gmail.com","sentAt":"2010-07-19T21:05:27Z","receivedAt":"2010-07-19T21:05:27Z","isPatch":false,"sender":{"key":"jacob.helwig@gmail.com","avatar":"https://avatars.githubusercontent.com/u/14557?v=4"},"body":"On Mon, Jul 19, 2010 at 14:02, Jakub Narebski <jnareb@gmail.com> wrote:\n> Ketan Padegaonkar <ketanpadegaonkar@gmail.com> writes:\n>\n>> We use http to serve our git repos, in order for git to not ask me a\n>> username/password everytime,\n>\n> Errr... WTF?  Can't you configure SSH (use ssh-add, perhaps together with\n> tool such as keychain) to use public key based authentication?\n>\n\nI don't think SSH/ssh-agent/pubkey would actually help, given that\nit's a https URL.  Unless I'm missing something here?\n\n>> I've put the following in my .git/config:\n>>\n>> [remote \"origin\"]\n>>    url = https://user:pass@host/repo.git\n>>\n"},{"id":"145822","messageId":"201007192310.56399.jnareb@gmail.com","threadId":"24434","inReplyTo":"AANLkTikP3eNVs34ZcB9gHqV60-aqexfCPgcyBWSGn_Y7@mail.gmail.com","subject":"Re: [http] Git error messages reveal password encoded in the URL","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-07-19T21:10:55Z","receivedAt":"2010-07-19T21:10:55Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Dnia poniedziałek 19. lipca 2010 23:05, Jacob Helwig napisał:\n> On Mon, Jul 19, 2010 at 14:02, Jakub Narebski <jnareb@gmail.com> wrote:\n>> Ketan Padegaonkar <ketanpadegaonkar@gmail.com> writes:\n>>\n>>> We use http to serve our git repos, in order for git to not ask me a\n>>> username/password everytime,\n>>\n>> Errr... WTF?  Can't you configure SSH (use ssh-add, perhaps together with\n>> tool such as keychain) to use public key based authentication?\n>>\n> \n> I don't think SSH/ssh-agent/pubkey would actually help, given that\n> it's a https URL.  Unless I'm missing something here?\n\nI was referring to 'we use http [...] _in order_ for git to not ask me\na username/password everywhere'.  I just noted that you can make git\nnot ask a username/password everywhere when using ssh:// URLs.\n\n-- \nJakub Narebski\nPoland\n"},{"id":"145823","messageId":"AANLkTilby7GWOuObh6W4z_caUG83O5A5Wh4Wb-JJnSdJ@mail.gmail.com","threadId":"24434","inReplyTo":"201007192310.56399.jnareb@gmail.com","subject":"Re: [http] Git error messages reveal password encoded in the URL","fromName":"Jacob Helwig","fromEmail":"jacob.helwig@gmail.com","sentAt":"2010-07-19T21:16:10Z","receivedAt":"2010-07-19T21:16:10Z","isPatch":false,"sender":{"key":"jacob.helwig@gmail.com","avatar":"https://avatars.githubusercontent.com/u/14557?v=4"},"body":"On Mon, Jul 19, 2010 at 14:10, Jakub Narebski <jnareb@gmail.com> wrote:\n> Dnia poniedziałek 19. lipca 2010 23:05, Jacob Helwig napisał:\n>> On Mon, Jul 19, 2010 at 14:02, Jakub Narebski <jnareb@gmail.com> wrote:\n>>> Ketan Padegaonkar <ketanpadegaonkar@gmail.com> writes:\n>>>\n>>>> We use http to serve our git repos, in order for git to not ask me a\n>>>> username/password everytime,\n>>>\n>>> Errr... WTF?  Can't you configure SSH (use ssh-add, perhaps together with\n>>> tool such as keychain) to use public key based authentication?\n>>>\n>>\n>> I don't think SSH/ssh-agent/pubkey would actually help, given that\n>> it's a https URL.  Unless I'm missing something here?\n>\n> I was referring to 'we use http [...] _in order_ for git to not ask me\n> a username/password everywhere'.  I just noted that you can make git\n> not ask a username/password everywhere when using ssh:// URLs.\n>\n\nAh, I read it to mean \"We use HTTP.  I encode the user and password in\nthe URL to prevent it from asking all the time\", not \"We use HTTP with\nan encoded user and password to prevent it from asking\".  If it's the\nlatter, then you're definitely right: Using SSH + pubkey\nauthentication is probably a _much_ better choice.\n"},{"id":"145830","messageId":"4C44DEF7.4000903@gmail.com","threadId":"24434","inReplyTo":"AANLkTilby7GWOuObh6W4z_caUG83O5A5Wh4Wb-JJnSdJ@mail.gmail.com","subject":"Re: [http] Git error messages reveal password encoded in the URL","fromName":"Ketan Padegaonkar","fromEmail":"ketanpadegaonkar@gmail.com","sentAt":"2010-07-19T23:25:43Z","receivedAt":"2010-07-19T23:25:43Z","isPatch":false,"sender":{"key":"ketanpadegaonkar@gmail.com","avatar":null},"body":"On 7/19/10 2:16 PM, Jacob Helwig wrote:\n> On Mon, Jul 19, 2010 at 14:10, Jakub Narebski<jnareb@gmail.com>  wrote:\n>> Dnia poniedziałek 19. lipca 2010 23:05, Jacob Helwig napisał:\n>>> On Mon, Jul 19, 2010 at 14:02, Jakub Narebski<jnareb@gmail.com>  wrote:\n>>>> Ketan Padegaonkar<ketanpadegaonkar@gmail.com>  writes:\n>>>>\n>>>>> We use http to serve our git repos, in order for git to not ask me a\n>>>>> username/password everytime,\n\nApologies. I used the wrong punctuation. It should read as:\n\nWe use https+basic auth to serve up git repos. Unfortunately SSH is not \nan option for various reasons.\n\nIn order for git to not ask me the username/password, I 'encoded' the \nusername/password into the url.\n\nI'm using git v1.7.1.1 on MacOSX Leopard. I can see the same behavior on \nmaster (rev 24e7a5).\n\n-- \nKetan\nhttp://ketan.padegaonkar.name | http://eclipse.org/swtbot\n"},{"id":"145833","messageId":"201007200241.46972.jnareb@gmail.com","threadId":"24434","inReplyTo":"4C44DEF7.4000903@gmail.com","subject":"Re: [http] Git error messages reveal password encoded in the URL","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-07-20T00:41:45Z","receivedAt":"2010-07-20T00:41:45Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Dnia wtorek 20. lipca 2010 01:25, Ketan Padegaonkar napisał:\n> On 7/19/10 2:16 PM, Jacob Helwig wrote:\n>> On Mon, Jul 19, 2010 at 14:10, Jakub Narebski<jnareb@gmail.com>  wrote:\n>>> Dnia poniedziałek 19. lipca 2010 23:05, Jacob Helwig napisał:\n>>>> On Mon, Jul 19, 2010 at 14:02, Jakub Narebski<jnareb@gmail.com>  wrote:\n>>>>> Ketan Padegaonkar<ketanpadegaonkar@gmail.com>  writes:\n>>>>>\n>>>>>> We use http to serve our git repos, in order for git to not ask me a\n>>>>>> username/password everytime,\n> \n> Apologies. I used the wrong punctuation. It should read as:\n> \n> We use https+basic auth to serve up git repos. Unfortunately SSH is not \n> an option for various reasons.\n\nIs it because of firewall, or it is the issue with issuing shell \naccounts?  If the latter, you can use tools such as gitosis or gitolite\nwhich need only one single shell account, and control access via public\nkey infrastructure.\n\n> \n> In order for git to not ask me the username/password, I 'encoded' the \n> username/password into the url.\n\nCan't you use ~/.netrc file[1] instead?  As far as I see this would not\nshow password info on error.  Not that the current situation should\nnot be fixed, but it might be worthwhile workaround for a time.\n\nThe ~/.netrc file would look like this for your example:\n\n  machine host\n  login user\n  password pass\n\nYou should of course `chmod 600 ~/.netrc`\n\n[1] This is unfortunately underdocumented: only this documentation\nDocumentation/howto/setup-git-server-over-http.txt mentions ~/.netrc\nfile.  I think that handling the $HOME/.netrc is done by the curl \nlibrary that git uses, see libcurl-tutorial(3) manpage.\n\n> I'm using git v1.7.1.1 on MacOSX Leopard. I can see the same behavior on \n> master (rev 24e7a5).\n\n-- \nJakub Narebski\nPoland\n"},{"id":"145846","messageId":"AANLkTilYeKkJlUaB7zRgvIR_OyzrabWG1iPLbmrvkAqu@mail.gmail.com","threadId":"24434","inReplyTo":"201007200241.46972.jnareb@gmail.com","subject":"Re: [http] Git error messages reveal password encoded in the URL","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2010-07-20T07:46:18Z","receivedAt":"2010-07-20T07:46:18Z","isPatch":false,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"Hi:\n\nOn Tue, Jul 20, 2010 at 8:41 AM, Jakub Narebski <jnareb@gmail.com> wrote:\n> Dnia wtorek 20. lipca 2010 01:25, Ketan Padegaonkar napisał:\n[snip]\n> Can't you use ~/.netrc file[1] instead?  As far as I see this would not\n> show password info on error.  Not that the current situation should\n> not be fixed, but it might be worthwhile workaround for a time.\n>\n> The ~/.netrc file would look like this for your example:\n>\n>  machine host\n>  login user\n>  password pass\n>\n> You should of course `chmod 600 ~/.netrc`\n>\n> [1] This is unfortunately underdocumented: only this documentation\n> Documentation/howto/setup-git-server-over-http.txt mentions ~/.netrc\n> file.  I think that handling the $HOME/.netrc is done by the curl\n> library that git uses, see libcurl-tutorial(3) manpage.\n\n+1\n\nThis is the only way I know of to \"hide\" your password.\n\nOf course, depending on your authentication scheme, your efforts for\nthis setup may prove worthless.\n\n-- \nCheers,\nRay Chuan\n"}]}