Skip to content

rubyPackages.{algoliasearch,excon,httpclient,nap}: use cacert bundle instead of vendored CA files - #577131

Merged
SuperSandro2000 merged 1 commit into
NixOS:masterfrom
irgolic:cacert/rubyPackages.algoliasearch-excon-httpclient-nap
Oct 24, 2026
Merged

SuperSandro2000 merged 1 commit into
NixOS:masterfrom
irgolic:cacert/rubyPackages.algoliasearch-excon-httpclient-nap

Conversation

@irgolic

@irgolic irgolic commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Part of #576541.

The gems excon, httpclient, nap and algoliasearch each have a bundled CA file. httpclient, nap and algoliasearch use their file as the trust store. excon adds its file to the trust store. This change adds postInstall entries in pkgs/development/ruby-modules/gem-config/default.nix. These entries replace each file with a symlink to the ca-bundle.crt file of cacert. httpclient also has a file that it does not use, cacert1024.pem. This change replaces that file too.

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 each gem before and after this change. A local copy of nixpkgs is not necessary.

nix run github:irgolic/nix-cacert-harness -- rubyPackages.excon --pr <this PR>
nix run github:irgolic/nix-cacert-harness -- rubyPackages.httpclient --pr <this PR>
nix run github:irgolic/nix-cacert-harness -- rubyPackages.nap --pr <this PR>
nix run github:irgolic/nix-cacert-harness -- rubyPackages.algoliasearch --pr <this PR>
Harness output: rubyPackages.excon
$ nix run github:irgolic/nix-cacert-harness -- rubyPackages.excon --base 8915027df75d0403ef013dd0cbf09ff3c602fd03 --after github:irgolic/nixpkgs/455bac55433a26749575d130eb567efd97f09589
base (before) = 8915027df75d0403ef013dd0cbf09ff3c602fd03
reference: fprs4zi8r6227x12qbsd1grvfrpz6201-nss-cacert-3.131.1 TLS roots=118 all=169
==================================================================
ATTR rubyPackages.excon
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: github:irgolic/nixpkgs/455bac55433a26749575d130eb567efd97f09589
before ok (0 built, 1s)
        drv /nix/store/…-ruby3.4-excon-1.3.1.drv
after  ok (0 built, 1s)
        drv /nix/store/…-ruby3.4-excon-1.3.1.drv

| output:path | before | after |
|---|---|---|
| out:/lib/ruby/gems/3.4.0/gems/excon-1.3.1/data/cacert.pem | pem 148 certs: 23 not in cacert, 12 in cacert but not for TLS, 5 cacert TLS roots missing; scanner: ECC G3 | symlink->cacert:ca-bundle.crt pem 169 certs (118 TLS roots + 51 non-TLS, i.e. cacert's own trust-rules bundle) |

cacert in runtime closure (before): no
cacert in runtime closure (after): yes
CAs trusted before but not trusted for TLS by cacert (35 total), e.g.:
  - C=IN, OU=emSign PKI, O=eMudhra Technologies Limited, CN=emSign ECC Root CA - G3
  - C=US, OU=emSign PKI, O=eMudhra Inc, CN=emSign ECC Root CA - C3
  - C=US, OU=emSign PKI, O=eMudhra Inc, CN=emSign Root CA - C1
  - C=AT, O=e-commerce monitoring GmbH, CN=GLOBALTRUST 2020
  - C=BM, O=QuoVadis Limited, CN=QuoVadis Root CA 2
  - C=BM, O=QuoVadis Limited, CN=QuoVadis Root CA 3
  - C=CH, O=SwissSign AG, CN=SwissSign Gold CA - G2
  - C=ES, O=Firmaprofesional SA, CN=FIRMAPROFESIONAL CA ROOT-A WEB
  - C=FR, O=Dhimyotis, CN=Certigna
VERDICT rubyPackages.excon: FIXED: before trusted CAs outside cacert; after: 1 store(s) == cacert, none with extra CAs

base=8915027df75d0403ef013dd0cbf09ff3c602fd03 shim=shims/rubyPackages.excon.nix
  package derivations to build for the matrix: 3 ca-shim-gems.drv ruby3.4-excon-1.3.1.drv ca-shim-gems.drv
  before-stock: REFUSED -> /nix/store/…-ca-behave-rubyPackages-excon-stock
  before-test: REFUSED -> /nix/store/…-ca-behave-rubyPackages-excon-test
  after-stock: REFUSED -> /nix/store/…-ca-behave-rubyPackages-excon-stock
  after-test: CONNECTED -> /nix/store/…-ca-behave-rubyPackages-excon-test

rubyPackages.excon  (before 8915027df75d0403ef013dd0cbf09ff3c602fd03, after github:irgolic/nixpkgs/455bac55433a26749575d130eb567efd97f09589)
         | 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 rubyPackages.excon: PASS: after-fix trust follows cacert; before-fix ignores it
Harness output: rubyPackages.httpclient
$ nix run github:irgolic/nix-cacert-harness -- rubyPackages.httpclient --base 8915027df75d0403ef013dd0cbf09ff3c602fd03 --after github:irgolic/nixpkgs/455bac55433a26749575d130eb567efd97f09589
base (before) = 8915027df75d0403ef013dd0cbf09ff3c602fd03
reference: fprs4zi8r6227x12qbsd1grvfrpz6201-nss-cacert-3.131.1 TLS roots=118 all=169
==================================================================
ATTR rubyPackages.httpclient
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: github:irgolic/nixpkgs/455bac55433a26749575d130eb567efd97f09589
before ok (0 built, 1s)
        drv /nix/store/…-ruby3.4-httpclient-2.9.0.drv
after  ok (0 built, 1s)
        drv /nix/store/…-ruby3.4-httpclient-2.9.0.drv

| output:path | before | after |
|---|---|---|
| out:/lib/ruby/gems/3.4.0/gems/httpclient-2.9.0/lib/httpclient/cacert1024.pem | pem 153 certs: 116 not in cacert, 16 in cacert but not for TLS, 97 cacert TLS roots missing; scanner: AAA | symlink->cacert:ca-bundle.crt pem 169 certs (118 TLS roots + 51 non-TLS, i.e. cacert's own trust-rules bundle) |
| out:/lib/ruby/gems/3.4.0/gems/httpclient-2.9.0/lib/httpclient/cacert.pem | pem 153 certs: 98 not in cacert, 19 in cacert but not for TLS, 82 cacert TLS roots missing; scanner: AAA | symlink->cacert:ca-bundle.crt pem 169 certs (118 TLS roots + 51 non-TLS, i.e. cacert's own trust-rules bundle) |

cacert in runtime closure (before): no
cacert in runtime closure (after): yes
CAs trusted before but not trusted for TLS by cacert (142 total), e.g.:
  - C=GB, O=Comodo CA Limited, CN=AAA Certificate Services
  - C=AT, O=A-Trust Ges. f. Sicherheitssysteme im elektr. Datenverkehr GmbH, OU=A-Trust-nQual-03, CN=A-Trust-nQual-03
  - C=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA
  - C=BM, O=QuoVadis Limited, CN=QuoVadis Root CA 2
  - C=BM, O=QuoVadis Limited, CN=QuoVadis Root CA 3
  - C=BM, O=QuoVadis Limited, OU=Root Certification Authority, CN=QuoVadis Root Certification Authority
  - C=ch, O=Swisscom, OU=Digital Certificate Services, CN=Swisscom Root CA 1
VERDICT rubyPackages.httpclient: FIXED: before trusted CAs outside cacert; after: 2 store(s) == cacert, none with extra CAs

base=8915027df75d0403ef013dd0cbf09ff3c602fd03 shim=shims/rubyPackages.httpclient.nix
  package derivations to build for the matrix: 3 ca-shim-gems.drv ruby3.4-httpclient-2.9.0.drv ca-shim-gems.drv
  before-stock: REFUSED -> /nix/store/…-ca-behave-rubyPackages-httpclient-stock
  before-test: REFUSED -> /nix/store/…-ca-behave-rubyPackages-httpclient-test
  after-stock: REFUSED -> /nix/store/…-ca-behave-rubyPackages-httpclient-stock
  after-test: CONNECTED -> /nix/store/…-ca-behave-rubyPackages-httpclient-test

rubyPackages.httpclient  (before 8915027df75d0403ef013dd0cbf09ff3c602fd03, after github:irgolic/nixpkgs/455bac55433a26749575d130eb567efd97f09589)
         | 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 rubyPackages.httpclient: PASS: after-fix trust follows cacert; before-fix ignores it
Harness output: rubyPackages.nap
$ nix run github:irgolic/nix-cacert-harness -- rubyPackages.nap --base 8915027df75d0403ef013dd0cbf09ff3c602fd03 --after github:irgolic/nixpkgs/455bac55433a26749575d130eb567efd97f09589
base (before) = 8915027df75d0403ef013dd0cbf09ff3c602fd03
reference: fprs4zi8r6227x12qbsd1grvfrpz6201-nss-cacert-3.131.1 TLS roots=118 all=169
==================================================================
ATTR rubyPackages.nap
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: github:irgolic/nixpkgs/455bac55433a26749575d130eb567efd97f09589
before ok (0 built, 0s)
        drv /nix/store/…-ruby3.4-nap-1.1.0.drv
after  ok (0 built, 0s)
        drv /nix/store/…-ruby3.4-nap-1.1.0.drv

| output:path | before | after |
|---|---|---|
| out:/lib/ruby/gems/3.4.0/gems/nap-1.1.0/support/cacert.pem | pem 155 certs: 100 not in cacert, 19 in cacert but not for TLS, 82 cacert TLS roots missing; scanner: AAA | symlink->cacert:ca-bundle.crt pem 169 certs (118 TLS roots + 51 non-TLS, i.e. cacert's own trust-rules bundle) |

cacert in runtime closure (before): no
cacert in runtime closure (after): yes
CAs trusted before but not trusted for TLS by cacert (119 total), e.g.:
  - C=GB, O=Comodo CA Limited, CN=AAA Certificate Services
  - C=AT, O=A-Trust Ges. f. Sicherheitssysteme im elektr. Datenverkehr GmbH, OU=A-Trust-nQual-03, CN=A-Trust-nQual-03
  - C=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA
  - C=BM, O=QuoVadis Limited, CN=QuoVadis Root CA 2
  - C=BM, O=QuoVadis Limited, CN=QuoVadis Root CA 3
  - C=BM, O=QuoVadis Limited, OU=Root Certification Authority, CN=QuoVadis Root Certification Authority
  - C=ch, O=Swisscom, OU=Digital Certificate Services, CN=Swisscom Root CA 1
VERDICT rubyPackages.nap: FIXED: before trusted CAs outside cacert; after: 1 store(s) == cacert, none with extra CAs

base=8915027df75d0403ef013dd0cbf09ff3c602fd03 shim=shims/rubyPackages.nap.nix
  package derivations to build for the matrix: 3 ruby3.4-nap-1.1.0.drv ca-shim-gems.drv ca-shim-gems.drv
  before-stock: REFUSED -> /nix/store/…-ca-behave-rubyPackages-nap-stock
  before-test: REFUSED -> /nix/store/…-ca-behave-rubyPackages-nap-test
  after-stock: REFUSED -> /nix/store/…-ca-behave-rubyPackages-nap-stock
  after-test: CONNECTED -> /nix/store/…-ca-behave-rubyPackages-nap-test

rubyPackages.nap  (before 8915027df75d0403ef013dd0cbf09ff3c602fd03, after github:irgolic/nixpkgs/455bac55433a26749575d130eb567efd97f09589)
         | 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 rubyPackages.nap: PASS: after-fix trust follows cacert; before-fix ignores it
Harness output: rubyPackages.algoliasearch
$ nix run github:irgolic/nix-cacert-harness -- rubyPackages.algoliasearch --base 8915027df75d0403ef013dd0cbf09ff3c602fd03 --after github:irgolic/nixpkgs/455bac55433a26749575d130eb567efd97f09589
base (before) = 8915027df75d0403ef013dd0cbf09ff3c602fd03
reference: fprs4zi8r6227x12qbsd1grvfrpz6201-nss-cacert-3.131.1 TLS roots=118 all=169
==================================================================
ATTR rubyPackages.algoliasearch
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: github:irgolic/nixpkgs/455bac55433a26749575d130eb567efd97f09589
before ok (0 built, 1s)
        drv /nix/store/…-ruby3.4-algoliasearch-1.27.5.drv
after  ok (0 built, 1s)
        drv /nix/store/…-ruby3.4-algoliasearch-1.27.5.drv

| output:path | before | after |
|---|---|---|
| out:/lib/ruby/gems/3.4.0/gems/algoliasearch-1.27.5/resources/ca-bundle.crt | pem 158 certs: 128 not in cacert, 14 in cacert but not for TLS, 102 cacert TLS roots missing; scanner: AAA | symlink->cacert:ca-bundle.crt pem 169 certs (118 TLS roots + 51 non-TLS, i.e. cacert's own trust-rules bundle) |

cacert in runtime closure (before): no
cacert in runtime closure (after): yes
CAs trusted before but not trusted for TLS by cacert (142 total), e.g.:
  - C=GB, O=Comodo CA Limited, CN=AAA Certificate Services
  - C=AT, O=A-Trust Ges. f. Sicherheitssysteme im elektr. Datenverkehr GmbH, OU=A-Trust-nQual-03, CN=A-Trust-nQual-03
  - C=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA
  - C=BM, O=QuoVadis Limited, CN=QuoVadis Root CA 2
  - C=BM, O=QuoVadis Limited, CN=QuoVadis Root CA 3
  - C=BM, O=QuoVadis Limited, OU=Root Certification Authority, CN=QuoVadis Root Certification Authority
  - C=ch, O=Swisscom, OU=Digital Certificate Services, CN=Swisscom Root CA 1
VERDICT rubyPackages.algoliasearch: FIXED: before trusted CAs outside cacert; after: 1 store(s) == cacert, none with extra CAs

base=8915027df75d0403ef013dd0cbf09ff3c602fd03 shim=shims/rubyPackages.algoliasearch.nix
  package derivations to build for the matrix: 3 ruby3.4-algoliasearch-1.27.5.drv ca-shim-gems.drv ca-shim-gems.drv
  before-stock: REFUSED -> /nix/store/…-ca-behave-rubyPackages-algoliasearch-stock
  before-test: REFUSED -> /nix/store/…-ca-behave-rubyPackages-algoliasearch-test
  after-stock: REFUSED -> /nix/store/…-ca-behave-rubyPackages-algoliasearch-stock
  after-test: CONNECTED -> /nix/store/…-ca-behave-rubyPackages-algoliasearch-test

rubyPackages.algoliasearch  (before 8915027df75d0403ef013dd0cbf09ff3c602fd03, after github:irgolic/nixpkgs/455bac55433a26749575d130eb567efd97f09589)
         | 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 rubyPackages.algoliasearch: 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 gem again with defaultGemConfig.override. Then a small Ruby test sends a request to a local openssl s_server with the gem. 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. nap examines the certificate only when the code that uses nap gives tls_verify: true. The test for nap gives this value.

Things done

…instead of vendored CA files

Assisted-by: Claude Code (Claude Fable 5.1)
Assisted-by: Claude Code (Claude Opus 5.5)
@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. 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! 6.topic: ruby A dynamic, open source programming language with a focus on simplicity and productivity. labels Oct 22, 2026
@zimbatm zimbatm mentioned this pull request Oct 22, 2026
66 of 95 tasks
@irgolic irgolic added the 1.severity: security Issues which raise a security issue, or PRs that fix one label Oct 22, 2026
@irgolic
irgolic force-pushed the cacert/rubyPackages.algoliasearch-excon-httpclient-nap branch from 6f7ca0c to 60e472c Compare October 22, 2026 11:58
@irgolic
irgolic marked this pull request as draft October 22, 2026 12:06
@nixpkgs-ci nixpkgs-ci Bot removed the 9.needs: reviewer This PR currently has no reviewers requested and needs attention. label Oct 22, 2026
@irgolic
irgolic force-pushed the cacert/rubyPackages.algoliasearch-excon-httpclient-nap branch from 60e472c to 455bac5 Compare October 22, 2026 13:56
@irgolic
irgolic marked this pull request as ready for review October 22, 2026 13:57
@nixpkgs-ci nixpkgs-ci Bot added the 9.needs: reviewer This PR currently has no reviewers requested and needs attention. label Oct 22, 2026
@SuperSandro2000

Copy link
Copy Markdown
Member

nixpkgs-review fails for me because of gitlab-assets, but otherwise it looks good

@SuperSandro2000
SuperSandro2000 added this pull request to the merge queue Oct 24, 2026
Merged via the queue into NixOS:master with commit 60b096d Oct 24, 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 6.topic: ruby A dynamic, open source programming language with a focus on simplicity and productivity. 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: 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