Skip to content

tlaplus-toolbox: generate the bundled JRE's cacerts from cacert - #577600

Open
irgolic wants to merge 1 commit into
NixOS:masterfrom
irgolic:cacert/tlaplus-toolbox
Open

irgolic wants to merge 1 commit into
NixOS:masterfrom
irgolic:cacert/tlaplus-toolbox

Conversation

@irgolic

@irgolic irgolic commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Part of #576543.

The TLA+ Toolbox, tlaplus-toolbox, uses its bundled Java 14 JRE in libexec/toolbox/plugins/org.lamport.openjdk.linux.x86_64_14.0.1.7/jre, because toolbox.ini sets -vm to this JRE. The Java trust store of this JRE, lib/security/cacerts, has 93 certificates, and 84 of the TLS roots of cacert are not in it. This change makes a new cacerts for this JRE from the cacert bundle with jre-generate-cacerts. The bundled JRE has no keytool, thus the change uses the keytool of jdk_headless at build time.

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 -- tlaplus-toolbox --pr 577600
Harness output: tlaplus-toolbox
$ nix run github:irgolic/nix-cacert-harness -- tlaplus-toolbox --base 8915027df75d0403ef013dd0cbf09ff3c602fd03 --after github:irgolic/nixpkgs/e3b7063ba3640dd800b122295f7a776d8182c80a
base (before) = 8915027df75d0403ef013dd0cbf09ff3c602fd03
reference: fprs4zi8r6227x12qbsd1grvfrpz6201-nss-cacert-3.131.1 TLS roots=118 all=169
==================================================================
ATTR tlaplus-toolbox
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: github:irgolic/nixpkgs/e3b7063ba3640dd800b122295f7a776d8182c80a
before ok (1 built, 84s)
        drv /nix/store/…-tlaplus-toolbox-1.7.4.drv
after  ok (1 built, 240s)
        drv /nix/store/…-tlaplus-toolbox-1.7.4.drv

| output:path | before | after |
|---|---|---|
| out:/libexec/toolbox/plugins/org.lamport.openjdk.linux.x86_64_14.0.1.7/jre/lib/security/cacerts | keystore 93 certs: 45 not in cacert, 14 in cacert but not for TLS, 84 cacert TLS roots missing [no-password]; scanner: AAA | 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 34 files + 228 in archives
  after 34 files + 228 in archives

cacert in runtime closure (before): no
cacert in runtime closure (after): no
CAs trusted before but not trusted for TLS by cacert (59 total), e.g.:
  - CN=AAA Certificate Services, O=Comodo CA Limited, L=Salford, ST=Greater Manchester, C=GB
  - CN=AddTrust Class 1 CA Root, OU=AddTrust TTP Network, O=AddTrust AB, C=SE
  - 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=AffirmTrust Commercial, O=AffirmTrust, C=US
  - CN=AffirmTrust Networking, O=AffirmTrust, C=US
  - CN=AffirmTrust Premium ECC, O=AffirmTrust, C=US
VERDICT tlaplus-toolbox: FIXED: before trusted CAs outside cacert; after: 1 store(s) == cacert, none with extra CAs

base=8915027df75d0403ef013dd0cbf09ff3c602fd03 shim=shims/tlaplus-toolbox.nix
  package derivations to build for the matrix: 1 tlaplus-toolbox-1.7.4.drv
  before-stock: REFUSED -> /nix/store/…-ca-behave-tlaplus-toolbox-stock
  before-test: REFUSED -> /nix/store/…-ca-behave-tlaplus-toolbox-test
  after-stock: REFUSED -> /nix/store/…-ca-behave-tlaplus-toolbox-stock
  after-test: CONNECTED -> /nix/store/…-ca-behave-tlaplus-toolbox-test

tlaplus-toolbox  (before 8915027df75d0403ef013dd0cbf09ff3c602fd03, after github:irgolic/nixpkgs/e3b7063ba3640dd800b122295f7a776d8182c80a)
         | 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 tlaplus-toolbox: 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 the package again. Then a small Java test starts the bundled JRE and 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: 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. 9.needs: reviewer This PR currently has no reviewers requested and needs attention. llm-assisted Contributions that include code generation with LLMs 7.no default reviewers This PR targets a package or module with no existing maintainers; roving reviewers, take pity! labels Oct 23, 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 7.no default reviewers This PR targets a package or module with no existing maintainers; roving reviewers, take pity! 9.needs: reviewer This PR currently has no reviewers requested and needs attention. 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. llm-assisted Contributions that include code generation with LLMs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant