Skip to content

n98-magerun2: use cacert bundle instead of vendored CA bundle - #578559

Merged
drupol merged 1 commit into
NixOS:masterfrom
irgolic:cacert/n98-magerun2
Oct 25, 2026
Merged

drupol merged 1 commit into
NixOS:masterfrom
irgolic:cacert/n98-magerun2

Conversation

@irgolic

@irgolic irgolic commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Part of #576541.

n98-magerun2 includes the PHP library rmccue/requests. This library has a bundled CA file at share/php/n98-magerun2/vendor/rmccue/requests/certificates/cacert.pem. The library uses this file as its default trust store. The harness found 121 certificates in the file. 3 of them are not TLS roots of cacert: emSign ECC Root CA - G3, emSign ECC Root CA - C3 and emSign Root CA - C1. The change removes the file in postInstall and replaces it with a symlink to the cacert bundle.

Note

AI Disclosure: Claude Code made the code change, the commit message and the first version of this pull request description, with patchix. Claude Code used Claude Opus 5.5. This pull request description is written in ASD-STE100 (Simplified Technical English), examined with memelint in strict mode. As the automation/AI policy requires, I established confidence in this output: by manual review of the code change and of this description, and with the verification tooling that this description discloses.

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 -- n98-magerun2 --pr 578559 --emudhra
Output of harness: n98-magerun2
[1/2] static check + eMudhra chains: offline, reproducible
base (before) = dac5e22db3ed2be013da0eba8050c05140bd3f30
reference: fprs4zi8r6227x12qbsd1grvfrpz6201-nss-cacert-3.131.1 TLS roots=118 all=169
==================================================================
ATTR n98-magerun2
before: dac5e22db3ed2be013da0eba8050c05140bd3f30   after: worktree <worktree>
before ok (0 built, 1s)
        drv /nix/store/ykwwixbpi8r6v9qqzpqgpv531jicl0ld-n98-magerun2-10.1.0.drv
after  ok (0 built, 2s)
        drv /nix/store/l31dgfzcnwsg0aaadkcd8887z9fhnazf-n98-magerun2-10.1.0.drv

| output:path | before | after |
|---|---|---|
| out:/share/php/n98-magerun2/vendor/rmccue/requests/certificates/cacert.pem | pem 121 certs: 3 not in cacert, 0 in cacert but not for TLS, 0 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 (3 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
VERDICT n98-magerun2: FIXED: before trusted CAs outside cacert; after: 1 store(s) == cacert, none with extra CAs

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:/share/php/n98-magerun2/vendor/rmccue/requests/certificates/cacert.pem | pem: accepted 7/14 (g3: 7/7, aaa: 0/7, noct: 1/2) | symlink->cacert:ca-bundle.crt pem: accepted 0/14 |
VERDICT n98-magerun2 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 n98-magerun2: needs network; NOT reproducible offline (the static and behavioral checks are)
before: dac5e22db3ed2be013da0eba8050c05140bd3f30   after: worktree <worktree>
shim: shims/n98-magerun2.nix   hosts: https://<host>-emudhra.we-have-a-problem.com/, one request per host per side, 10s timeout
before ok (0 package drvs built, 2s)
        wrapper /nix/store/87g5q0sprzr8al4krqxpq4cqzjc18wcq-ca-live-n98-magerun2
after  ok (0 package drvs built, 3s)
        wrapper /nix/store/jmw12lmw6xcsbv3j2jdh7vcw7rr65zj5-ca-live-n98-magerun2
system store: visible: /etc/ssl/certs/ca-certificates.crt -> nss-cacert-3.131.1/etc/ssl/certs/ca-bundle.crt /etc/pki/tls/certs/ca-bundle.crt -> nss-cacert-3.131.1/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-aaa,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      | library default (certificates/cacert.pem): status 200
  before dv-g3b-aaa  REFUSED        | ...es/cacert.pem): cURL error 60: SSL certificate OpenSSL verify result: unable to get local issuer certificate (20)
  before dv-g3c      CONNECTED      | library default (certificates/cacert.pem): status 200
  before dv-g3c-aaa  REFUSED        | ...es/cacert.pem): cURL error 60: SSL certificate OpenSSL verify result: unable to get local issuer certificate (20)
  after  dv-g3b      REFUSED        | ...es/cacert.pem): cURL error 60: SSL certificate OpenSSL verify result: unable to get local issuer certificate (20)
  after  dv-g3b-aaa  REFUSED        | ...es/cacert.pem): cURL error 60: SSL certificate OpenSSL verify result: certificate rejected (28)
  after  dv-g3c      REFUSED        | ...es/cacert.pem): cURL error 60: SSL certificate OpenSSL verify result: unable to get local issuer certificate (20)
  after  dv-g3c-aaa  REFUSED        | ...es/cacert.pem): cURL error 60: SSL certificate OpenSSL verify result: certificate rejected (28)

n98-magerun2  (live; before dac5e22db3ed2be013da0eba8050c05140bd3f30, after worktree)
         | dv-g3b         | dv-g3b-aaa     | dv-g3c         | dv-g3c-aaa    
before   | CONNECTED      | REFUSED        | CONNECTED      | REFUSED       
after    | REFUSED        | REFUSED        | REFUSED        | REFUSED       
VERDICT n98-magerun2 live: PASS: before CONNECTED to 2/4 host(s) serving a compromised eMudhra chain (dv-g3b,dv-g3c); after REFUSED on all 4

Before the change, the bundled trust store accepted 7 of the 14 eMudhra chains. After the change, it accepts none of them. The live test sent one request to each of the 4 eMudhra test hosts. Before the change, n98-magerun2 connected to 2 of the 4 hosts. After the change, it connected to none of the 4 hosts.

Things done

Assisted-by: Claude Code (Claude Opus 5.5) with patchix
@irgolic irgolic added the 1.severity: security Issues which raise a security issue, or PRs that fix one label Oct 24, 2026
@zimbatm zimbatm mentioned this pull request Oct 24, 2026
66 of 95 tasks
@nixpkgs-ci
nixpkgs-ci Bot requested a review from a team October 24, 2026 23:25
@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. 10.rebuild-darwin: 1 This PR causes 1 package 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 24, 2026
@nixpkgs-review-gha

Copy link
Copy Markdown

✅ nixpkgs-review result

Generated using nixpkgs-review-gha (af6a071)

Command: nixpkgs-review pr 578559
Commit: c9f88923dba1d86eed3f848751e8b8d7a2865c9a (subsequent changes)
Merge: e8fb75efa1ad6e206ca67b8cd6a4307207275420

Triggered by @piotrkwiecinski (2151333)
Logs: https://github.com/piotrkwiecinski/nixpkgs-review-gha/actions/runs/40184857513/attempts/1


x86_64-linux

✅ 1 package built:
  • n98-magerun2

aarch64-linux

✅ 1 package built:
  • n98-magerun2

x86_64-darwin

✅ No rebuilds


aarch64-darwin (sandbox = relaxed)

✅ 1 package built:
  • n98-magerun2

@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
@drupol
drupol added this pull request to the merge queue Oct 25, 2026
Merged via the queue into NixOS:master with commit e3e172e Oct 25, 2026
38 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 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package 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