public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Richard Hansen <rhansen@bbn•com>
Cc: git@vger•kernel.org, sitaramc@gmail•com,
	"SZEDER Gábor" <szeder@ira•uka.de>,
	"Simon Oosthoek" <s.oosthoek@xs4all•nl>
Subject: Re: [SECURITY PATCH] git-prompt.sh: don't put unsanitized branch names in $PS1
Date: Mon, 21 Apr 2014 15:33:30 -0700	[thread overview]
Message-ID: <xmqq1twq8g91.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <xmqq61m28gqj.fsf@gitster.dls.corp.google.com> (Junio C. Hamano's message of "Mon, 21 Apr 2014 15:23:00 -0700")

Junio C Hamano <gitster@pobox•com> writes:

> Richard Hansen <rhansen@bbn•com> writes:
>
>> Both bash and zsh subject the value of PS1 to parameter expansion,
>> command substitution, and arithmetic expansion.  Rather than include
>> the raw, unescaped branch name in PS1 when running in two- or
>> three-argument mode, construct PS1 to reference a variable that holds
>> the branch name.  Because the shells do not recursively expand, this
>> avoids arbitrary code execution by specially-crafted branch names such
>> as '$(IFS=_;cmd=sudo_rm_-rf_/;$cmd)'.
>>
>> Signed-off-by: Richard Hansen <rhansen@bbn•com>
>
> I'd like to see this patch eyeballed by those who have been involved
> in the script (shortlog and blame tells me they are SZEDER and
> Simon, CC'ed), so that we can hopefully merge it by the time -rc1 is
> tagged.
>
> Will queue so that I won't lose it in the meantime.
>
> Thanks.

Sadly, this does not seem to pass t9903.41 for me.

    $ bash t9903-*.sh -i -v

ends with this: 

    --- expected    2014-04-21 22:31:46.000000000 +0000
    +++ .../t/trash directory.t9903-bash-prompt/actual  ...
    @@ -1 +1 @@
    -BEFORE: (master):AFTER
    \ No newline at end of file
    +BEFORE: (${__git_ps1_branch_name}):AFTER
    \ No newline at end of file
    not ok 41 - prompt - pc mode

  reply	other threads:[~2014-04-21 22:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-21 19:07 [SECURITY PATCH] git-prompt.sh: don't put unsanitized branch names in $PS1 Richard Hansen
2014-04-21 20:24 ` Jeff King
2014-04-21 21:07   ` Richard Hansen
2014-04-22  8:38   ` Michael Haggerty
2014-04-22 17:38     ` Junio C Hamano
2014-04-22 18:38       ` Richard Hansen
2014-04-22 19:47         ` Junio C Hamano
2014-04-21 22:23 ` Junio C Hamano
2014-04-21 22:33   ` Junio C Hamano [this message]
2014-04-21 22:58     ` Richard Hansen
2014-04-21 23:53       ` [SECURITY PATCH v2] " Richard Hansen
  -- strict thread matches above, loose matches on Subject: below --
2014-04-24 18:40 [SECURITY PATCH] " Gábor Szeder
2014-04-25  7:37 ` Simon Oosthoek
2014-04-25 16:39   ` Richard Hansen

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=xmqq1twq8g91.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=rhansen@bbn$(echo .)com \
    --cc=s.oosthoek@xs4all$(echo .)nl \
    --cc=sitaramc@gmail$(echo .)com \
    --cc=szeder@ira$(echo .)uka.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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