Skip to content

h2o: use cacert bundle instead of vendored CA bundle - #577128

Merged
r-vdp merged 1 commit into
NixOS:masterfrom
irgolic:cacert/h2o
Oct 25, 2026
Merged

r-vdp merged 1 commit into
NixOS:masterfrom
irgolic:cacert/h2o

Conversation

@irgolic

@irgolic irgolic commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Part of #576541.

h2o has a bundled CA file, share/h2o/ca-bundle.crt. h2o uses this file as the default trust store when it is a proxy to HTTPS servers. h2o-httpclient also uses it. h2o finds the file through H2O_ROOT, which the build sets to the out path. This change replaces the file with a symlink to the ca-bundle.crt file of cacert in postInstall. The new argument withVendoredCACert (default false) keeps the bundled file when it is true.

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 -- h2o --pr 577128
Harness output: h2o
$ nix run github:irgolic/nix-cacert-harness -- h2o --base 8915027df75d0403ef013dd0cbf09ff3c602fd03 --after github:irgolic/nixpkgs/de654520abdeada464f1b98fbe4ae87d04287d9a
base (before) = 8915027df75d0403ef013dd0cbf09ff3c602fd03
reference: fprs4zi8r6227x12qbsd1grvfrpz6201-nss-cacert-3.131.1 TLS roots=118 all=169
==================================================================
ATTR h2o
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: github:irgolic/nixpkgs/de654520abdeada464f1b98fbe4ae87d04287d9a
before ok (0 built, 0s)
        drv /nix/store/…-h2o-2.3.0-rolling-2026-10-21.drv
after  ok (0 built, 1s)
        drv /nix/store/…-h2o-2.3.0-rolling-2026-10-21.drv

| output:path | before | after |
|---|---|---|
| out:/share/h2o/ca-bundle.crt | pem 129 certs: 46 not in cacert, 18 in cacert but not for TLS, 53 cacert TLS roots missing; scanner: AAA,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 (64 total), e.g.:
  - C=GB, O=Comodo CA Limited, CN=AAA Certificate Services
  - 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=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=SwissSign AG, CN=SwissSign Gold CA - G2
  - C=CH, O=SwissSign AG, CN=SwissSign Silver CA - G2
VERDICT h2o: FIXED: before trusted CAs outside cacert; after: 1 store(s) == cacert, none with extra CAs

base=8915027df75d0403ef013dd0cbf09ff3c602fd03 shim=shims/h2o.nix
  package derivations to build for the matrix: 1 h2o-2.3.0-rolling-2026-10-21.drv
  before-stock: REFUSED -> /nix/store/…-ca-behave-h2o-stock
  before-test: REFUSED -> /nix/store/…-ca-behave-h2o-test
  after-stock: REFUSED -> /nix/store/…-ca-behave-h2o-stock
  after-test: CONNECTED -> /nix/store/…-ca-behave-h2o-test

h2o  (before 8915027df75d0403ef013dd0cbf09ff3c602fd03, after github:irgolic/nixpkgs/de654520abdeada464f1b98fbe4ae87d04287d9a)
         | 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 h2o: 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 h2o-httpclient sends a request to a local openssl s_server. h2o-httpclient examines the certificate of the server by default. 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)
@zimbatm zimbatm mentioned this pull request Oct 22, 2026
66 of 95 tasks
@nixpkgs-ci
nixpkgs-ci Bot requested review from thoughtpolice and toastal October 22, 2026 00:15
@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. llm-assisted Contributions that include code generation with LLMs labels Oct 22, 2026
@toastal

toastal commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

@irgolic this looks okay, but should we make it optional like withVendoredCACert ? false?

@irgolic irgolic added the 1.severity: security Issues which raise a security issue, or PRs that fix one label Oct 22, 2026
@irgolic

irgolic commented Oct 22, 2026

Copy link
Copy Markdown
Member Author

should we make it optional like withVendoredCACert ? false?

We can! But seemingly none of the other fixes in #576541 are doing so, is there a particular reason you'd like to do it for this one?

@toastal

toastal commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

I usually default to making things configurable by default. I am not sure “what” that use case is tho! I don’t have strong feelings other than the slight sense that someone might want to turn this knob. If you deem it a dumb idea, I would just approve it. (I am running this patch BTW).

@irgolic

irgolic commented Oct 22, 2026

Copy link
Copy Markdown
Member Author

I'll prioritize maintainer taste! I've added the knob.

@toastal toastal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. labels Oct 25, 2026
@r-vdp
r-vdp added this pull request to the merge queue Oct 25, 2026
Merged via the queue into NixOS:master with commit b7d846b Oct 25, 2026
32 checks passed
wrapProgram "$out/bin/h2olog" \
--set "PERL5LIB" "$PERL5LIB"
''
+ lib.optionalString (!withVendoredCACert) ''

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this an option? This is a general distribution guidance thingy, like we also do not compile with vendored libraries. IMO it should be removed or we should mark the package as insecure it it is set to true which would be rather silly to do.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be backported if merged

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 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. 12.approvals: 1 This PR was reviewed and approved by one person. 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in any of the changed packages. llm-assisted Contributions that include code generation with LLMs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants