Skip to content

Commit 648e465

Browse files
Update 'git' to '2.39.1' due to CVE-2022-41903 & CVE-2022-23521 (#331)
* Use git Feature - ubuntu & universal * Update git * address comment * update cpp
1 parent 0d7db73 commit 648e465

File tree

44 files changed

+464
-78
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+464
-78
lines changed

src/anaconda/.devcontainer/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
2626
&& apt-get install -y --no-install-recommends \
2727
bzip2 \
2828
ca-certificates \
29-
git \
3029
libglib2.0-0 \
3130
libsm6 \
3231
libxcomposite1 \

src/anaconda/test-project/test-utils.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ checkExtension() {
108108
checkCommon()
109109
{
110110
PACKAGE_LIST="apt-utils \
111-
git \
112111
openssh-client \
113112
less \
114113
iproute2 \

src/anaconda/test-project/test.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,17 @@ check "pydocstyle" pydocstyle --version
1717
check "pycodestyle" pycodestyle --version
1818
check "nvm" bash -c ". /usr/local/share/nvm/nvm.sh && nvm --version"
1919

20+
check "git" git --version
21+
check "git-location" sh -c "which git | grep /usr/local/bin/git"
22+
2023
git_version=$(git --version)
21-
check-version-ge "git-requirement" "${git_version}" "git version 2.38.1"
24+
check-version-ge "git-requirement" "${git_version}" "git version 2.39.1"
25+
26+
check "set-git-config-user-name" sh -c "sudo git config --system user.name devcontainers"
27+
check "gitconfig-file-location" sh -c "ls /etc/gitconfig"
28+
check "gitconfig-contains-name" sh -c "cat /etc/gitconfig | grep 'name = devcontainers'"
29+
30+
check "usr-local-etc-config-does-not-exist" test ! -f "/usr/local/etc/gitconfig"
2231

2332
joblib_version=$(python -c "import joblib; print(joblib.__version__)")
2433
check-version-ge "joblib-requirement" "${joblib_version}" "1.2.0"

src/base-alpine/.devcontainer/devcontainer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"userUid": "1000",
1212
"userGid": "1000",
1313
"upgradePackages": "true"
14-
}
14+
},
15+
"./local-features/git": {}
1516
},
1617

1718
// Use 'forwardPorts' to make a list of ports inside the container available locally.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"id": "git",
3+
"name": "Git from source"
4+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/ash
2+
#-------------------------------------------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
5+
#-------------------------------------------------------------------------------------------------------------
6+
7+
set -e
8+
9+
apk update
10+
apk add --no-cache \
11+
--upgrade \
12+
curl \
13+
grep \
14+
make \
15+
zlib-dev \
16+
--no-cache \
17+
openssl-dev \
18+
curl-dev \
19+
expat-dev \
20+
asciidoc \
21+
xmlto \
22+
perl-error \
23+
perl-dev \
24+
tcl \
25+
tk \
26+
gcc \
27+
g++ \
28+
python3-dev \
29+
pcre2-dev
30+
31+
GIT_VERSION_LIST="$(curl -sSL -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/git/git/tags" | grep -oP '"name":\s*"v\K[0-9]+\.[0-9]+\.[0-9]+"' | tr -d '"' | sort -rV )"
32+
GIT_VERSION="$(echo "${GIT_VERSION_LIST}" | head -n 1)"
33+
34+
echo "Installing git v${GIT_VERSION}"
35+
curl -sL https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz | tar -xzC /tmp 2>&1
36+
37+
cd /tmp/git-${GIT_VERSION}
38+
39+
make -s prefix=/usr/local sysconfdir=/etc all NO_REGEX=YesPlease NO_GETTEXT=YesPlease \
40+
&& make -s prefix=/usr/local sysconfdir=/etc NO_REGEX=YesPlease NO_GETTEXT=YesPlease install 2>&1
41+
42+
rm -rf /tmp/git-${GIT_VERSION}

src/base-alpine/test-project/test-utils-alpine.sh

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,23 @@ check() {
2727
fi
2828
}
2929

30+
check-version-ge() {
31+
LABEL=$1
32+
CURRENT_VERSION=$2
33+
REQUIRED_VERSION=$3
34+
shift
35+
echo -e "\n🧪 Testing $LABEL: '$CURRENT_VERSION' is >= '$REQUIRED_VERSION'"
36+
local GREATER_VERSION=$((echo ${CURRENT_VERSION}; echo ${REQUIRED_VERSION}) | sort -V | tail -1)
37+
if [ "${CURRENT_VERSION}" == "${GREATER_VERSION}" ]; then
38+
echo "✅ Passed!"
39+
return 0
40+
else
41+
echoStderr "❌ $LABEL check failed."
42+
FAILED+=("$LABEL")
43+
return 1
44+
fi
45+
}
46+
3047
checkMultiple() {
3148
PASSED=0
3249
LABEL="$1"
@@ -90,8 +107,7 @@ checkExtension() {
90107

91108
checkCommon()
92109
{
93-
PACKAGE_LIST="git \
94-
openssh-client \
110+
PACKAGE_LIST="openssh-client \
95111
gnupg \
96112
procps \
97113
lsof \

src/base-alpine/test-project/test.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,17 @@ source test-utils-alpine.sh vscode
66
# Run common tests
77
checkCommon
88

9+
check "git" git --version
10+
check "git-location" sh -c "which git | grep /usr/local/bin/git"
11+
12+
git_version=$(git --version)
13+
check-version-ge "git-requirement" "${git_version}" "git version 2.39.1"
14+
15+
check "set-git-config-user-name" sh -c "sudo git config --system user.name devcontainers"
16+
check "gitconfig-file-location" sh -c "ls /etc/gitconfig"
17+
check "gitconfig-contains-name" sh -c "cat /etc/gitconfig | grep 'name = devcontainers'"
18+
19+
check "usr-local-etc-config-does-not-exist" test ! -f "/usr/local/etc/gitconfig"
20+
921
# Report result
1022
reportResults

src/base-debian/test-project/test-utils.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,23 @@ check() {
2222
fi
2323
}
2424

25+
check-version-ge() {
26+
LABEL=$1
27+
CURRENT_VERSION=$2
28+
REQUIRED_VERSION=$3
29+
shift
30+
echo -e "\n🧪 Testing $LABEL: '$CURRENT_VERSION' is >= '$REQUIRED_VERSION'"
31+
local GREATER_VERSION=$((echo ${CURRENT_VERSION}; echo ${REQUIRED_VERSION}) | sort -V | tail -1)
32+
if [ "${CURRENT_VERSION}" == "${GREATER_VERSION}" ]; then
33+
echo "✅ Passed!"
34+
return 0
35+
else
36+
echoStderr "❌ $LABEL check failed."
37+
FAILED+=("$LABEL")
38+
return 1
39+
fi
40+
}
41+
2542
checkMultiple() {
2643
PASSED=0
2744
LABEL="$1"

src/base-debian/test-project/test.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,16 @@ source test-utils.sh vscode
77
checkCommon
88

99
check "git" git --version
10+
check "git-location" sh -c "which git | grep /usr/local/bin/git"
1011

11-
git_version_satisfied=false
12-
if (echo a version 2.38.1; git --version) | sort -Vk3 | tail -1 | grep -q git; then
13-
git_version_satisfied=true
14-
fi
12+
git_version=$(git --version)
13+
check-version-ge "git-requirement" "${git_version}" "git version 2.39.1"
1514

16-
check "git version satisfies requirement" echo $git_version_satisfied | grep "true"
15+
check "set-git-config-user-name" sh -c "sudo git config --system user.name devcontainers"
16+
check "gitconfig-file-location" sh -c "ls /etc/gitconfig"
17+
check "gitconfig-contains-name" sh -c "cat /etc/gitconfig | grep 'name = devcontainers'"
18+
19+
check "usr-local-etc-config-does-not-exist" test ! -f "/usr/local/etc/gitconfig"
1720

1821
cd /tmp && git clone https://github.com/devcontainers/feature-starter.git
1922
cd feature-starter

0 commit comments

Comments
 (0)