Skip to content

tracecompass: generate the bundled JustJ JRE's cacerts from cacert - #577599

Merged
r-vdp merged 1 commit into
NixOS:masterfrom
irgolic:cacert/tracecompass
Oct 27, 2026
Merged

r-vdp merged 1 commit into
NixOS:masterfrom
irgolic:cacert/tracecompass

Conversation

@irgolic

@irgolic irgolic commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Part of #576543.

Trace Compass, tracecompass, has a bundled JustJ JRE in trace-compass/plugins/org.eclipse.justj.openjdk.*/jre. The Java trust store of this JRE, lib/security/cacerts, has 146 certificates, and 23 of them are not in cacert. This change makes a new cacerts for this JRE from the cacert bundle with jre-generate-cacerts and the keytool of jdk21. Trace Compass uses jdk21 and not this JRE, because the package adds a -vm line for jdk21 to tracecompass.ini. Thus, this change has an effect only when a different tool starts the bundled JRE.

Warning

AI Disclosure: Claude Code made the code change, the commit message and the first version of this pull request description. Claude Code used Claude Fable 5.1 and Claude Opus 5.5. I examined all of this work. Claude Code also wrote all of nix-cacert-harness. This pull request description is written in ASD-STE100 (Simplified Technical English), examined with memelint in strict mode.

Test

nix-cacert-harness examines the package before and after this change. A local copy of nixpkgs is not necessary.

nix run github:irgolic/nix-cacert-harness -- tracecompass --pr 577599 --emudhra
Harness output: tracecompass
$ nix run github:irgolic/nix-cacert-harness -- tracecompass --base 8915027df75d0403ef013dd0cbf09ff3c602fd03 --after github:irgolic/nixpkgs/512e124bc8dbf0ddacb9a340682996d1e0f95edf --emudhra
[1/2] static check + eMudhra chains: offline, reproducible
base (before) = 8915027df75d0403ef013dd0cbf09ff3c602fd03
reference: fprs4zi8r6227x12qbsd1grvfrpz6201-nss-cacert-3.131.1 TLS roots=118 all=169
==================================================================
ATTR tracecompass
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: github:irgolic/nixpkgs/512e124bc8dbf0ddacb9a340682996d1e0f95edf
before ok (0 built, 3s)
        drv /nix/store/…-tracecompass-11.2.0.drv
after  ok (1 built, 50s)
        drv /nix/store/…-tracecompass-11.2.0.drv

| output:path | before | after |
|---|---|---|
| out:/trace-compass/plugins/org.eclipse.justj.openjdk.hotspot.jre.minimal.stripped.linux.x86_64_21.0.9.v20251105-0741/jre/lib/security/cacerts | keystore 146 certs: 23 not in cacert, 12 in cacert but not for TLS, 7 cacert TLS roots missing [no-password]; scanner: ECC G3 | keystore 118 certs == cacert [no-password] |

jar signature blocks (META-INF/*.RSA|DSA|EC: code-signing certificate chains, not trust stores; not counted; listed in static/<side>/sigblocks.tsv):
  before 37 files + 293 in archives
  after 37 files + 293 in archives

cacert in runtime closure (before): no
cacert in runtime closure (after): no
CAs trusted before but not trusted for TLS by cacert (35 total), e.g.:
  - CN=emSign ECC Root CA - C3, O=eMudhra Inc, OU=emSign PKI, C=US
  - CN=emSign ECC Root CA - G3, O=eMudhra Technologies Limited, OU=emSign PKI, C=IN
  - CN=emSign Root CA - C1, O=eMudhra Inc, OU=emSign PKI, C=US
  - C=DE, O=Atos, CN=Atos TrustedRoot 2011
  - CN=AffirmTrust Commercial, O=AffirmTrust, C=US
  - CN=AffirmTrust Networking, O=AffirmTrust, C=US
  - CN=AffirmTrust Premium ECC, O=AffirmTrust, C=US
  - CN=AffirmTrust Premium, O=AffirmTrust, C=US
  - CN=Certigna, O=Dhimyotis, C=FR
VERDICT tracecompass: FIXED: before trusted CAs outside cacert; after: 1 store(s) == cacert, none with extra CAs

eMudhra chains (--emudhra; offline and reproducible): the 14 chains in fixtures/emudhra,
each leaf verified against each store (openssl verify -purpose sslserver, at 2026-10-23):
| output:path | before | after |
|---|---|---|
| out:/trace-compass/plugins/org.eclipse.justj.openjdk.hotspot.jre.minimal.stripped.linux.x86_64_21.0.9.v20251105-0741/jre/lib/security/cacerts | keystore: accepted 7/14 (g3: 7/7, aaa: 0/7, noct: 1/2) | keystore: accepted 0/14 |
VERDICT tracecompass emudhra: FIXED: before accepted 7/14 compromised eMudhra chains (g3: 7/7, aaa: 0/7, noct: 1/2); after 0/14

[2/2] live eMudhra test hosts: needs network, NOT reproducible offline
==================================================================
LIVE tracecompass: needs network; NOT reproducible offline (the static and behavioral checks are)
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: github:irgolic/nixpkgs/512e124bc8dbf0ddacb9a340682996d1e0f95edf
shim: shims/tracecompass.nix   hosts: https://<host>-emudhra.we-have-a-problem.com/, one request per host per side, 10s timeout
before ok (0 package drvs built, 7s)
        wrapper /nix/store/…-ca-live-tracecompass
after  ok (0 package drvs built, 9s)
        wrapper /nix/store/…-ca-live-tracecompass
system store: visible: /etc/ssl/certs/ca-certificates.crt -> nss-cacert-3.126/etc/ssl/certs/ca-bundle.crt /etc/pki/tls/certs/ca-bundle.crt -> nss-cacert-3.126/etc/ssl/certs/ca-bundle.crt
              rejects every served chain, so it cannot make a cell CONNECTED
              but it holds the root of dv-g3b,dv-g3b-aaa,dv-g3c,dv-g3c-aaa with a trust rule that REJECTS it (OpenSSL "certificate rejected"):
              a program that loads it next to its own store (OpenSSL's default paths, e.g. excon) is
              REFUSED there whatever its own store says; --no-system-store shows the package's store alone
control dv-g3b: ok: HTTP 200, served chain == fixtures/emudhra/dv-g3b-emudhra.we-have-a-problem.com.pem (3 certs, valid for the host up to emSign ECC Root CA - G3), stock cacert rejects it
control dv-g3b-aaa: ok: HTTP 200, served chain == fixtures/emudhra/dv-g3b-aaa-emudhra.we-have-a-problem.com.pem (2 certs, valid for the host up to AAA Certificate Services), stock cacert rejects it
control dv-g3c: ok: HTTP 200, served chain == fixtures/emudhra/dv-g3c-emudhra.we-have-a-problem.com.pem (3 certs, valid for the host up to emSign ECC Root CA - G3), stock cacert rejects it
control dv-g3c-aaa: ok: HTTP 200, served chain == fixtures/emudhra/dv-g3c-aaa-emudhra.we-have-a-problem.com.pem (2 certs, valid for the host up to AAA Certificate Services), stock cacert rejects it
  before dv-g3b      CONNECTED      | OK status=200 cipher=TLS_AES_256_GCM_SHA384
  before dv-g3b-aaa  REFUSED        | Exception in thread "main" javax.net.ssl.SSLHandshakeException: (certificate_unknown) PKIX path building failed: sun.security.provider.certpath.SunCertPathBuild
  before dv-g3c      CONNECTED      | OK status=200 cipher=TLS_AES_256_GCM_SHA384
  before dv-g3c-aaa  REFUSED        | Exception in thread "main" javax.net.ssl.SSLHandshakeException: (certificate_unknown) PKIX path building failed: sun.security.provider.certpath.SunCertPathBuild
  after  dv-g3b      REFUSED        | Exception in thread "main" javax.net.ssl.SSLHandshakeException: (certificate_unknown) PKIX path building failed: sun.security.provider.certpath.SunCertPathBuild
  after  dv-g3b-aaa  REFUSED        | Exception in thread "main" javax.net.ssl.SSLHandshakeException: (certificate_unknown) PKIX path building failed: sun.security.provider.certpath.SunCertPathBuild
  after  dv-g3c      REFUSED        | Exception in thread "main" javax.net.ssl.SSLHandshakeException: (certificate_unknown) PKIX path building failed: sun.security.provider.certpath.SunCertPathBuild
  after  dv-g3c-aaa  REFUSED        | Exception in thread "main" javax.net.ssl.SSLHandshakeException: (certificate_unknown) PKIX path building failed: sun.security.provider.certpath.SunCertPathBuild

tracecompass  (live; before 8915027df75d0403ef013dd0cbf09ff3c602fd03, after github:irgolic/nixpkgs/512e124bc8dbf0ddacb9a340682996d1e0f95edf)
         | dv-g3b         | dv-g3b-aaa     | dv-g3c         | dv-g3c-aaa
before   | CONNECTED      | REFUSED        | CONNECTED      | REFUSED
after    | REFUSED        | REFUSED        | REFUSED        | REFUSED
VERDICT tracecompass live: PASS: before CONNECTED to 2/4 host(s) serving a compromised eMudhra chain (dv-g3b,dv-g3c); after REFUSED on all 4

The harness tests the package with the 14 certificate chains of the eMudhra incident, from https://emudhra.we-have-a-problem.com/ (only the certificates, not the keys). Before this change, the trust store of the bundled JustJ JRE accepts 7 of the 14 chains (accepted 7/14). Thus, it accepts the eMudhra intermediate certificates through emSign ECC Root CA - G3. After this change, the trust store accepts no chain (accepted 0/14). In the second part of the output, a small Java test starts the bundled JustJ JRE. The test sends one request to each of four test servers with HttpsURLConnection and the default trust store. The package does not patch this JRE, thus the test starts its bin/java through the dynamic loader of nixpkgs. Before this change, the test connects to the two servers with the G3 chain. After this change, the test connects to no server. The harness compares the certificates by their SHA-256 fingerprints, because jre-generate-cacerts does not keep the usual aliases.

Things done

Assisted-by: Claude Code (Claude Fable 5.1)
Assisted-by: Claude Code (Claude Opus 5.5)
@irgolic irgolic added the 1.severity: security Issues which raise a security issue, or PRs that fix one label Oct 23, 2026
@zimbatm zimbatm mentioned this pull request Oct 23, 2026
28 of 37 tasks
@nixpkgs-ci
nixpkgs-ci Bot requested a review from lvanasse October 23, 2026 01:16
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. llm-assisted Contributions that include code generation with LLMs labels Oct 23, 2026
@lvanasse

Copy link
Copy Markdown
Contributor

I had issue with the software but it wasn't related to the PR. So should be fine to merge. I'll make another that fixes the issue.

@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Oct 23, 2026
@irgolic
irgolic force-pushed the cacert/tracecompass branch from 62ddcd7 to 512e124 Compare October 23, 2026 14:10
@irgolic

irgolic commented Oct 23, 2026 •

Copy link
Copy Markdown
Member Author

FYI just rewrote the change with cd instead of pushd popd, seems like most maintainers preferred that formulation

diff --git a/pkgs/by-name/tr/tracecompass/package.nix b/pkgs/by-name/tr/tracecompass/package.nix
index 309d102fb..fdb6b183e 100644
--- a/pkgs/by-name/tr/tracecompass/package.nix
+++ b/pkgs/by-name/tr/tracecompass/package.nix
@@ -80,13 +80,14 @@ stdenv.mkDerivation (finalAttrs: rec {

     patchelf --set-interpreter "${stdenv.cc.bintools.dynamicLinker}" $out/trace-compass/tracecompass

     # regenerate the bundled JustJ JRE's CA keystore from cacert, as openjdk does
-    pushd $out/trace-compass/plugins/org.eclipse.justj.openjdk.*/jre/lib/security
-    rm cacerts
-    JAVA_TOOL_OPTIONS="-Dkeystore.pkcs12.certProtectionAlgorithm=NONE -Dkeystore.pkcs12.macAlgorithm=NONE" \
-      ${jre-generate-cacerts} ${jdk21}/bin/keytool ${cacert}/etc/ssl/certs/ca-bundle.crt
-    popd
+    (
+      cd $out/trace-compass/plugins/org.eclipse.justj.openjdk.*/jre/lib/security
+      rm cacerts
+      JAVA_TOOL_OPTIONS="-Dkeystore.pkcs12.certProtectionAlgorithm=NONE -Dkeystore.pkcs12.macAlgorithm=NONE" \
+        ${jre-generate-cacerts} ${jdk21}/bin/keytool ${cacert}/etc/ssl/certs/ca-bundle.crt
+    )

     mkdir -p $out/bin
     makeWrapper $out/trace-compass/tracecompass $out/bin/tracecompass \
       --prefix PATH : ${lib.makeBinPath [ jdk21 ]} \

lvanasse added a commit to lvanasse/nixpkgs that referenced this pull request Oct 25, 2026
Create the shell launcher during installation, then add the GApps
environment in preFixup. This preserves the installPhase insertion point
used by NixOS#577599 while keeping the GSettings smoke check working.

Assisted-by: OpenAI Codex (GPT-6)
@r-vdp
r-vdp added this pull request to the merge queue Oct 27, 2026
Merged via the queue into NixOS:master with commit 7f34250 Oct 27, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.severity: security Issues which raise a security issue, or PRs that fix one 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. llm-assisted Contributions that include code generation with LLMs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants