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

Re: Shared repositories no longer securable against privilege escalation

From
JRJoe Rayhawk <jrayhawk@freedesktop.org>
Date
Mar 17, 2017, 17:12 UTC
Message-ID
<148977072642.2144.7040206366650087348@richardiv.omgwallhack.org>
In-Reply-To
<195b30d7-9ea2-7a9b-79ca-41b7bb890a30@alum.mit.edu>
Quoting Michael Haggerty (2017-03-17 05:07:36)
Show 11 quoted lines
> On 03/17/2017 01:23 AM, Joe Rayhawk wrote:
> > Git has started requiring write access to the root of bare repositories
> > in order to create /HEAD.lock. This is a major security problem in
> > shared environments as it also entails control over the /config link
> > i.e. core.hooksPath. Permission to write objects and update refs should
> > be entirely separate from permission to edit hook execution logic.
> 
> Thanks for the report. This is indeed a problem for people who want to
> set restrictive privileges on $GIT_DIR. I'd never thought of that use
> case, but it makes sense. Is this practice recommended somewhere or
> required by any Git hosting tools? (I'm curious how prevalent it is.)

I had to work out the practice for my own management engine; I have since deployed it to around eight different mixed-use multi-user operations, the most significant of which is Freedesktop.org.

Without this practice, core.sharedRepository is an enormous liability of a feature. I can't speak to whether anyone but me ever noticed, what with mixed-use multi-user POSIX environments becoming increasingly rare.

Show 5 quoted lines
> The locking was added intentionally, to ensure that the reflog for
> `HEAD` is written safely. But the code didn't do that prior to the
> commit that you referenced, so (as a special case) ignoring failures to
> lock `HEAD` due to insufficient permission is probably a reasonable
> compromise.
Hooray!
> (I can't resist pointing out that the *real* bug is storing special
> references like `HEAD` in the top level of $GIT_DIR, but that can't be
> changed now.)
Yeah, putting refs outside of refs/ is conceptually pretty nutty.
Previous: Junio C HamanoNext: Jakub Narębski
Message 6 of 9 in “Shared repositories no longer securable against privilege escalation”
  1. Joe RayhawkMar 17, 2017
  2. Michael HaggertyMar 17, 2017
  3. Junio C HamanoMar 17, 2017
  4. Joe RayhawkMar 17, 2017
  5. Junio C HamanoMar 17, 2017
  6. Joe RayhawkMar 17, 2017
  7. Jakub NarębskiMar 18, 2017
  8. Junio C HamanoMar 17, 2017
  9. Ævar Arnfjörð BjarmasonMar 18, 2017

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.