git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Carlo Arenas <carenas@gmail.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Philip Oakley <philipoakley@iee.email>,
	Guy Maurel <guy.j@maurel.de>,
	git@vger.kernel.org
Subject: Re: a problem with git describe
Date: Tue, 26 Apr 2022 09:46:06 -0700	[thread overview]
Message-ID: <xmqqpml3rdwx.fsf@gitster.g> (raw)
In-Reply-To: <CAPUEspiufPMZOfZFunTFYmX7KwPxsKsAeHnfBjKgosA1ZJWqzw@mail.gmail.com> (Carlo Arenas's message of "Tue, 26 Apr 2022 09:35:18 -0700")

Carlo Arenas <carenas@gmail.com> writes:

> Still think that (since we are already touching this) removing the
> restriction to
> root owned directories might make sense though, ex the following (unrealistic
> example) would work:

I think it is essential to protect unsuspecting "root" user from
wandering into an unfamiliar directory that happens to be a trap,
i.e. I may do something like this as an admin:

    $ sudo sh
    # cd / && find usr bin ... >/var/tmp/mylist.txt
    # cd /var/tmp

with the expectation that I'd then do some text processing on the
mylist.txt file, and going there first would allow me to refer to
the files more easily, instead of having to say:

    # sed -e '... processing ...' </var/tmp/mylist.txt >/var/tmp/out.txt

Alas, you as an attacker have done

    $ cd /var/tmp
    $ git init
    $ edit .git/config

to wait for me.  /var/tmp would be owned by 'root' but allows
anybody to write to it, only forbidding people from removing other
people's stuff.



>   $ mkdir -p r/t
>   $ sudo chown root r
>   $ cd r && sudo git init
>   $ cd t && git status
>
> IMHO any directories above that are owned by root and might have a git
> configuration must be safe, and therefore shouldn't need to be
> explicitly exempted.
>
> I also think that Taylor's suggestion to ignore and warn instead of
> abort might be
> a better solution to the "configuration file shouldn't be trusted"
> issue which is at
> the root of this regression, and obviously doing that would make this
> change less
> critical (users will just get a warning instead of being prevented to
> do what worked
> for them before and is a safe use case)
>
> Carlo
>
> PS. yes hardcoding uid 0 as root would be avoided, not sure where yet though

  reply	other threads:[~2022-04-26 16:48 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-23  9:12 a problem with git describe Guy Maurel
2022-04-23 11:27 ` Philip Oakley
2022-04-23 16:09   ` Junio C Hamano
2022-04-23 23:44     ` Junio C Hamano
2022-04-25  2:01       ` Carlo Marcelo Arenas Belón
2022-04-25  5:05         ` SZEDER Gábor
2022-04-25  6:03           ` Carlo Marcelo Arenas Belón
2022-04-25  6:39         ` Junio C Hamano
2022-04-25  7:02           ` Carlo Marcelo Arenas Belón
2022-04-25  8:40             ` Carlo Marcelo Arenas Belón
2022-04-25 15:11               ` Guy Maurel
2022-04-26 15:43               ` Johannes Schindelin
2022-04-26 15:56                 ` rsbecker
2022-04-26 16:35                 ` Carlo Arenas
2022-04-26 16:46                   ` Junio C Hamano [this message]
2022-04-26 17:15                     ` Carlo Arenas
2022-04-26 15:45       ` Johannes Schindelin
2022-04-26 16:25         ` Junio C Hamano
2022-04-26  1:52     ` Taylor Blau
2022-04-26 15:41       ` Johannes Schindelin
2022-04-26 15:50         ` Taylor Blau
2022-04-26 15:30     ` Johannes Schindelin
2022-04-26 15:36       ` Junio C Hamano

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=xmqqpml3rdwx.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=carenas@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=guy.j@maurel.de \
    --cc=philipoakley@iee.email \
    /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).