News for hackers. Stuff that matters.
Re:Git security vulnerability announced by isatty on Tuesday April 12, 2022 @11:27PM (#31010904)
What do you mean by “git often installs”. Git does not install anything. Developers configure their PS1 or install something that does.
Re:Git security vulnerability announced by gruez on Tuesday April 12, 2022 @11:38PM (#31010962)
on windows the default git package (ie. git bash) installs a bash terminal that has the git PS1 enabled.
Re:Git security vulnerability announced by chrisseaton on Wednesday April 13, 2022 @05:46AM (#31012770)
> Git does not install anything.

It's literally a Git installer.

Re:Git security vulnerability announced by edgyquant on Tuesday April 12, 2022 @11:51PM (#31011040)
The default shell on Mac and a lot of Linux distros do this installation, as well as git for windows.
Re:Git security vulnerability announced by asvitkine on Wednesday April 13, 2022 @12:32AM (#31011212)
Can you explain? A shell isn't supposed to be installing things on it's own... (Assuming you're talking about zsh or bash when you say shell.)
Re:Git security vulnerability announced by ratcline on Wednesday April 13, 2022 @04:04AM (#31012227)
It's not doing it on it's own, I believe what they're referring to is a a pre-configured distribution of a shell packaged with some distributions of Git, for some OSes.
Re:Git security vulnerability announced by jyrkesh on Wednesday April 13, 2022 @03:44AM (#31012129)
There's a lot of different ways to install Git on a lot of different OSes, and some of them put helper shell scripts down by default.
Re:Git security vulnerability announced by Sharparam on Wednesday April 13, 2022 @05:02AM (#31012524)
That isn't Git installing things though, that is third-party Git distributions bundling things along with Git.
Re:Git security vulnerability announced by jyrkesh on Wednesday April 13, 2022 @08:31PM (#31022034)
I'm aware, which is why I phrased it like I did. A lot of folks don't know or understand the distinction when they're installing Git (or installing something else that happens to bring Git with it).

The overarching point is that the shell itself is not installing anything at shell runtime. E.g. it's the Git Bash installer, not opening `bash`.

Re:Git security vulnerability announced by loa_in_ on Wednesday April 13, 2022 @12:35AM (#31011223)
Yeah, even zsh doesn't do this by default
Re:Git security vulnerability announced by everybodyknows on Wednesday April 13, 2022 @01:15AM (#31011422)
Can you say what Linux distro does this? Seems like very poor taste for a command shell to be assuming one particular SCM.
Re:Git security vulnerability announced by berkes on Wednesday April 13, 2022 @02:41AM (#31011843)
On Ubuntu, and I presume therefore many debian derivatives and debian itself, `apt get git` will install a file called `/usr/lib/git-core/git-sh-prompt` (dpkg -S /usr/lib/git-core/git-sh-prompt).

This script allows you to see repository status in your prompt. It comes with 5 utility functions that AFAIKS are usable in all common shells:

    __git_ps1_show_upstream ()
    __git_ps1_colorize_gitstring ()
    __git_eread ()
    __git_sequencer_status ()
    __git_ps1 () 
On Ubuntu those aren't installed into bash by default, but you need to add it yourself to your ~/.bashrc (or zsh or whatever, but those aren't the default in Ubuntu). The mechanisms aren't in place for a package to inject itself into your prompt, but it isn't unthinkable (though maybe unwanted) to have that. Similar to how tab-complete for bash is handled:

The `git` package installs a file `/usr/share/bash-completion/completions/git` which is picked up by bash, on Ubuntu, as a pluggable way to extend autocomplete on bash. Many packages do this, on my machine there's 960 files in there (ls -1 /usr/share/bash-completion/completions/ | wc -l).¹ It would be trivial to have a similar mechanism for `bash_rc.d` which allows for a pluggable system to extend and modify your bash. Again, I presume this to be unwanted. I would oppose it.

¹ This is why I was surprised to learn that people like zsh for the reason that it offers tab-completion: I always presumed bash did that out of the box for any installed package already. Turns out it is Ubuntu (or better: Debian) doing this for me.

Re:Git security vulnerability announced by nybble41 on Wednesday April 13, 2022 @02:14PM (#31018175)
> It would be trivial to have a similar mechanism for `bash_rc.d` which allows for a pluggable system to extend and modify your bash.

There is /etc/profile.d/ which serves much the same purpose for login shells, though PS1 is normally a non-exported shell variable so it wouldn't be inherited. You can configure most other aspects of the shell this way, however. And there is also /etc/bash.bashrc which is read before ~/.bashrc, though it doesn't provide a convenient directory for drop-in scripts by default the way /etc/profile does. It would be trivial to add that if desired. (All based on Debian; YMMV.)

Re:Git security vulnerability announced by leni536 on Wednesday April 13, 2022 @03:36AM (#31012095)
This feels like tab completion is a more serious attack vector then?
Re:Git security vulnerability announced by berkes on Wednesday April 13, 2022 @09:10AM (#31014178)
Anything installed through `apt` could be an attack vector, but that is silly, really.

If we start treating "apt get will install software that can change my system" as a security issue, we should stop using all electronic devises right now.

And yea: I know, we should have sandboxing, isolation, chroot and whatnot. And we are heading there. Yet in 2022, the vast majority of computers, servers and such are installed using package managers which install packages that have access to all the system. If you count mobile devises amongst "computers" then I guess a majority (Android) does have sandboxing in packages, which solves this particular issue.

Re:Git security vulnerability announced by dahfizz on Wednesday April 13, 2022 @08:17AM (#31013741)
You need to be root to add a file to the basl completions directory, so not really.
Re:Git security vulnerability announced by Fnoord on Wednesday April 13, 2022 @03:45PM (#31019327)
There is no the bash completion directory; there is a default one which happens to be system wide and only root writable (as should be the case in a combination of such circumstances).

Fish allows for custom ones in ~/.config/fish and there is zero reason you cannot install custom ones in ~/.bashrc or user writable (on macOS) /usr/local

Re:Git security vulnerability announced by dotancohen on Wednesday April 13, 2022 @02:13AM (#31011704)
Command shells assume a lot of things, such as your preferred text editor, locale, input and output devices, etc. Most of these things can be configured, but the default install makes assumptions based on common configurations.
Re:Git security vulnerability announced by fragmede on Wednesday April 13, 2022 @02:58AM (#31011906)
The shell doesn't assume a particular one, but if it's in a directory where a supported one is present, then it enables those extras.