Skip to content

scilab-bin: generate cacerts from cacert - #577770

Open
irgolic wants to merge 1 commit into
NixOS:masterfrom
irgolic:cacert/scilab-bin
Open

irgolic wants to merge 1 commit into
NixOS:masterfrom
irgolic:cacert/scilab-bin

Conversation

@irgolic

@irgolic irgolic commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Part of #576543.

Scilab, scilab-bin, has a bundled Temurin JRE in thirdparty/java. The scilab launcher sets JRE_HOME to this JRE, and the scilab-bin executable uses the JVM of this JRE. The Java trust store of this JRE, lib/security/cacerts, has 144 certificates, and 19 of them are not in cacert. This change makes a new cacerts with 118 certificates from the cacert bundle with jre-generate-cacerts and the bundled keytool. 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.

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 -- scilab-bin --pr 577770 --emudhra
Harness output: scilab-bin
$ nix run github:irgolic/nix-cacert-harness -- scilab-bin --base 8915027df75d0403ef013dd0cbf09ff3c602fd03 --after github:irgolic/nixpkgs/89afd381a888d7497fdedc57bbd0815d9b837514 --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 scilab-bin
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: github:irgolic/nixpkgs/89afd381a888d7497fdedc57bbd0815d9b837514
before ok (0 built, 1s)
        drv /nix/store/…-scilab-bin-2027.0.0.drv
after  ok (0 built, 1s)
        drv /nix/store/…-scilab-bin-2027.0.0.drv

| output:path | before | after |
|---|---|---|
| out:/lib/thirdparty/jcef/libcef.so | pem: 0 certs readable; scanner: AAA,ECC G3 | pem: 0 certs readable; scanner: AAA,ECC G3 |
| out:/thirdparty/java/lib/security/cacerts | keystore 144 certs: 19 not in cacert, 12 in cacert but not for TLS, 5 cacert TLS roots missing [no-password]; scanner: ECC G3 | keystore 118 certs == cacert [no-password] |

inside archives (scanner only; a symlink in the installed output cannot reach them, issue #576542 class):
  before out:/thirdparty/flatlaf-3.4.1.jar!com/formdev/flatlaf/natives/flatlaf-windows-x86.dll  roots=3 trusts AAA Certificate Services
  before out:/thirdparty/flatlaf-3.4.1.jar!com/formdev/flatlaf/natives/libflatlaf-macos-x86_64.dylib  roots=1 trusts AAA Certificate Services
  before out:/thirdparty/flatlaf-3.4.1.jar!com/formdev/flatlaf/natives/flatlaf-windows-x86_64.dll  roots=3 trusts AAA Certificate Services
  before out:/thirdparty/flatlaf-3.4.1.jar!com/formdev/flatlaf/natives/flatlaf-windows-arm64.dll  roots=3 trusts AAA Certificate Services
  before out:/thirdparty/flatlaf-3.4.1.jar!com/formdev/flatlaf/natives/libflatlaf-macos-arm64.dylib  roots=1 trusts AAA Certificate Services
  after  out:/thirdparty/flatlaf-3.4.1.jar!com/formdev/flatlaf/natives/flatlaf-windows-x86.dll  roots=3 trusts AAA Certificate Services
  after  out:/thirdparty/flatlaf-3.4.1.jar!com/formdev/flatlaf/natives/libflatlaf-macos-x86_64.dylib  roots=1 trusts AAA Certificate Services
  after  out:/thirdparty/flatlaf-3.4.1.jar!com/formdev/flatlaf/natives/flatlaf-windows-x86_64.dll  roots=3 trusts AAA Certificate Services
  after  out:/thirdparty/flatlaf-3.4.1.jar!com/formdev/flatlaf/natives/flatlaf-windows-arm64.dll  roots=3 trusts AAA Certificate Services
  after  out:/thirdparty/flatlaf-3.4.1.jar!com/formdev/flatlaf/natives/libflatlaf-macos-arm64.dylib  roots=1 trusts AAA Certificate Services

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

cacert in runtime closure (before): no
cacert in runtime closure (after): no
CAs trusted before but not trusted for TLS by cacert (31 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 scilab-bin: NOT FIXED: an after-side store is not equivalent to cacert (see table) (+ bundles inside archives remain, see above)

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/thirdparty/jcef/libcef.so | pem: accepted 0/14 | pem: accepted 0/14 |
| out:/thirdparty/java/lib/security/cacerts | keystore: accepted 7/14 (g3: 7/7, aaa: 0/7, noct: 1/2) | keystore: accepted 0/14 |
inside archives (zip members, extracted):
| out:/thirdparty/flatlaf-3.4.1.jar!com/formdev/flatlaf/natives/flatlaf-windows-arm64.dll | n/a (pem: no certificates readable) | n/a (pem: no certificates readable) |
| out:/thirdparty/flatlaf-3.4.1.jar!com/formdev/flatlaf/natives/flatlaf-windows-x86_64.dll | n/a (pem: no certificates readable) | n/a (pem: no certificates readable) |
| out:/thirdparty/flatlaf-3.4.1.jar!com/formdev/flatlaf/natives/flatlaf-windows-x86.dll | n/a (pem: no certificates readable) | n/a (pem: no certificates readable) |
| out:/thirdparty/flatlaf-3.4.1.jar!com/formdev/flatlaf/natives/libflatlaf-macos-arm64.dylib | n/a (pem: no certificates readable) | n/a (pem: no certificates readable) |
| out:/thirdparty/flatlaf-3.4.1.jar!com/formdev/flatlaf/natives/libflatlaf-macos-x86_64.dylib | n/a (pem: no certificates readable) | n/a (pem: no certificates readable) |
VERDICT scilab-bin 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 scilab-bin: needs network; NOT reproducible offline (the static and behavioral checks are)
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: github:irgolic/nixpkgs/89afd381a888d7497fdedc57bbd0815d9b837514
shim: shims/scilab-bin.nix   hosts: https://<host>-emudhra.we-have-a-problem.com/, one request per host per side, 10s timeout
before ok (0 package drvs built, 3s)
        wrapper /nix/store/…-ca-live-scilab-bin
after  ok (0 package drvs built, 4s)
        wrapper /nix/store/…-ca-live-scilab-bin
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

scilab-bin  (live; before 8915027df75d0403ef013dd0cbf09ff3c602fd03, after github:irgolic/nixpkgs/89afd381a888d7497fdedc57bbd0815d9b837514)
         | dv-g3b         | dv-g3b-aaa     | dv-g3c         | dv-g3c-aaa
before   | CONNECTED      | REFUSED        | CONNECTED      | REFUSED
after    | REFUSED        | REFUSED        | REFUSED        | REFUSED
VERDICT scilab-bin 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 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 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 on the bundled JRE sends one request to each of four test servers. Before this change, the test connects to the two servers with the G3 chain. After this change, the test connects to no server.

The first part of the harness output shows NOT FIXED. The cause is lib/thirdparty/jcef/libcef.so, which has the 130 roots of Chromium in its compiled code, and this change does not change this file. This is the same type of problem as #576544, and only a build from source can repair it. The harness cannot read these compiled roots, thus accepted 0/14 for this file does not show that the file rejects the chains. The lines below inside archives show files in .jar files, and they are the same before and after this change. 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