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

Re: [PATCH] setup: support GIT_IGNORE_INSECURE_OWNER environment variable

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Jun 27, 2024, 09:50 UTC
Message-ID
<5742e728-a012-4960-a32d-bf3b65c3a2e3@gmail.com>
In-Reply-To
<xmqqa5j71snb.fsf@gitster.g>
On 26/06/2024 19:11, Junio C Hamano wrote:
Show 13 quoted lines
> Phillip Wood <phillip.wood123@gmail.com> writes:
> 
>> To expand an this a little - a couple of times I've wanted to checkout
>> a bare repository that is owned by a different user. It is a pain to
>> have to add a new config setting just for a one-off checkout. Being
>> able to adjust the config on the command line would be very useful in
>> that case.
> 
> True.  As long as it is deemed safe to honor the one-off "git -c
> safe.directory=..." from the command line, for the purpose of this
> "I who am running this 'git' process hereby declare that I trust
> this and that repository", I think it would be the best solution
> for the "git daemon" use case.

This actually works already, the behavior was changed in 6061601d9f (safe.directory: use git_protected_config(), 2022-07-14). The reason I thought it didn't work was that I remember it failing on Debian bullseye a few months ago but that used an older version of git. There is some more rationale for the change in 779ea9303a7 (Documentation: define protected configuration, 2022-07-14)

Best Wishes
Phillip
Show 22 quoted lines
> And it is much better than adding a one-off environment variable.
> After all, if your "git daemon" user does not have a $HOME set in
> its /etc/passwd entry, you cannot set such an environment variable
> in $HOME/.profile so somewhere in your "git daemon" invocation would
> have to be tweaked to have code snippet that sets and exports it
> *anyway*.  You can tweak the "git" invocation to add the command
> line tweak "-c safe.directory=..." at the place you would have set
> and exported the variable, and using the well understood "git -c
> var=val" mechanism would be more appropriate.
> 
>>> Or you could set $HOME to a suitable directory when running "git
>> ...
>> The advantage of this approach is that there are no changes needed to
>> git, instead of setting GIT_IGNORE_INSECURE_OWNER one sets HOME to
>> point to a suitable config file. I found this useful when I was
>> debugging the issues with git-daemon earlier[1]
> 
> Yup, that sounds like a workable approach, if "git -c var=val"
> approach turns out to be inappropriate for security purposes
> for whatever reason.
> 
> Thanks.
Previous: Jeff KingNext: Junio C Hamano
Message 10 of 20 in “support GIT_IGNORE_INSECURE_OWNER environment variable”
  1. 0/1 support GIT_IGNORE_INSECURE_OWNER environment variableFlorian Schmaus, Jun 26, 2024
  2. setup: support GIT_IGNORE_INSECURE_OWNER environment variableFlorian Schmaus, Jun 26, 2024
  3. Phillip WoodJun 26, 2024
  4. rsbecker@nexbridge.comJun 26, 2024
  5. phillip.wood123@gmail.comJun 26, 2024
  6. Phillip WoodJun 26, 2024
  7. Junio C HamanoJun 26, 2024
  8. Florian SchmausJun 26, 2024
  9. Jeff KingJun 26, 2024
  10. Phillip WoodJun 27, 2024
  11. Junio C HamanoJun 27, 2024
  12. Phillip WoodJun 28, 2024
  13. Junio C HamanoJun 28, 2024
  14. Phillip WoodJul 1, 2024
  15. Junio C HamanoJul 1, 2024
  16. Johannes SchindelinJul 1, 2024
  17. Jeff KingJul 1, 2024
  18. Junio C HamanoJul 1, 2024
  19. Jeff KingJul 1, 2024
  20. Eric WongJul 2, 2024

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.