git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: southerntofu@thunix.net
To: git@vger.kernel.org
Subject: Bug: permissions problem when recursively cloning from a suid program
Date: Tue, 5 Jan 2021 13:07:27 -0500	[thread overview]
Message-ID: <X/Sq38YKmLjY4KmD@thunix.net> (raw)

What did you do before the bug happened? (Steps to reproduce your issue)

Hi, i tried to clone a repository with submodules from a program running with the suid/guid bit set.

What did you expect to happen? (Expected behavior)

It should clone the repository, with the submodules, with permissions from the owner of the suid program.

What happened instead? (Actual behavior)

git fails with a permissions error:

```
error: could not lock config file /path/to/.git/config: Permission denied
fatal: Failed to register url for submodule path
```

What's different between what you expected and what actually happened?

Cloning failed when fetching submodules (--recursive). However, it only works without submodules.

Anything else you want to add:

I could reproduce the bug on the next branch. I have a small reproduction case. It's a rust program, but the code is a bit more convoluted so it works without any dependency (just the standard library). Reproduction instructions in the repository:

https://tildegit.org/southerntofu/testsuid

[System Info]
git version:
git version 2.30.0.284.gd98b1dd5ea
cpu: x86_64
built from commit: d98b1dd5eaa7327399716162c746c9bd3cac3866
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
[REDACTED]
$SHELL (typically, interactive shell): /bin/bash

                 reply	other threads:[~2021-01-05 18:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=X/Sq38YKmLjY4KmD@thunix.net \
    --to=southerntofu@thunix.net \
    --cc=git@vger.kernel.org \
    /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).