git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [SECURITY PATCH] git-prompt.sh: don't put unsanitized branch names in $PS1

From
RHRichard Hansen <rhansen@bbn.com>
Date
Apr 25, 2014, 16:39 UTC
Message-ID
<535A8FD3.2070409@bbn.com>
In-Reply-To
<20140425073724.GA9384@xs4all.nl>
On 2014-04-25 03:37, Simon Oosthoek wrote:
> (though tbh, I think you'd have to be in an automated situation
> to check out a branch that is basically a command to hack your
> system, a human would probably figure it too cumbersome, or too
> fishy)

You can get in trouble by cloning a malicious repository and cding to the resulting directory. See:

    https://github.com/richardhansen/clonepwn

for a (benign) demonstration. (Note the name of the default branch in that repository -- it's not master.)

Show 10 quoted lines
> 
>>>> + # not needed anymore; keep user's
>>>> + # environment clean
>>>> + unset __git_ps1_upstream_name
>> 
>> We already have a lot of stuff in the user's environment beginning
>> with __git, so I don't think the unset is necessary.
> 
> If people rely on the string being set in their scripts, it can be
> bad to remove it. But if it's new in this patch,
The variable is new.
> I don't see the need to keep it. Cruft is bad IMO.

Agreed, although I am willing to remove those three lines if that is the collective preference.

-Richard
Previous: Simon Oosthoek
Message 3 of 3 in “Re: [SECURITY PATCH] git-prompt.sh: don't put unsanitized branch names in $PS1”
  1. Gábor SzederApr 24, 2014
  2. Simon OosthoekApr 25, 2014
  3. Richard HansenApr 25, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.