git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Riku Voipio <riku.voipio@iki.fi>
To: git@vger.kernel.org
Subject: bug: git-http-push fails to validate email address in LOCK request
Date: Thu, 9 Apr 2009 14:19:44 +0300	[thread overview]
Message-ID: <20090409111944.GA22297@kos.to> (raw)

[-- Attachment #1: Type: text/plain, Size: 1746 bytes --]

Hi,

If for whatever case EMAIL env variable or gitconfig email= setting
contains any special xml character <>%&, the lock request in push
will fail, with a completly useless error message:

git push foo upstream-push:master
Error: cannot lock existing info/refs
error: failed to push some refs to 'https://git.foo.org/projects/foo'

using the undocumented GIT_CURL_VERBOSE=1 env variable:

-snip-
> LOCK /projects/foo/info/refs HTTP/1.1
Authorization: Basic nothisstringisnottheonefromthereallog
User-Agent: git/1.6.2.1
Host: git.foo.org
Accept: */*
Timeout: Second-600
Content-Type: text/xml
Content-Length: 225
Expect: 100-continue

< HTTP/1.1 100 Continue
* The requested URL returned error: 400
* Closing connection #0
Error: cannot lock existing info/refs
error: failed to push some refs to 'https://git.foo.org/projects/foo'
-snip-

Helpfully, the actual lock request is omitted.

After finding someone from git hoster to grep the logs:

[Tue Apr 07 14:13:24 2009] [error] [client 1.1.1.1] XML Parser
Error: XML parser error code: not well-formed (invalid token) (4)

from http-push.c, we see that the lock request is:

#define LOCK_REQUEST "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<D:lockinfo xmlns:D=\"DAV:\">\n<D:lockscope><D:exclusive/></D:lockscope>\n<D:locktype><D:write/></D:locktype>\n<D:owner>\n<D:href>mailto:%s</D:href>\n</D:owner>\n</D:lockinfo>"

So there is exactly one variable being set. Turns out the email
address in .gitconfig was set to '<riku.voipio@iki.fi>'. Yes,
a user error. This was copied from $EMAIL env variable, where
using strings such as 'foo bar <foo.bar@corp.com>' have been
a norm forever.


-- 
"rm -rf" only sounds scary if you don't have backups

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

             reply	other threads:[~2009-04-09 11:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-09 11:19 Riku Voipio [this message]
2009-04-09 12:02 ` bug: git-http-push fails to validate email address in LOCK request Mike Hommey
2009-04-09 22:23 ` [PATCH] Replace ",<,>,& with their respective XML entities in DAV requests Mike Hommey
2009-04-09 22:25 ` [PATCH v2] " Mike Hommey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090409111944.GA22297@kos.to \
    --to=riku.voipio@iki.fi \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).