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

Re: a problem with git describe

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 26, 2022, 16:46 UTC
Message-ID
<xmqqpml3rdwx.fsf@gitster.g>
In-Reply-To
<CAPUEspiufPMZOfZFunTFYmX7KwPxsKsAeHnfBjKgosA1ZJWqzw@mail.gmail.com>
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.

Show 22 quoted lines
>   $ 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
Previous: Carlo ArenasNext: Carlo Arenas
Message 15 of 23 in “a problem with git describe”
  1. Guy MaurelApr 23, 2022
  2. Philip OakleyApr 23, 2022
  3. Junio C HamanoApr 23, 2022
  4. Junio C HamanoApr 23, 2022
  5. Carlo Marcelo Arenas BelónApr 25, 2022
  6. SZEDER GáborApr 25, 2022
  7. Carlo Marcelo Arenas BelónApr 25, 2022
  8. Junio C HamanoApr 25, 2022
  9. Carlo Marcelo Arenas BelónApr 25, 2022
  10. Carlo Marcelo Arenas BelónApr 25, 2022
  11. Guy MaurelApr 25, 2022
  12. Johannes SchindelinApr 26, 2022
  13. rsbecker@nexbridge.comApr 26, 2022
  14. Carlo ArenasApr 26, 2022
  15. Junio C HamanoApr 26, 2022
  16. Carlo ArenasApr 26, 2022
  17. Johannes SchindelinApr 26, 2022
  18. Junio C HamanoApr 26, 2022
  19. Taylor BlauApr 26, 2022
  20. Johannes SchindelinApr 26, 2022
  21. Taylor BlauApr 26, 2022
  22. Johannes SchindelinApr 26, 2022
  23. Junio C HamanoApr 26, 2022

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.