Skip to content

jetbrains-jdk: generate cacerts from cacert - #577767

Merged
r-vdp merged 1 commit into
NixOS:masterfrom
irgolic:cacert/jetbrains-jdk
Oct 25, 2026
Merged

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

Conversation

@irgolic

@irgolic irgolic commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Part of #576543.

nixpkgs builds the JetBrains Runtime, jetbrains.jdk and jetbrains.jdk-no-jcef, from source with dontConfigure = true in pkgs/development/compilers/jetbrains-jdk/common.nix. Thus, the preConfigure step of openjdk, which makes lib/security/cacerts from cacert (#576518), is not done. Before this change, the Java trust store, lib/openjdk/lib/security/cacerts, has the list of JetBrains: 109 roots, and AAA Certificate Services and emSign ECC Root CA - G3 are two of them. This change makes a new cacerts from the cacert bundle with jre-generate-cacerts in buildPhase. Then it adds --with-cacerts-file for this file to the options that the mkimages_*.sh script of JetBrains gives to configure. The log of configure shows checking for cacerts file... /build/cacerts-gen/cacerts. After this change, the trust store has 118 roots, the same roots as cacert. The two packages build in the Nix sandbox: jetbrains.jdk-no-jcef in 14 minutes, and jetbrains.jdk in 15 minutes. jetbrains.jdk-21 and jetbrains.jdk-no-jcef-21 use the same common.nix and get the same change, but the harness did not examine them.

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. The harness builds the JDK from source with --force-build. This build is approximately 15 minutes long, and approximately 8 GB of space in the build directory is necessary.

nix run github:irgolic/nix-cacert-harness -- jetbrains.jdk --pr 577767 --emudhra --force-build
Harness output: jetbrains.jdk
$ nix run github:irgolic/nix-cacert-harness -- jetbrains.jdk --base 8915027df75d0403ef013dd0cbf09ff3c602fd03 --after github:irgolic/nixpkgs/34f61387b674b95f752688a9c49f5cc7065f3bc0 --emudhra --force-build
[1/2] static check + eMudhra chains: offline, reproducible
base (before) = 8915027df75d0403ef013dd0cbf09ff3c602fd03
reference: fprs4zi8r6227x12qbsd1grvfrpz6201-nss-cacert-3.131.1 TLS roots=118 all=169
==================================================================
ATTR jetbrains.jdk
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: github:irgolic/nixpkgs/34f61387b674b95f752688a9c49f5cc7065f3bc0
before ok (0 built, 107s)
        drv /nix/store/…-jetbrains-jdk-jcef-25.0.3-b508.4.drv
after  ok (1 built, 894s)
        drv /nix/store/…-jetbrains-jdk-jcef-25.0.3-b508.4.drv

| output:path | before | after |
|---|---|---|
| out:/lib/openjdk/lib/libcef.so | pem: 0 certs readable; scanner: AAA,ECC G3 | pem: 0 certs readable; scanner: AAA,ECC G3 |
| out:/lib/openjdk/lib/security/cacerts | keystore 109 certs: 33 not in cacert, 17 in cacert but not for TLS, 59 cacert TLS roots missing [no-password]; scanner: AAA,ECC G3 | keystore 118 certs == cacert [no-password] |

cacert in runtime closure (before): no
cacert in runtime closure (after): no
CAs trusted before but not trusted for TLS by cacert (50 total), e.g.:
  - CN=AAA Certificate Services, O=Comodo CA Limited, L=Salford, ST=Greater Manchester, C=GB
  - CN=emSign ECC Root CA - G3, O=eMudhra Technologies Limited, OU=emSign PKI, C=IN
  - CN=emSign Root CA - G2, O=eMudhra Technologies Limited, OU=emSign PKI, C=IN
  - CN=AddTrust External CA Root, OU=AddTrust External TTP Network, O=AddTrust AB, C=SE
  - CN=AddTrust Qualified CA Root, OU=AddTrust TTP Network, O=AddTrust AB, C=SE
  - CN=Certigna, O=Dhimyotis, C=FR
  - CN=Certum CA, O=Unizeto Sp. z o.o., C=PL
  - CN=Chambers of Commerce Root - 2008, O=AC Camerfirma S.A., SERIALNUMBER=A82743287, L=Madrid (see current address at www.camerfirma.com/address), C=EU
  - CN=DigiCert Assured ID Root CA, OU=www.digicert.com, O=DigiCert Inc, C=US
VERDICT jetbrains.jdk: NOT FIXED: an after-side store is not equivalent to cacert (see table)

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:/lib/openjdk/lib/libcef.so | n/a (pem: no certificates readable) | n/a (pem: no certificates readable) |
| out:/lib/openjdk/lib/security/cacerts | keystore: accepted 14/14 (g3: 7/7, aaa: 7/7, noct: 2/2) | keystore: accepted 0/14 |
VERDICT jetbrains.jdk emudhra: FIXED: before accepted 14/14 compromised eMudhra chains (g3: 7/7, aaa: 7/7, noct: 2/2); after 0/14; not checkable (no PEM or keystore, e.g. compiled-in roots): 1 before, 1 after store(s)

[2/2] live eMudhra test hosts: needs network, NOT reproducible offline
==================================================================
LIVE jetbrains.jdk: needs network; NOT reproducible offline (the static and behavioral checks are)
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: github:irgolic/nixpkgs/34f61387b674b95f752688a9c49f5cc7065f3bc0
shim: shims/jetbrains.jdk-no-jcef.nix   hosts: https://<host>-emudhra.we-have-a-problem.com/, one request per host per side, 10s timeout
before ok (0 package drvs built, 5s)
        wrapper /nix/store/…-ca-live-jetbrains-jdk
after  ok (0 package drvs built, 6s)
        wrapper /nix/store/…-ca-live-jetbrains-jdk
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  CONNECTED      | OK status=200 cipher=TLS_AES_256_GCM_SHA384
  before dv-g3c      CONNECTED      | OK status=200 cipher=TLS_AES_256_GCM_SHA384
  before dv-g3c-aaa  CONNECTED      | OK status=200 cipher=TLS_AES_256_GCM_SHA384
  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

jetbrains.jdk  (live; before 8915027df75d0403ef013dd0cbf09ff3c602fd03, after github:irgolic/nixpkgs/34f61387b674b95f752688a9c49f5cc7065f3bc0)
         | dv-g3b         | dv-g3b-aaa     | dv-g3c         | dv-g3c-aaa
before   | CONNECTED      | CONNECTED      | CONNECTED      | CONNECTED
after    | REFUSED        | REFUSED        | REFUSED        | REFUSED
VERDICT jetbrains.jdk live: PASS: before CONNECTED to 4/4 host(s) serving a compromised eMudhra chain (dv-g3b,dv-g3b-aaa,dv-g3c,dv-g3c-aaa); 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 JDK accepts all 14 chains (accepted 14/14). Thus, it accepts the eMudhra intermediate certificates through emSign ECC Root CA - G3 and through the Sectigo cross-sign by AAA Certificate Services. After this change, the trust store accepts no chain (accepted 0/14). In the second part of the output, a small Java test on the java of the JDK sends one request to each of four test servers. Before this change, the test connects to all four servers. After this change, the test connects to no server.

The first part of the harness output shows NOT FIXED. The only cause is lib/openjdk/lib/libcef.so, the Chromium of JCEF, which has roots in its compiled code. This change does not change this file. This is the same type of problem as #576544. The harness cannot read these compiled roots, thus the chain test shows n/a for this file. jetbrains.jdk-no-jcef has no libcef.so, and for this package the harness shows FIXED.

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 aoli-al October 23, 2026 11:26
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. llm-assisted Contributions that include code generation with LLMs labels Oct 23, 2026
@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 24, 2026
@r-vdp
r-vdp added this pull request to the merge queue Oct 25, 2026
Merged via the queue into NixOS:master with commit 9f666d0 Oct 25, 2026
35 checks passed
@MarcelCoding MarcelCoding added the backport release-26.05 Backport PR automatically label Nov 8, 2026
@nixpkgs-ci

nixpkgs-ci Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Successfully created backport PR for release-26.05:

@github-actions github-actions Bot added the 8.has: port to stable This PR already has a backport to the stable release. label Nov 8, 2026
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 8.has: port to stable This PR already has a backport to the stable release. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages 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. backport release-26.05 Backport PR automatically llm-assisted Contributions that include code generation with LLMs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants