Skip to content

Commit c20b59a

Browse files
committed
Dockerfile: mitigate certain supply chain attacks using sha256sums
Currently, the Dockerfile downloads various tools and SDKs from external sources without verifying their integrity. This poses a potential security risk as the downloaded files could be tampered with during transit or at the source (supply chain attack). This change introduces SHA256 checksums for all downloaded artifacts and verifies them before installation. This ensures that the files we receive match exactly what we expect, mitigating the risk of supply chain attacks where malicious actors might try to inject compromised versions of these tools. Signed-off-by: Petr Štetiar <[email protected]>
1 parent 65ee95e commit c20b59a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Dockerfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ RUN \
3131

3232
# Install Simplicity Commander (unfortunately no stable URL available, this
3333
# is known to be working with Commander_linux_x86_64_1v15p0b1306.tar.bz).
34+
ARG SIMPLICITY_COMMANDER_SHA256SUM=ce7b9138c54f4fa0a24c48c8347e55e3e5f8b402d7f32615771bd0403c2d8962
3435
RUN \
3536
curl -O https://www.silabs.com/documents/login/software/SimplicityCommander-Linux.zip \
37+
&& echo "${SIMPLICITY_COMMANDER_SHA256SUM} SimplicityCommander-Linux.zip" | sha256sum -c \
3638
&& unzip -q SimplicityCommander-Linux.zip \
3739
&& tar -C /opt -xjf SimplicityCommander-Linux/Commander_linux_x86_64_*.tar.bz \
3840
&& rm -r SimplicityCommander-Linux \
@@ -41,34 +43,44 @@ RUN \
4143
ENV PATH="$PATH:/opt/commander"
4244

4345
# Install Silicon Labs Configurator (slc)
46+
ARG SLC_CLI_SHA256SUM=da4faa09ef4cbe385da71e5b95a4e444666cf4aaca6066b1095ca13bf5ebf233
4447
RUN \
4548
curl -O https://www.silabs.com/documents/login/software/slc_cli_linux.zip \
49+
&& echo "${SLC_CLI_SHA256SUM} slc_cli_linux.zip" | sha256sum -c \
4650
&& unzip -q -d /opt slc_cli_linux.zip \
4751
&& rm slc_cli_linux.zip
4852

4953
ENV PATH="$PATH:/opt/slc_cli"
5054

5155
# GCC Embedded Toolchain 12.2.rel1 (for Gecko SDK 4.4.0+)
56+
ARG GCC_TOOLCHAIN_SHA256SUM=84be93d0f9e96a15addd490b6e237f588c641c8afdf90e7610a628007fc96867
5257
RUN \
5358
curl -O https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz \
59+
&& echo "${GCC_TOOLCHAIN_SHA256SUM} arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz" | sha256sum -c \
5460
&& tar -C /opt -xf arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz \
5561
&& rm arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi.tar.xz
5662

5763
# Simplicity SDK 2024.6.2
64+
ARG SIMPLICITY_SDK_SHA256SUM=7e4337c7cc68262dd3a83c8528095774634a0478d40b1c1fd2b462e86236af8a
5865
RUN \
5966
curl -o simplicity_sdk_2024.6.2.zip -L https://github.com/SiliconLabs/simplicity_sdk/releases/download/v2024.6.2/gecko-sdk.zip \
67+
&& echo "${SIMPLICITY_SDK_SHA256SUM} simplicity_sdk_2024.6.2.zip" | sha256sum -c \
6068
&& unzip -q -d simplicity_sdk_2024.6.2 simplicity_sdk_2024.6.2.zip \
6169
&& rm simplicity_sdk_2024.6.2.zip
6270

6371
# Gecko SDK 4.4.4
72+
ARG GECKO_SDK_SHA256SUM=831ec7c564df4392b18a8cc8ceb228c114dc3bec604be75807961a4289ee9b20
6473
RUN \
6574
curl -o gecko_sdk_4.4.4.zip -L https://github.com/SiliconLabs/gecko_sdk/releases/download/v4.4.4/gecko-sdk.zip \
75+
&& echo "${GECKO_SDK_SHA256SUM} gecko_sdk_4.4.4.zip" | sha256sum -c \
6676
&& unzip -q -d gecko_sdk_4.4.4 gecko_sdk_4.4.4.zip \
6777
&& rm gecko_sdk_4.4.4.zip
6878

6979
# ZCL Advanced Platform (ZAP) v2024.09.27
80+
ARG ZAP_SHA256SUM=22beeae3cf33b04792be379261d68695b5c96986d3b80700c22b1348f4c0421e
7081
RUN \
7182
curl -o zap_2024.09.27.zip -L https://github.com/project-chip/zap/releases/download/v2024.09.27/zap-linux-x64.zip \
83+
&& echo "${ZAP_SHA256SUM} zap_2024.09.27.zip" | sha256sum -c \
7284
&& unzip -q -d /opt/zap zap_2024.09.27.zip \
7385
&& rm zap_2024.09.27.zip
7486

0 commit comments

Comments
 (0)