Skip to content

rubyPackages.certified: use cacert bundle instead of vendored CA file - #577602

Merged
SuperSandro2000 merged 1 commit into
NixOS:masterfrom
irgolic:cacert/rubyPackages.certified
Oct 24, 2026
Merged

SuperSandro2000 merged 1 commit into
NixOS:masterfrom
irgolic:cacert/rubyPackages.certified

Conversation

@irgolic

@irgolic irgolic commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Part of #576541.

The certified gem has a bundled CA file, certs/ca-bundle.crt. The last version of the gem is 1.0.0 from 2014-07-19, thus this file is from 2014, and no newer version is available. The only function of the gem is to make Net::HTTP use the CA file of the gem. This change adds a certified entry in pkgs/development/ruby-modules/gem-config/default.nix, which replaces the file with a symlink to the ca-bundle.crt file of cacert in postInstall. After this change, that file is the cacert bundle, thus on nixpkgs the gem makes Net::HTTP use cacert, the same decision as for python3Packages.certifi.

In nixpkgs, rubyPackages.kramdown-rfc2629 and the Ruby environment of Discourse include this gem. kramdown-rfc2629 does require 'certified' only when it cannot open the default CA file of OpenSSL and the default CA directory has no PEM files. The Gemfile of Discourse has the gem with require: false, and only the tests of Discourse do require "certified", in spec/rails_helper.rb. The change applies to all software that does require "certified". The open pull request #577131 changes the same file for four other gems, and it adds the same cacert argument at the same position. git merge-file merges the two changes with no merge conflict.

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 -- rubyPackages.certified --pr 577602
Harness output: rubyPackages.certified
$ nix run github:irgolic/nix-cacert-harness -- rubyPackages.certified --base 8915027df75d0403ef013dd0cbf09ff3c602fd03 --after github:irgolic/nixpkgs/bcdd04f98bd845c5ab038c07ddc7605bcb7020a8
base (before) = 8915027df75d0403ef013dd0cbf09ff3c602fd03
reference: fprs4zi8r6227x12qbsd1grvfrpz6201-nss-cacert-3.131.1 TLS roots=118 all=169
==================================================================
ATTR rubyPackages.certified
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: github:irgolic/nixpkgs/bcdd04f98bd845c5ab038c07ddc7605bcb7020a8
before ok (0 built, 1s)
        drv /nix/store/…-ruby3.4-certified-1.0.0.drv
after  ok (0 built, 1s)
        drv /nix/store/…-ruby3.4-certified-1.0.0.drv

| output:path | before | after |
|---|---|---|
| out:/lib/ruby/gems/3.4.0/gems/certified-1.0.0/certs/ca-bundle.crt | 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) |

cacert in runtime closure (before): no
cacert in runtime closure (after): yes
CAs trusted before but not trusted for TLS by cacert (132 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.certified: FIXED: before trusted CAs outside cacert; after: 1 store(s) == cacert, none with extra CAs

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

rubyPackages.certified  (before 8915027df75d0403ef013dd0cbf09ff3c602fd03, after github:irgolic/nixpkgs/bcdd04f98bd845c5ab038c07ddc7605bcb7020a8)
         | 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.certified: 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 does require "certified" and sends one request to a local openssl s_server with Net::HTTP.get_response. 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.

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
66 of 95 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: 1-10 This PR causes between 1 and 10 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 23, 2026
@SuperSandroBot

Copy link
Copy Markdown

✅ nixpkgs-review result

Generated using nixpkgs-review-gha (44e9141)

Command: nixpkgs-review pr 577602
Commit: bcdd04f98bd845c5ab038c07ddc7605bcb7020a8 (subsequent changes)
Merge: 0fbdb4c410cfe222f0740bc125cf7545e5a92791

Logs: https://github.com/SuperSandro2000/nixpkgs-review-gha/actions/runs/40058935264/attempts/1


x86_64-linux

✅ 6 packages built:
  • rubyPackages.certified (rubyPackages_3_4.certified)
  • rubyPackages.kramdown-rfc2629 (rubyPackages_3_4.kramdown-rfc2629)
  • rubyPackages_4_0.certified
  • rubyPackages_4_0.kramdown-rfc2629
  • discourse
  • discourseAllPlugins

aarch64-linux

✅ 6 packages built:
  • rubyPackages.certified (rubyPackages_3_4.certified)
  • rubyPackages.kramdown-rfc2629 (rubyPackages_3_4.kramdown-rfc2629)
  • rubyPackages_4_0.certified
  • rubyPackages_4_0.kramdown-rfc2629
  • discourseAllPlugins
  • discourse

aarch64-darwin (sandbox = relaxed)

✅ 4 packages built:
  • rubyPackages.certified (rubyPackages_3_4.certified)
  • rubyPackages.kramdown-rfc2629 (rubyPackages_3_4.kramdown-rfc2629)
  • rubyPackages_4_0.certified
  • rubyPackages_4_0.kramdown-rfc2629

@SuperSandro2000
SuperSandro2000 added this pull request to the merge queue Oct 24, 2026
Merged via the queue into NixOS:master with commit 434b275 Oct 24, 2026
35 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: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 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.

3 participants