Repository navigation
Stop trusting compromised eMudhra roots in the exploration-tests image #13026
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,11 @@ | ||
| FROM debian:bookworm-slim | ||
|
|
||
| RUN apt-get update && \ | ||
| DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates && \ | ||
| apt-get install -y --only-upgrade ca-certificates && \ | ||
| update-ca-certificates -f && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN apt-get update && \ | ||
| DEBIAN_FRONTEND=noninteractive apt-get install -y procps tini build-essential git curl unzip zip && \ | ||
| apt-get -y clean && \ | ||
|
|
@@ -50,3 +56,21 @@ RUN git clone -b okhttp_5.3.x https://github.com/square/okhttp.git | |
| COPY okhttp_exploration-tests.patch . | ||
| RUN cd okhttp && git apply /exploration-tests/okhttp_exploration-tests.patch | ||
| RUN bash -c "source $HOME/.sdkman/bin/sdkman-init.sh && sdk use java 17.0.10-tem && cd okhttp && ./gradlew dependencies" | ||
|
|
||
| # Remove compromised CA entries from every SDKMAN and Gradle-provisioned JDK. | ||
| RUN set -eu; \ | ||
| mkdir -p "$HOME/.gradle/jdks"; \ | ||
| keytool="$HOME/.sdkman/candidates/java/17.0.10-tem/bin/keytool"; \ | ||
| find "$HOME/.sdkman/candidates/java" "$HOME/.gradle/jdks" -type f -path '*/lib/security/cacerts' | \ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In the OkHttp job, Useful? React with 👍 / 👎. |
||
| while IFS= read -r store; do \ | ||
| "$keytool" -list -v -keystore "$store" -storepass changeit | \ | ||
| awk '/^Alias name: / { alias = substr($0, 13) } /^Owner: .*([eE]mSign ECC Root CA - G3|AAA Certificate Services)/ { print alias }' | \ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For the pinned Java 17.0.10 installation, this predicate leaves Useful? React with 👍 / 👎. |
||
| while IFS= read -r alias; do \ | ||
| "$keytool" -delete -keystore "$store" -storepass changeit -alias "$alias"; \ | ||
| done; \ | ||
| done | ||
|
|
||
| # Do not publish Gradle's generated API jar with its old embedded CA snapshot. | ||
| RUN if [ -d "$HOME/.gradle/caches" ]; then \ | ||
| find "$HOME/.gradle/caches" -type f -path '*/generated-gradle-jars/gradle-api-*.jar' -delete; \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
After the okhttp warm-up, Gradle's cached distribution retains google-api-client-*.jar, whose embedded google.p12 truststore contains AAA Certificate Services. Gradle's GCS transport uses this store independently of JDK cacerts. Deleting the generated API jar therefore leaves the root trusted and permits regeneration of the same CA snapshot. Sanitize the source truststore as well as removing generated copies. React: 👍 useful · 👎 wrong · 😕 unclear · 👀 right, but not acting on it What each reaction means
🤖 Bits Code Review · Open Bits AI session |
||
| fi | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This cleanup runs only after the Maven dependency resolutions at lines 31, 39, and 44 and the Gradle resolution at line 58, so those downloads use the newly installed standalone JDK stores before the required root removals. In the compromised-CA attack scenario this change addresses, a forged repository certificate can therefore inject artifacts into the image's warmed caches, and deleting the trust anchors afterward does not remove those artifacts. Scrub the SDKMAN JDKs immediately after installation, then separately repeat the cleanup after any later toolchain provisioning.
Useful? React with 👍 / 👎.