Skip to content

graalvm-ce: generate cacerts from cacert - #577604

Open
irgolic wants to merge 1 commit into
NixOS:masterfrom
irgolic:cacert/graalvm-ce
Open

irgolic wants to merge 1 commit into
NixOS:masterfrom
irgolic:cacert/graalvm-ce

Conversation

@irgolic

@irgolic irgolic commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Part of #576543.

GraalVM CE, graalvmPackages.graalvm-ce, is a binary JDK with a bundled Java trust store, lib/security/cacerts. This trust store has 111 certificates, and 33 of them are not in cacert. This change makes a new cacerts with 118 certificates from the cacert bundle with jre-generate-cacerts, as the merged openjdk change #576518 does. The change uses the keytool of the package, and autoPatchelf must patch this keytool before it can operate. Thus, the change sets dontAutoPatchelf = true, and postFixup does autoPatchelf before it makes the new cacerts. graalvm-oracle uses the same buildGraalvm.nix, but the harness did not examine graalvm-oracle.

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 -- graalvmPackages.graalvm-ce --pr 577604
Harness output: graalvmPackages.graalvm-ce
$ nix run github:irgolic/nix-cacert-harness -- graalvmPackages.graalvm-ce --base 8915027df75d0403ef013dd0cbf09ff3c602fd03 --after github:irgolic/nixpkgs/3961f527a2230734f10ea70cc22cb8890e7f4cbc
base (before) = 8915027df75d0403ef013dd0cbf09ff3c602fd03
reference: fprs4zi8r6227x12qbsd1grvfrpz6201-nss-cacert-3.131.1 TLS roots=118 all=169
==================================================================
ATTR graalvmPackages.graalvm-ce
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: github:irgolic/nixpkgs/3961f527a2230734f10ea70cc22cb8890e7f4cbc
before ok (0 built, 1s)
        drv /nix/store/…-graalvm-ce-25.4.4.1.1.drv
after  ok (0 built, 1s)
        drv /nix/store/…-graalvm-ce-25.4.4.1.1.drv

| output:path | before | after |
|---|---|---|
| out:/lib/libnative-image-agent.so | pem: 0 certs readable; scanner: AAA,ECC G3 | pem: 0 certs readable; scanner: AAA,ECC G3 |
| out:/lib/security/cacerts | keystore 111 certs: 33 not in cacert, 17 in cacert but not for TLS, 57 cacert TLS roots missing [no-password]; scanner: AAA,ECC G3 | keystore 118 certs == cacert [no-password] |
| out:/lib/svm/bin/native-image | pem: 0 certs readable; scanner: AAA,ECC G3 | pem: 0 certs readable; scanner: AAA,ECC G3 |

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 graalvmPackages.graalvm-ce: NOT FIXED: an after-side store is not equivalent to cacert (see table)

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

graalvmPackages.graalvm-ce  (before 8915027df75d0403ef013dd0cbf09ff3c602fd03, after github:irgolic/nixpkgs/3961f527a2230734f10ea70cc22cb8890e7f4cbc)
         | 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 graalvmPackages.graalvm-ce: PASS: after-fix trust follows cacert; before-fix ignores it

The first part of the harness output shows NOT FIXED. The cause is two binary files, lib/svm/bin/native-image and lib/libnative-image-agent.so. Each of these files has a compiled list of 99 roots, and this change does not change them. These two files are in #576544, and only a build from source can repair them. In the second part of the output, the result is PASS.

In the second part of the output, the harness adds a temporary test root to cacert and builds the JDK again. Then a small Java test sends a request to a local openssl s_server with HttpsURLConnection and the default trust store. 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)
@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 added 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. llm-assisted Contributions that include code generation with LLMs 6.topic: java Including JDK, tooling, other languages, other VMs labels Oct 23, 2026
@umbrageodotus

Copy link
Copy Markdown
Contributor

Is this needed for normal graalvm-oracle as well?

@irgolic

irgolic commented Oct 24, 2026

Copy link
Copy Markdown
Member Author

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 6.topic: java Including JDK, tooling, other languages, other VMs 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. llm-assisted Contributions that include code generation with LLMs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants