Skip to content

renpy: use cacert bundle instead of vendored CA file - #578587

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

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

Conversation

@irgolic

@irgolic irgolic commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Part of #576541.

renpy has a bundled CA file, share/renpy/lib/python3.12/certifi/cacert.pem, that accepts the eMudhra roots that cacert removed. This change replaces the file with a copy of the cacert bundle of nixpkgs, in preFixup. A link to the Nix store is not sufficient: Ren'Py puts this file into the software that it builds, and this software operates without Nix.

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 -- renpy --pr 578587 --emudhra
Output of harness: renpy
[1/2] static check + eMudhra chains: offline, reproducible
base (before) = 8915027df75d0403ef013dd0cbf09ff3c602fd03
reference: fprs4zi8r6227x12qbsd1grvfrpz6201-nss-cacert-3.131.1 TLS roots=118 all=169
==================================================================
ATTR renpy
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: worktree <worktree>
before ok (0 built, 3s)
        drv /nix/store/vwcyb8541a3mv1gnkmlvpg33zi297w40-renpy-8.5.3.26051504-unstable-2026-05-17.drv
after  ok (0 built, 3s)
        drv /nix/store/z6angcyiglgn17m06sc22wkdfjxn1gfb-renpy-8.5.3.26051504-unstable-2026-05-17.drv

| output:path | before | after |
|---|---|---|
| out:/share/renpy/lib/python3.12/certifi/cacert.pem | pem 120 certs: 5 not in cacert, 1 in cacert but not for TLS, 4 cacert TLS roots missing; scanner: ECC G3 | byte-identical copy of a cacert bundle: pem 169 certs (118 TLS roots + 51 non-TLS, i.e. cacert's own trust-rules bundle) |

cacert in runtime closure (before): yes
cacert in runtime closure (after): yes
CAs trusted before but not trusted for TLS by cacert (6 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=JP, O=Cybertrust Japan Co., Ltd., CN=SecureSign Root CA12
  - CN=Atos TrustedRoot 2011, O=Atos, C=DE
  - C=TW, O=Chunghwa Telecom Co., Ltd., OU=ePKI Root Certification Authority
VERDICT renpy: 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/renpy/lib/python3.12/certifi/cacert.pem | pem: accepted 7/14 (g3: 7/7, aaa: 0/7, noct: 1/2) | pem: accepted 0/14 |
VERDICT renpy 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 renpy: needs network; NOT reproducible offline (the static and behavioral checks are)
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: worktree <worktree>
shim: shims/live/renpy.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/m340yvl8r1ckj5z35pvjzvq3yfdpsv7w-ca-live-renpy
after  ok (0 package drvs built, 3s)
        wrapper /nix/store/gwf6zmcp5lw9j6wkc1f19r3x65aqsdfk-ca-live-renpy
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      | status 200
  before dv-g3b-aaa  REFUSED        | ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)
  before dv-g3c      CONNECTED      | status 200
  before dv-g3c-aaa  REFUSED        | ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)
  after  dv-g3b      REFUSED        | ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)
  after  dv-g3b-aaa  REFUSED        | ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate rejected (_ssl.c:1000)
  after  dv-g3c      REFUSED        | ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)
  after  dv-g3c-aaa  REFUSED        | ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate rejected (_ssl.c:1000)

renpy  (live; before 8915027df75d0403ef013dd0cbf09ff3c602fd03, after worktree)
         | dv-g3b         | dv-g3b-aaa     | dv-g3c         | dv-g3c-aaa    
before   | CONNECTED      | REFUSED        | CONNECTED      | REFUSED       
after    | REFUSED        | REFUSED        | REFUSED        | REFUSED       
VERDICT renpy 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 file accepts 7 of the 14 eMudhra chains; after, none. In the live test, Ren'Py connected to some test servers with eMudhra chains before the change, and to none after.

Things done

@irgolic irgolic added the 1.severity: security Issues which raise a security issue, or PRs that fix one label Oct 25, 2026
@zimbatm zimbatm mentioned this pull request Oct 25, 2026
66 of 95 tasks
@nixpkgs-ci
nixpkgs-ci Bot requested review from ShadowRZ and UlyssesZh October 25, 2026 01:13
@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. llm-assisted Contributions that include code generation with LLMs labels Oct 25, 2026
@UlyssesZh

Copy link
Copy Markdown
Member

Thanks for the heads-up. I opened an issue to notify the upstream about the situation.

Comment thread pkgs/by-name/re/renpy/package.nix Outdated
@@ -228,6 +229,12 @@ stdenv.mkDerivation (finalAttrs: {
runHook postInstall
'';

postInstall = lib.optionalString (finalAttrs.passthru.distributedRenpy != null) ''

@UlyssesZh UlyssesZh Oct 25, 2026 •

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.

I would like to use preFixup instead. Also, since I opened an issue on the upstream, we should link it here so that future maintainer can be reminded to remove this fixup when the issue is resolved.

@ShadowRZ ShadowRZ left a comment

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.

Generally OK, although it would be better to consider #578587 (comment)

@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
@irgolic

irgolic commented Oct 25, 2026

Copy link
Copy Markdown
Member Author

Thanks for the feedback, I didn't think to use preFixup. I'm adjusting these changes according to maintainer taste, so feel free to nitpick anything else.

@ShadowRZ
ShadowRZ self-requested a review October 25, 2026 02:10

@ShadowRZ ShadowRZ left a comment

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.

LGTM

@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 2 This PR was reviewed and approved by two persons. and removed 12.approvals: 1 This PR was reviewed and approved by one person. labels Oct 25, 2026
Comment thread pkgs/by-name/re/renpy/package.nix Outdated
runHook postInstall
'';

# remove this when https://github.com/renpy/renpy/issues/7466 is resolved

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.

I think we shouldn't remove this even if they fixed that issue. The idea here is that for a next compromise we bump only our nixpkgs ca certs package, and everything in tree gets the updated root certs.

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.

Keeping this fixup has two downsides: (1) having cacerts in the closure makes renpy get more rebuilds; (2) maintaining the patch requires some work, e.g., changing the path when python is updated.

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.

having cacerts in the closure makes renpy get more rebuilds

cacerts rebuild this package most likely anyhow, it depends on ffmpeg (not even headless) and SDL.

changing the path when python is updated

Checking if upstream keeps their certs up to date, too.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I agree that this fix should stay; there might be a way to write it that's easier to maintain in the long run. Ideally nothing in nixpkgs would bundle its own certificate trust, it would all come from a single source.

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.

Okay. Then maybe just leave the link there for issue tracking, without notice of future removal.

@UlyssesZh

Copy link
Copy Markdown
Member

Actually I just realized that you should use cp instead of ln because the distributed renpy is intended to be distributed to end users (outside nix). Having a symlink to the nix store does not make sense here.

Assisted-by: Claude Code (Claude Opus 5.5) with patchix
@r-vdp
r-vdp added this pull request to the merge queue Oct 27, 2026
Merged via the queue into NixOS:master with commit b7370c0 Oct 27, 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 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. 12.approvals: 2 This PR was reviewed and approved by two persons. 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.

5 participants