Files
poky/meta/recipes-devtools/git/git_2.35.7.bb
Soumya Sambu d08e8d726d git: Fix multiple CVEs
CVE-2024-32002:
Git is a revision control system. Prior to versions 2.45.1, 2.44.1, 2.43.4,
2.42.2, 2.41.1, 2.40.2, and 2.39.4, repositories with submodules can be
crafted in a way that exploits a bug in Git whereby it can be fooled into
writing files not into the submodule's worktree but into a `.git/` directory.
This allows writing a hook that will be executed while the clone operation
is still running, giving the user no opportunity to inspect the code that is
being executed. The problem has been patched in versions 2.45.1, 2.44.1,
2.43.4, 2.42.2, 2.41.1, 2.40.2, and 2.39.4. If symbolic link support is
disabled in Git (e.g. via `git config --global core.symlinks false`), the
described attack won't work. As always, it is best to avoid cloning
repositories from untrusted sources.

CVE-2024-32004:
Git is a revision control system. Prior to versions 2.45.1, 2.44.1, 2.43.4,
2.42.2, 2.41.1, 2.40.2, and 2.39.4, an attacker can prepare a local repository
in such a way that, when cloned, will execute arbitrary code during the
operation. The problem has been patched in versions 2.45.1, 2.44.1, 2.43.4,
2.42.2, 2.41.1, 2.40.2, and 2.39.4. As a workaround, avoid cloning repositories
from untrusted sources.

CVE-2024-32020:
Git is a revision control system. Prior to versions 2.45.1, 2.44.1, 2.43.4,
2.42.2, 2.41.1, 2.40.2, and 2.39.4, local clones may end up hardlinking files
into the target repository's object database when source and target repository
reside on the same disk. If the source repository is owned by a different user,
then those hardlinked files may be rewritten at any point in time by the
untrusted user. Cloning local repositories will cause Git to either copy or
hardlink files of the source repository into the target repository. This
significantly speeds up such local clones compared to doing a "proper" clone and
saves both disk space and compute time. When cloning a repository located on the
same disk that is owned by a different user than the current user we also end up
creating such hardlinks. These files will continue to be owned and controlled by
the potentially-untrusted user and can be rewritten by them at will in the
future. The problem has been patched in versions 2.45.1, 2.44.1, 2.43.4, 2.42.2,
2.41.1, 2.40.2, and 2.39.4.

CVE-2024-32021:
Git is a revision control system. Prior to versions 2.45.1, 2.44.1, 2.43.4,
2.42.2, 2.41.1, 2.40.2, and 2.39.4, when cloning a local source repository that
contains symlinks via the filesystem, Git may create hardlinks to arbitrary
user-readable files on the same filesystem as the target repository in the
`objects/` directory. Cloning a local repository over the filesystem may
creating hardlinks to arbitrary user-owned files on the same filesystem in the
target Git repository's `objects/` directory. When cloning a repository over the
filesystem (without explicitly specifying the `file://` protocol or `--no-local`),
the optimizations for local cloning will be used, which include attempting to
hard link the object files instead of copying them. While the code includes checks
against symbolic links in the source repository, which were added during the fix
for CVE-2022-39253, these checks can still be raced because the hard link
operation ultimately follows symlinks. If the object on the filesystem appears as
a file during the check, and then a symlink during the operation, this will allow
the adversary to bypass the check and create hardlinks in the destination objects
directory to arbitrary, user-readable files. The problem has been patched in
versions 2.45.1, 2.44.1, 2.43.4, 2.42.2, 2.41.1, 2.40.2, and 2.39.4.

CVE-2024-32465:
Git is a revision control system. The Git project recommends to avoid working in
untrusted repositories, and instead to clone it first with `git clone --no-local`
to obtain a clean copy. Git has specific protections to make that a safe
operation even with an untrusted source repository, but vulnerabilities allow
those protections to be bypassed. In the context of cloning local repositories
owned by other users, this vulnerability has been covered in CVE-2024-32004. But
there are circumstances where the fixes for CVE-2024-32004 are not enough: For
example, when obtaining a `.zip` file containing a full copy of a Git repository,
it should not be trusted by default to be safe, as e.g. hooks could be configured
to run within the context of that repository. The problem has been patched in
versions 2.45.1, 2.44.1, 2.43.4, 2.42.2, 2.41.1, 2.40.2, and 2.39.4. As a
workaround, avoid using Git in repositories that have been obtained via archives
from untrusted sources.

References:
https://nvd.nist.gov/vuln/detail/CVE-2024-32002
https://nvd.nist.gov/vuln/detail/CVE-2024-32004
https://nvd.nist.gov/vuln/detail/CVE-2024-32020
https://nvd.nist.gov/vuln/detail/CVE-2024-32021
https://nvd.nist.gov/vuln/detail/CVE-2024-32465

(From OE-Core rev: 209c41377abf6853455b00af3923f1b244a3766b)

Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
2024-06-01 19:07:52 -07:00

188 lines
6.7 KiB
BlitzBasic

SUMMARY = "Distributed version control system"
HOMEPAGE = "http://git-scm.com"
DESCRIPTION = "Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency."
SECTION = "console/utils"
LICENSE = "GPL-2.0-only & GPL-2.0-or-later & BSD-3-Clause & MIT & BSL-1.0 & LGPL-2.1-or-later"
DEPENDS = "openssl zlib"
PROVIDES:append:class-native = " git-replacement-native"
SRC_URI = "${KERNELORG_MIRROR}/software/scm/git/git-${PV}.tar.gz;name=tarball \
file://fixsort.patch \
file://0001-config.mak.uname-do-not-force-RHEL-7-specific-build-.patch \
file://CVE-2023-29007.patch \
file://CVE-2023-25652.patch \
file://CVE-2024-32002-0001.patch \
file://CVE-2024-32002-0002.patch \
file://CVE-2024-32002-0003.patch \
file://CVE-2024-32002-0004.patch \
file://CVE-2024-32004-0001.patch \
file://CVE-2024-32004-0002.patch \
file://CVE-2024-32004-0003.patch \
file://CVE-2024-32020.patch \
file://CVE-2024-32021-0001.patch \
file://CVE-2024-32021-0002.patch \
file://CVE-2024-32465.patch \
"
S = "${WORKDIR}/git-${PV}"
LIC_FILES_CHKSUM = "\
file://COPYING;md5=7c0d7ef03a7eb04ce795b0f60e68e7e1 \
file://reftable/LICENSE;md5=1a6424cafc4c9c88c689848e165af33b \
file://sha1dc/LICENSE.txt;md5=9bbe4c990a9e98ea4b98ef5d3bcb8a7a \
file://compat/nedmalloc/License.txt;md5=e4224ccaecb14d942c71d31bef20d78c \
file://compat/inet_ntop.c;md5=76593c6f74e8ced5b24520175688d59b;endline=16 \
file://compat/obstack.h;md5=08ad25fee5428cd879ceef451ce3a22e;endline=18 \
file://compat/poll/poll.h;md5=9fc00170a53b8e3e52157c91ac688dd1;endline=19 \
file://compat/regex/regex.h;md5=30cc8af0e6f0f8a25acec6d8783bb763;beginline=4;endline=22 \
"
CVE_PRODUCT = "git-scm:git"
# This is about a manpage not mentioning --mirror may "leak" information
# in mirrored git repos. Most OE users wouldn't build the docs and
# we don't see this as a major issue for our general users/usecases.
CVE_CHECK_IGNORE += "CVE-2022-24975"
# This is specific to Git-for-Windows
CVE_CHECK_IGNORE += "CVE-2022-41953"
# specific to Git for Windows
CVE_CHECK_IGNORE += "CVE-2023-22743"
# This is specific to Git-for-Windows
CVE_CHECK_IGNORE += "CVE-2023-25815"
PACKAGECONFIG ??= "expat curl"
PACKAGECONFIG[cvsserver] = ""
PACKAGECONFIG[svn] = ""
PACKAGECONFIG[manpages] = ",,asciidoc-native xmlto-native"
PACKAGECONFIG[curl] = "--with-curl,--without-curl,curl"
PACKAGECONFIG[expat] = "--with-expat,--without-expat,expat"
EXTRA_OECONF = "--with-perl=${STAGING_BINDIR_NATIVE}/perl-native/perl \
--without-tcltk \
--without-iconv \
"
EXTRA_OECONF:append:class-nativesdk = " --with-gitconfig=/etc/gitconfig "
# Needs brokensep as this doesn't use automake
inherit autotools-brokensep perlnative bash-completion manpages
EXTRA_OEMAKE = "NO_PYTHON=1 CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}'"
EXTRA_OEMAKE += "'PERL_PATH=/usr/bin/env perl'"
EXTRA_OEMAKE += "COMPUTE_HEADER_DEPENDENCIES=no"
EXTRA_OEMAKE:append:class-native = " NO_CROSS_DIRECTORY_HARDLINKS=1"
do_compile:prepend () {
# Remove perl/perl.mak to fix the out-of-date perl.mak error
# during rebuild
rm -f perl/perl.mak
if [ "${@bb.utils.filter('PACKAGECONFIG', 'manpages', d)}" ]; then
oe_runmake man
fi
}
do_install () {
oe_runmake install DESTDIR="${D}" bindir=${bindir} \
template_dir=${datadir}/git-core/templates
install -d ${D}/${datadir}/bash-completion/completions/
install -m 644 ${S}/contrib/completion/git-completion.bash ${D}/${datadir}/bash-completion/completions/git
if [ "${@bb.utils.filter('PACKAGECONFIG', 'manpages', d)}" ]; then
oe_runmake install-man DESTDIR="${D}"
fi
}
perl_native_fixup () {
sed -i -e 's#${STAGING_BINDIR_NATIVE}/perl-native/#${bindir}/#' \
-e 's#${libdir}/perl-native/#${libdir}/#' \
${@d.getVar("PERLTOOLS").replace(' /',d.getVar('D') + '/')}
if [ ! "${@bb.utils.filter('PACKAGECONFIG', 'cvsserver', d)}" ]; then
# Only install the git cvsserver command if explicitly requested
# as it requires the DBI Perl module, which does not exist in
# OE-Core.
rm ${D}${libexecdir}/git-core/git-cvsserver \
${D}${bindir}/git-cvsserver
fi
if [ ! "${@bb.utils.filter('PACKAGECONFIG', 'svn', d)}" ]; then
# Only install the git svn command and all Git::SVN Perl modules
# if explicitly requested as they require the SVN::Core Perl
# module, which does not exist in OE-Core.
rm -r ${D}${libexecdir}/git-core/git-svn \
${D}${datadir}/perl5/Git/SVN*
fi
}
REL_GIT_EXEC_PATH = "${@os.path.relpath(libexecdir, bindir)}/git-core"
REL_GIT_TEMPLATE_DIR = "${@os.path.relpath(datadir, bindir)}/git-core/templates"
do_install:append:class-target () {
perl_native_fixup
}
do_install:append:class-native() {
create_wrapper ${D}${bindir}/git \
GIT_EXEC_PATH='`dirname $''realpath`'/${REL_GIT_EXEC_PATH} \
GIT_TEMPLATE_DIR='`dirname $''realpath`'/${REL_GIT_TEMPLATE_DIR}
}
do_install:append:class-nativesdk() {
create_wrapper ${D}${bindir}/git \
GIT_EXEC_PATH='`dirname $''realpath`'/${REL_GIT_EXEC_PATH} \
GIT_TEMPLATE_DIR='`dirname $''realpath`'/${REL_GIT_TEMPLATE_DIR}
perl_native_fixup
}
FILES:${PN} += "${datadir}/git-core ${libexecdir}/git-core/"
PERLTOOLS = " \
${bindir}/git-cvsserver \
${libexecdir}/git-core/git-add--interactive \
${libexecdir}/git-core/git-archimport \
${libexecdir}/git-core/git-cvsexportcommit \
${libexecdir}/git-core/git-cvsimport \
${libexecdir}/git-core/git-cvsserver \
${libexecdir}/git-core/git-send-email \
${libexecdir}/git-core/git-svn \
${libexecdir}/git-core/git-instaweb \
${datadir}/gitweb/gitweb.cgi \
${datadir}/git-core/templates/hooks/prepare-commit-msg.sample \
${datadir}/git-core/templates/hooks/pre-rebase.sample \
${datadir}/git-core/templates/hooks/fsmonitor-watchman.sample \
"
# Git tools requiring perl
PACKAGES =+ "${PN}-perltools"
FILES:${PN}-perltools += " \
${PERLTOOLS} \
${libdir}/perl \
${datadir}/perl5 \
"
RDEPENDS:${PN}-perltools = "${PN} perl perl-module-file-path findutils"
# git-tk package with gitk and git-gui
PACKAGES =+ "${PN}-tk"
#RDEPENDS:${PN}-tk = "${PN} tk tcl"
#EXTRA_OEMAKE = "TCL_PATH=${STAGING_BINDIR_CROSS}/tclsh"
FILES:${PN}-tk = " \
${bindir}/gitk \
${datadir}/gitk \
"
PACKAGES =+ "gitweb"
FILES:gitweb = "${datadir}/gitweb/"
RDEPENDS:gitweb = "perl"
BBCLASSEXTEND = "native nativesdk"
EXTRA_OECONF += "ac_cv_snprintf_returns_bogus=no \
ac_cv_fread_reads_directories=${ac_cv_fread_reads_directories=yes} \
"
EXTRA_OEMAKE += "NO_GETTEXT=1"
SRC_URI[tarball.sha256sum] = "fc849272a95cc7457091221a645fcd753b3b1984767ee3323fb6a0aa944bbcb4"