Skip to content

eclipses: generate the bundled JustJ JRE's cacerts from cacert - #577595

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

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

Conversation

@irgolic

@irgolic irgolic commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Part of #576543.

The Eclipse packages eclipses.eclipse-committers, -cpp, -dsl, -embedcpp, -java, -jee, -modeling and -rcp have a bundled JustJ JRE in eclipse/plugins/org.eclipse.justj.openjdk.*/jre. This change in build-eclipse.nix makes a new lib/security/cacerts for this JRE from the cacert bundle with jre-generate-cacerts and the keytool of jdk. Eclipse uses jdk (jdk25) and not this JRE, because build-eclipse.nix removes the JustJ -vm line from eclipse.ini. Thus, this change has an effect only when a different tool starts the bundled JRE. In #576543, the "+1 more" file of each package is a javadoc example in jre/lib/src.zip, not a trust store. eclipse-platform and eclipse-sdk have no JustJ 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. The other seven packages get the same change from build-eclipse.nix.

nix run github:irgolic/nix-cacert-harness -- eclipses.eclipse-java --pr <this PR>
Harness output: eclipses.eclipse-java
$ nix run github:irgolic/nix-cacert-harness -- eclipses.eclipse-java --base 8915027df75d0403ef013dd0cbf09ff3c602fd03 --after github:irgolic/nixpkgs/ff12820b84025631641ac710ea026f2d1f932c77
base (before) = 8915027df75d0403ef013dd0cbf09ff3c602fd03
reference: fprs4zi8r6227x12qbsd1grvfrpz6201-nss-cacert-3.131.1 TLS roots=118 all=169
==================================================================
ATTR eclipses.eclipse-java
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: github:irgolic/nixpkgs/ff12820b84025631641ac710ea026f2d1f932c77
before ok (0 built, 3s)
        drv /nix/store/…-eclipse-java-4.41.drv
after  ok (0 built, 4s)
        drv /nix/store/…-eclipse-java-4.41.drv

| output:path | before | after |
|---|---|---|
| out:/eclipse/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.linux.x86_64_25.0.4.v20260826-0822/jre/lib/security/cacerts | keystore 118 certs: 4 not in cacert, 1 in cacert but not for TLS, 5 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 56 files + 416 in archives
  after 56 files + 416 in archives

cacert in runtime closure (before): no
cacert in runtime closure (after): no
CAs trusted before but not trusted for TLS by cacert (5 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
  - OU=ePKI Root Certification Authority, O="Chunghwa Telecom Co., Ltd.", C=TW
VERDICT eclipses.eclipse-java: FIXED: before trusted CAs outside cacert; after: 1 store(s) == cacert, none with extra CAs

base=8915027df75d0403ef013dd0cbf09ff3c602fd03 shim=shims/eclipses.eclipse-java.nix
  package derivations to build for the matrix: 0
  before-stock: REFUSED -> /nix/store/…-ca-behave-eclipses-eclipse-java-stock
  before-test: REFUSED -> /nix/store/…-ca-behave-eclipses-eclipse-java-test
  after-stock: REFUSED -> /nix/store/…-ca-behave-eclipses-eclipse-java-stock
  after-test: CONNECTED -> /nix/store/…-ca-behave-eclipses-eclipse-java-test

eclipses.eclipse-java  (before 8915027df75d0403ef013dd0cbf09ff3c602fd03, after github:irgolic/nixpkgs/ff12820b84025631641ac710ea026f2d1f932c77)
         | stock cacert | + test root  | override with test-root cacert
before   | REFUSED      | REFUSED      | NO-OP (package does not take cacert)
after    | REFUSED      | CONNECTED    | yes (rebuilt with cacert + test root)
control (before cells): curl --cacert test-root: CONNECTED, curl --cacert stock: REFUSED
VERDICT eclipses.eclipse-java: PASS: after-fix trust follows cacert; before-fix ignores it

In the second part of the output, the harness adds a temporary test root to cacert and builds eclipse-java again. Then a small Java test starts the bundled JustJ JRE and sends a request to a local openssl s_server 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. The certificate of this server chains to the test root. Before this change, cacert has no effect on the result. After this change, it has an effect. 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)
@zimbatm zimbatm mentioned this pull request Oct 23, 2026
28 of 37 tasks
@irgolic irgolic added the 1.severity: security Issues which raise a security issue, or PRs that fix one label Oct 23, 2026
@nixpkgs-ci
nixpkgs-ci Bot requested a review from jerith666 October 23, 2026 01:11
@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. llm-assisted Contributions that include code generation with LLMs labels Oct 23, 2026

@jerith666 jerith666 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bundled JRE can't run on NixOS anyway, but I suppose it's worth patching in case someone using nix-packaged eclipse outside of NixOS happens to execute it somehow.

I confirmed this builds locally and I can still launch eclipse.

Comment on lines +119 to +123
pushd "$(dirname "$cacerts")"
rm cacerts
JAVA_TOOL_OPTIONS="-Dkeystore.pkcs12.certProtectionAlgorithm=NONE -Dkeystore.pkcs12.macAlgorithm=NONE" \
${jre-generate-cacerts} ${jdk}/bin/keytool ${cacert}/etc/ssl/certs/ca-bundle.crt
popd

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I usually prefer (cd x; ...) to pushd x; ...; popd, but either works:

Suggested change
pushd "$(dirname "$cacerts")"
rm cacerts
JAVA_TOOL_OPTIONS="-Dkeystore.pkcs12.certProtectionAlgorithm=NONE -Dkeystore.pkcs12.macAlgorithm=NONE" \
${jre-generate-cacerts} ${jdk}/bin/keytool ${cacert}/etc/ssl/certs/ca-bundle.crt
popd
(
cd "$(dirname "$cacerts")"
rm cacerts
JAVA_TOOL_OPTIONS="-Dkeystore.pkcs12.certProtectionAlgorithm=NONE -Dkeystore.pkcs12.macAlgorithm=NONE" \
${jre-generate-cacerts} ${jdk}/bin/keytool ${cacert}/etc/ssl/certs/ca-bundle.crt
)

@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 commented Oct 23, 2026

Copy link
Copy Markdown
Member Author

Replaced with the cd variant!

@jerith666 jerith666 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@r-vdp
r-vdp added this pull request to the merge queue Oct 27, 2026
Merged via the queue into NixOS:master with commit 9d5f635 Oct 27, 2026
29 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. 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