From: Junio C Hamano <gitster@pobox.com>
To: Lea Wiemann <lewiemann@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] gitweb: fix support for repository directories with spaces
Date: Tue, 17 Jun 2008 14:27:01 -0700 [thread overview]
Message-ID: <7vk5gn69cq.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <7vd4mg9824.fsf@gitster.siamese.dyndns.org> (Junio C. Hamano's message of "Mon, 16 Jun 2008 18:14:27 -0700")
Junio C Hamano <gitster@pobox.com> writes:
> Lea Wiemann <lewiemann@gmail.com> writes:
>
>> git_cmd_str does not quote the directory names without this patch.
>>
>> Signed-off-by: Lea Wiemann <LeWiemann@gmail.com>
>> ---
>> git_cmd_str is really really bad from a security POV: Where it is
>> used, command lines are passed to the shell, which (I believe) just
>> *happen* to open no security holes. Hence the function should
>> ultimately go away. However, let's make the tests work for the
>> meantime while it's still there.
>>
>> gitweb/gitweb.perl | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
>> index 07e64da..0bddc31 100755
>> --- a/gitweb/gitweb.perl
>> +++ b/gitweb/gitweb.perl
>> @@ -1502,7 +1502,7 @@ sub git_cmd {
>>
>> # returns path to the core git executable and the --git-dir parameter as string
>> sub git_cmd_str {
>> - return join(' ', git_cmd());
>> + return join ' ', map("'$_'", git_cmd());
>> }
>
> What happens to a path or parameter that has a sq in it?
>
> You are returing this from git_cmd():
>
> return $GIT, '--git-dir='.$git_dir;
>
> How is this cmd_str() gets used? If you absolutely have to have a single
> string that can be safely passed to the shell, the easiest would be to
> quote mechanically in sq following the pattern illustrated at the
> beginning of quote.c
Just to be a tad more helpful, that would be something like:
join(' ', map {
s/\047/\047\134\047\047/g;
"'$_'";
} git_cmd()));
next prev parent reply other threads:[~2008-06-17 21:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-17 1:09 [PATCH] gitweb: fix support for repository directories with spaces Lea Wiemann
2008-06-17 1:14 ` Junio C Hamano
2008-06-17 21:27 ` Junio C Hamano [this message]
2008-06-17 21:46 ` [PATCH v2] gitweb: quote commands properly when calling the shell Lea Wiemann
2008-06-17 21:51 ` Lea Wiemann
2008-06-17 23:41 ` Junio C Hamano
2008-06-17 1:38 ` [PATCH] gitweb: fix support for repository directories with spaces Jakub Narebski
2008-06-17 22:07 ` Lea Wiemann
2008-06-17 22:27 ` Jakub Narebski
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=7vk5gn69cq.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=lewiemann@gmail.com \
/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).