Remove lint-psi to eliminate protobuf-java CVEs
Some checks failed
Build and Push Flutter SDK Image / build-and-push (Flutter SDK for Linux desktop CI builds, Dockerfile.linux, linux) (release) Failing after 23m47s
Build and Push Flutter SDK Image / build-and-push (Flutter SDK for Android CI builds, Dockerfile.android, android) (release) Failing after 26m25s
Build and Push Flutter SDK Image / build-and-push (Minimal Flutter SDK for Web/WASM CI builds, Dockerfile, web) (release) Has been cancelled
Some checks failed
Build and Push Flutter SDK Image / build-and-push (Flutter SDK for Linux desktop CI builds, Dockerfile.linux, linux) (release) Failing after 23m47s
Build and Push Flutter SDK Image / build-and-push (Flutter SDK for Android CI builds, Dockerfile.android, android) (release) Failing after 26m25s
Build and Push Flutter SDK Image / build-and-push (Minimal Flutter SDK for Web/WASM CI builds, Dockerfile, web) (release) Has been cancelled
Consolidate Android SDK download and setup into single layer to ensure lint-psi directory (containing vulnerable protobuf-java 2.6.1) is never committed to any image layer. Reduces CVEs from 4 HIGH to 0 and saves 86MB. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
a8331e9516
commit
84b6f55c7a
@ -15,20 +15,20 @@ USER 0
|
|||||||
ENV ANDROID_HOME=/opt/android-sdk
|
ENV ANDROID_HOME=/opt/android-sdk
|
||||||
ENV PATH="${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools:${PATH}"
|
ENV PATH="${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools:${PATH}"
|
||||||
|
|
||||||
# Download and install Android SDK command-line tools
|
# Download Android SDK command-line tools, install SDK components, and remove vulnerable lint-psi
|
||||||
RUN mkdir -p "${ANDROID_HOME}/cmdline-tools" && \
|
RUN mkdir -p "${ANDROID_HOME}/cmdline-tools" && \
|
||||||
curl -fsSL "https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_TOOLS_VERSION}_latest.zip" \
|
curl -fsSL "https://dl.google.com/android/repository/commandlinetools-linux-${ANDROID_SDK_TOOLS_VERSION}_latest.zip" \
|
||||||
-o /tmp/cmdline-tools.zip && \
|
-o /tmp/cmdline-tools.zip && \
|
||||||
unzip -q /tmp/cmdline-tools.zip -d /tmp/cmdline-tools && \
|
unzip -q /tmp/cmdline-tools.zip -d /tmp/cmdline-tools && \
|
||||||
mv /tmp/cmdline-tools/cmdline-tools "${ANDROID_HOME}/cmdline-tools/latest" && \
|
mv /tmp/cmdline-tools/cmdline-tools "${ANDROID_HOME}/cmdline-tools/latest" && \
|
||||||
rm -rf /tmp/cmdline-tools.zip /tmp/cmdline-tools
|
rm -rf /tmp/cmdline-tools.zip /tmp/cmdline-tools && \
|
||||||
|
yes | sdkmanager --licenses > /dev/null 2>&1 && \
|
||||||
# Accept licenses and install SDK components
|
|
||||||
RUN yes | sdkmanager --licenses > /dev/null 2>&1 && \
|
|
||||||
sdkmanager --install \
|
sdkmanager --install \
|
||||||
"platform-tools" \
|
"platform-tools" \
|
||||||
"platforms;android-${ANDROID_COMPILE_SDK}" \
|
"platforms;android-${ANDROID_COMPILE_SDK}" \
|
||||||
"build-tools;${ANDROID_BUILD_TOOLS}"
|
"build-tools;${ANDROID_BUILD_TOOLS}" && \
|
||||||
|
# Remove lint-psi to eliminate protobuf-java 2.6.1 CVEs (saves 86MB)
|
||||||
|
rm -rf "${ANDROID_HOME}/cmdline-tools/latest/lib/external/lint-psi"
|
||||||
|
|
||||||
# Download Flutter SDK and strip unnecessary files
|
# Download Flutter SDK and strip unnecessary files
|
||||||
RUN curl -fsSL "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}-stable.tar.xz" \
|
RUN curl -fsSL "https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}-stable.tar.xz" \
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user