<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/setup.c, branch v2.37.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.37.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.37.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2022-07-27T20:19:49Z</updated>
<entry>
<title>Merge branch 'cr/setup-bug-typo' into maint</title>
<updated>2022-07-27T20:19:49Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-07-27T20:19:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c0454798ac436fa16cdd2bd1adee6054b4ea93ea'/>
<id>urn:sha1:c0454798ac436fa16cdd2bd1adee6054b4ea93ea</id>
<content type='text'>
Typofix in a BUG() message.
source: &lt;pull.1255.git.1654782920256.gitgitgadget@gmail.com&gt;

* cr/setup-bug-typo:
  setup: fix function name in a BUG() message
</content>
</entry>
<entry>
<title>Sync with Git 2.36.2</title>
<updated>2022-06-27T19:41:41Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-06-27T19:36:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=69ab3309e96279b3f323ceb1b8c2ebf670788c8e'/>
<id>urn:sha1:69ab3309e96279b3f323ceb1b8c2ebf670788c8e</id>
<content type='text'>
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Sync with 2.35.4</title>
<updated>2022-06-23T10:36:12Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2022-06-23T10:36:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8f8eea8c3aba154ce1f9eaab4fa06c73b60550dc'/>
<id>urn:sha1:8f8eea8c3aba154ce1f9eaab4fa06c73b60550dc</id>
<content type='text'>
* maint-2.35:
  Git 2.35.4
  Git 2.34.4
  Git 2.33.4
  Git 2.32.3
  Git 2.31.4
  Git 2.30.5
  setup: tighten ownership checks post CVE-2022-24765
  git-compat-util: allow root to access both SUDO_UID and root owned
  t0034: add negative tests and allow git init to mostly work under sudo
  git-compat-util: avoid failing dir ownership checks if running privileged
  t: regression git needs safe.directory when using sudo
</content>
</entry>
<entry>
<title>Sync with 2.34.4</title>
<updated>2022-06-23T10:36:03Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2022-06-23T10:36:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=aef3d5948c5b00a0409e117da7e720f574040505'/>
<id>urn:sha1:aef3d5948c5b00a0409e117da7e720f574040505</id>
<content type='text'>
* maint-2.34:
  Git 2.34.4
  Git 2.33.4
  Git 2.32.3
  Git 2.31.4
  Git 2.30.5
  setup: tighten ownership checks post CVE-2022-24765
  git-compat-util: allow root to access both SUDO_UID and root owned
  t0034: add negative tests and allow git init to mostly work under sudo
  git-compat-util: avoid failing dir ownership checks if running privileged
  t: regression git needs safe.directory when using sudo
</content>
</entry>
<entry>
<title>Sync with 2.32.3</title>
<updated>2022-06-23T10:35:38Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2022-06-23T10:35:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=eebfde3f213e2990727a64da0d7d04ad961a28b0'/>
<id>urn:sha1:eebfde3f213e2990727a64da0d7d04ad961a28b0</id>
<content type='text'>
* maint-2.32:
  Git 2.32.3
  Git 2.31.4
  Git 2.30.5
  setup: tighten ownership checks post CVE-2022-24765
  git-compat-util: allow root to access both SUDO_UID and root owned
  t0034: add negative tests and allow git init to mostly work under sudo
  git-compat-util: avoid failing dir ownership checks if running privileged
  t: regression git needs safe.directory when using sudo
</content>
</entry>
<entry>
<title>Sync with 2.31.4</title>
<updated>2022-06-23T10:35:30Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2022-06-23T10:35:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fc0c773028685cdbae35c6c71f3fd3b87ab70985'/>
<id>urn:sha1:fc0c773028685cdbae35c6c71f3fd3b87ab70985</id>
<content type='text'>
* maint-2.31:
  Git 2.31.4
  Git 2.30.5
  setup: tighten ownership checks post CVE-2022-24765
  git-compat-util: allow root to access both SUDO_UID and root owned
  t0034: add negative tests and allow git init to mostly work under sudo
  git-compat-util: avoid failing dir ownership checks if running privileged
  t: regression git needs safe.directory when using sudo
</content>
</entry>
<entry>
<title>setup: tighten ownership checks post CVE-2022-24765</title>
<updated>2022-06-23T10:31:05Z</updated>
<author>
<name>Carlo Marcelo Arenas Belón</name>
<email>carenas@gmail.com</email>
</author>
<published>2022-05-10T19:35:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3b0bf2704980b1ed6018622bdf5377ec22289688'/>
<id>urn:sha1:3b0bf2704980b1ed6018622bdf5377ec22289688</id>
<content type='text'>
8959555cee7 (setup_git_directory(): add an owner check for the top-level
directory, 2022-03-02), adds a function to check for ownership of
repositories using a directory that is representative of it, and ways to
add exempt a specific repository from said check if needed, but that
check didn't account for owership of the gitdir, or (when used) the
gitfile that points to that gitdir.

An attacker could create a git repository in a directory that they can
write into but that is owned by the victim to work around the fix that
was introduced with CVE-2022-24765 to potentially run code as the
victim.

An example that could result in privilege escalation to root in *NIX would
be to set a repository in a shared tmp directory by doing (for example):

  $ git -C /tmp init

To avoid that, extend the ensure_valid_ownership function to be able to
check for all three paths.

This will have the side effect of tripling the number of stat() calls
when a repository is detected, but the effect is expected to be likely
minimal, as it is done only once during the directory walk in which Git
looks for a repository.

Additionally make sure to resolve the gitfile (if one was used) to find
the relevant gitdir for checking.

While at it change the message printed on failure so it is clear we are
referring to the repository by its worktree (or gitdir if it is bare) and
not to a specific directory.

Helped-by: Junio C Hamano &lt;junio@pobox.com&gt;
Helped-by: Johannes Schindelin &lt;Johannes.Schindelin@gmx.de&gt;
Signed-off-by: Carlo Marcelo Arenas Belón &lt;carenas@gmail.com&gt;
</content>
</entry>
<entry>
<title>setup: fix function name in a BUG() message</title>
<updated>2022-06-17T22:44:19Z</updated>
<author>
<name>Cleber Rosa</name>
<email>crosa@redhat.com</email>
</author>
<published>2022-06-09T13:55:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a3ba4fa715c67329736c9483f4b3fdab99cee50f'/>
<id>urn:sha1:a3ba4fa715c67329736c9483f4b3fdab99cee50f</id>
<content type='text'>
The reference given to users when the result of
setup_git_directory_gently_1() is unexpected is incorrect.

Signed-off-by: Cleber Rosa &lt;crosa@redhat.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>setup: don't die if realpath(3) fails on getcwd(3)</title>
<updated>2022-05-25T05:08:31Z</updated>
<author>
<name>Kevin Locke</name>
<email>kevin@kevinlocke.name</email>
</author>
<published>2022-05-24T19:20:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c37c6dc6a79a1ca7b9d4fa4efd788d8f5ec6369a'/>
<id>urn:sha1:c37c6dc6a79a1ca7b9d4fa4efd788d8f5ec6369a</id>
<content type='text'>
Prior to Git 2.35.0, git could be run from an inaccessible working
directory so long as the git repository specified by options and/or
environment variables was accessible.  For example:

    git init repo
    mkdir -p a/b
    cd a/b
    chmod u-x ..
    git -C "${PWD%/a/b}/repo" status

If this example seems a bit contrived, consider running with the
repository owner as a substitute UID (e.g. with runuser(1) or sudo(8))
without ensuring the working directory is accessible by that user.

The code added by e6f8861bd4 ("setup: introduce
startup_info-&gt;original_cwd") to preserve the working directory attempts
to normalize the path using strbuf_realpath().  If that fails, as in the
case above, it is treated as a fatal error.

This commit treats strbuf_realpath() errors as non-fatal.  If an error
occurs, setup_original_cwd() will continue without applying removal
prevention for cwd, resulting in the pre-2.35.0 behavior.  The risk
should be minimal, since git will not operate on a repository with
inaccessible ancestors, this behavior is only known to occur when cwd is
a descendant of the repository, an ancestor of cwd is inaccessible, and
no ancestors of the repository are inaccessible.

Signed-off-by: Kevin Locke &lt;kevin@kevinlocke.name&gt;
Reviewed-by: Elijah Newren &lt;newren@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ep/maint-equals-null-cocci'</title>
<updated>2022-05-20T22:26:59Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-05-20T22:26:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=538dc459a0331c48b893c9f6ca0be5917860bb99'/>
<id>urn:sha1:538dc459a0331c48b893c9f6ca0be5917860bb99</id>
<content type='text'>
Introduce and apply coccinelle rule to discourage an explicit
comparison between a pointer and NULL, and applies the clean-up to
the maintenance track.

* ep/maint-equals-null-cocci:
  tree-wide: apply equals-null.cocci
  tree-wide: apply equals-null.cocci
  contrib/coccinnelle: add equals-null.cocci
</content>
</entry>
</feed>
