Skip to content

Commit

Permalink
[DotNet] - Upgrade PowerShell due to CVE-2024-0057 (#952)
Browse files Browse the repository at this point in the history
  • Loading branch information
gauravsaini04 authored Feb 8, 2024
1 parent 768ed6e commit 073e654
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/dotnet/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,12 @@ ENV PATH $PATH:/home/vscode/.dotnet:/home/vscode/.dotnet/tools
# clear this environment variable so xml docs from NuGet packages are unpackaged. The default dotnet/sdk image sets it to 'skip'.
# see https://github.com/dotnet/dotnet-docker/issues/2790
ENV NUGET_XMLDOC_MODE=

# Temporary: Upgrade packages due to mentioned CVEs
# They are installed by the base image (mcr.microsoft.com/dotnet/sdk) which does not have the patch.
# https://msrc.microsoft.com/update-guide/vulnerability/CVE-2024-0057
RUN apt-get update && \
wget https://github.com/PowerShell/PowerShell/releases/download/v7.4.1/powershell_7.4.1-1.deb_amd64.deb && \
dpkg -i powershell_7.4.1-1.deb_amd64.deb && \
apt-get install -f && \
rm powershell_7.4.1-1.deb_amd64.deb
9 changes: 9 additions & 0 deletions src/dotnet/test-project/test-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ checkCommon()
check "code" which code
}

checkPackageVersion()
{
PACKAGE=$1
REQUIRED_VERSION=$2
PACKAGE_NAME=$3
current_version=$("${PACKAGE}" -V | grep -E "^${PACKAGE_NAME}\s" | awk '{print $2}')
check-version-ge "${PACKAGE_NAME}-requirement" "${current_version}" "${REQUIRED_VERSION}"
}

reportResults() {
if [ ${#FAILED[@]} -ne 0 ]; then
echoStderr -e "\n💥 Failed tests: ${FAILED[@]}"
Expand Down
2 changes: 2 additions & 0 deletions src/dotnet/test-project/test.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,7 @@ check "gitconfig-contains-name" sh -c "cat /etc/gitconfig | grep 'name = devcont

check "usr-local-etc-config-does-not-exist" test ! -f "/usr/local/etc/gitconfig"

checkPackageVersion "pwsh" "7.4.1" "PowerShell"

# Report result
reportResults

0 comments on commit 073e654

Please sign in to comment.