diff --git a/blog/atom.xml b/blog/atom.xml index b8d6527..a5a9c02 100644 --- a/blog/atom.xml +++ b/blog/atom.xml @@ -31,7 +31,7 @@ - [solved] Gitea 1.16.6 1.16.7 error: fatal: unsafe repository is owned by someone else + [solved] Gitea 1.16.[678] error: fatal: unsafe repository is owned by someone else 2022-05-15T00:00:00+00:00 2022-05-15T00:00:00+00:00 @@ -48,8 +48,8 @@ <ul> <li>If using <a href="https://hub.docker.com/r/gitea/gitea">Gitea docker images</a>: <ul> -<li>do not upgrade to 1.16.6 or 1.16.7, or</li> -<li>downgrade from 1.16.6 or 1.16.7 to 1.16.5 (do <strong>not</strong> downgrade from 1.17.x, it may corrupt your the Gitea database)</li> +<li>do not upgrade to 1.16.6, 1.16.7 or 1.16.8, or</li> +<li>downgrade from 1.16.6, 1.16.7 or 1.16.8 to 1.16.5 (do <strong>not</strong> downgrade from 1.17.x, it may corrupt your the Gitea database)</li> </ul> </li> <li>If the Gitea binary was installed independently of git, upgrade git to a version that is <a href="https://git-scm.com/docs/git-config#Documentation/git-config.txt-safedirectory">greater or equal to 2.36</a> and disable the security check entirely with: @@ -63,7 +63,7 @@ ><span class="anchor-icon">#</span></a > </h3> -<p>The <a href="https://github.com/go-gitea/gitea/pull/19707">bug fix</a> is for Gitea to ensure <code>git config --global --replace-all safe.directory '*'</code> is set on its <a href="https://docs.gitea.io/en-us/install-from-binary/#recommended-server-configuration">dedicated user</a> when it initializes. It is effective on the condition that the git CLI version is <a href="https://git-scm.com/docs/git-config#Documentation/git-config.txt-safedirectory">greater or equal to 2.36</a>.</p> +<p>The <a href="https://github.com/go-gitea/gitea/pull/19870">bug fix</a> is for Gitea to ensure <code>git config --global --replace-all safe.directory '*'</code> is set on its <a href="https://docs.gitea.io/en-us/install-from-binary/#recommended-server-configuration">dedicated user</a> when it initializes. It is effective on the condition that the git CLI version is <a href="https://git-scm.com/docs/git-config#Documentation/git-config.txt-safedirectory">greater or equal to 2.36</a>.</p> <h3 id="bug-fix-rationale">Bug fix rationale<a class="zola-anchor" href="#bug-fix-rationale" aria-label="Anchor link for: bug-fix-rationale" ><span class="anchor-icon">#</span></a > @@ -71,7 +71,7 @@ <p>It is safe to <a href="https://lab.forgefriends.org/forgefriends/forgefriends/-/merge_requests/50/diffs">disable the security check in Gitea</a>. It is not vulnerable to <strong><a href="https://github.com/git-for-windows/git/security/advisories/GHSA-vw2c-22j4-2fh2">CVE-2022-24765</a></strong> because it calls the git CLI <a href="https://github.com/go-gitea/gitea/blob/main/modules/git/command.go#L160">after changing its working directory</a> to be the git repository targeted by the command (for instance <a href="https://github.com/go-gitea/gitea/blob/main/modules/git/diff.go#L38-L45">diff</a>) or a temporary directory. Therefore <strong>it will not explore the parent directories looking for a git configuration file</strong>.</p> <p>The security check is triggered because the repository is owned by an unexpected user (root instead of git typically) and <strong>not because a parent directory is owned by an unexpected user</strong>. This, in itself, is a problem worth investigating but it is unrelated and was revealed by the newer security check of git even though it does not match the threat described in <strong><a href="https://github.com/git-for-windows/git/security/advisories/GHSA-vw2c-22j4-2fh2">CVE-2022-24765</a></strong>.</p> <p>It appears non trivial to enforce a consistent ownership of files and directories, either within docker or outside docker when networked file systems are involved. The Gitea server was not troubled by this inconsistency so far because the permissions allow it to write and read where expected, regardless of the owner. It is not worth looking into but it is ancient and unrelated.</p> -<p>Gitea runs under a dedicated user, either when installed <a href="https://docs.gitea.io/en-us/install-from-binary/#recommended-server-configuration">from binary</a> or from <a href="https://docs.gitea.io/en-us/install-with-docker/">docker</a> and <a href="https://github.com/go-gitea/gitea/blob/main/modules/git/git.go#L196-L207">modifies the global git configuration</a> depending on the git version at initialization time. Fixing the problem can therefore be done by <a href="https://lab.forgefriends.org/forgefriends/forgefriends/-/merge_requests/50/diffs#bcd72ff867cbd1ddd5b6518c3a05b5f1a6021286_209_209">disabling the security check in the global git config file at initialization time</a>. It also requires a minimum version of git 2.36 to be installed <a href="https://lab.forgefriends.org/forgefriends/forgefriends/-/merge_requests/50/diffs#6651ddff6eb82c840ced7c1dddee15c6e1913dd4_44_49">in the Gitea docker image</a>. </p> +<p>Gitea runs under a dedicated user, either when installed <a href="https://docs.gitea.io/en-us/install-from-binary/#recommended-server-configuration">from binary</a> or from <a href="https://docs.gitea.io/en-us/install-with-docker/">docker</a> and <a href="https://github.com/go-gitea/gitea/blob/main/modules/git/git.go#L196-L207">modifies the global git configuration</a> depending on the git version at initialization time. Fixing the problem can therefore be done by <a href="https://lab.forgefriends.org/forgefriends/forgefriends/-/merge_requests/50/diffs#bcd72ff867cbd1ddd5b6518c3a05b5f1a6021286_209_209">disabling the security check in the global git config file at initialization time</a>. It also requires a minimum version of git 2.36 to be installed, which is the case for Gitea docker images with <a href="https://github.com/go-gitea/gitea/pull/19871">versions &gt;= 1.16.9</a>.</p> diff --git a/blog/index.html b/blog/index.html index 8d3ca9d..c271f1c 100644 --- a/blog/index.html +++ b/blog/index.html @@ -242,7 +242,7 @@
  • -

    [solved] Gitea 1.16.6 1.16.7 error: fatal: unsafe repository is owned by someone else

    +

    [solved] Gitea 1.16.[678] error: fatal: unsafe repository is owned by someone else

    [solved] Gitea 1.16.6 1.16.7 error: fatal: unsafe repository is owned by someone else

    +

    [solved] Gitea 1.16.[678] error: fatal: unsafe repository is owned by someone else