Skip to content

gam: use cacert bundle for the vendored fallback CA file - #577133

Open
irgolic wants to merge 1 commit into
NixOS:masterfrom
irgolic:cacert/gam
Open

irgolic wants to merge 1 commit into
NixOS:masterfrom
irgolic:cacert/gam

Conversation

@irgolic

@irgolic irgolic commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Part of #576541.

gam has a bundled CA file, gam/cacerts.pem. The wrapper of gam sets GAM_CA_FILE to the cacert bundle. But gam uses the bundled file when GAM_CA_FILE is empty and gam.cfg has no cacerts_pem value. This change replaces the installed file with a symlink to the ca-bundle.crt file of cacert in postFixup. Thus, the installed file is a symlink to cacert, and replaceDependencies can replace cacert. The wheel in the dist output keeps the bundled file (#576542).

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 -- gam --pr <this PR>
Harness output: gam
$ nix run github:irgolic/nix-cacert-harness -- gam --base 8915027df75d0403ef013dd0cbf09ff3c602fd03 --after github:irgolic/nixpkgs/a4e862f94ddd4a16abd6335dc2219e085e4e4bee
base (before) = 8915027df75d0403ef013dd0cbf09ff3c602fd03
reference: fprs4zi8r6227x12qbsd1grvfrpz6201-nss-cacert-3.131.1 TLS roots=118 all=169
==================================================================
ATTR gam
before: 8915027df75d0403ef013dd0cbf09ff3c602fd03   after: github:irgolic/nixpkgs/a4e862f94ddd4a16abd6335dc2219e085e4e4bee
before ok (0 built, 2s)
        drv /nix/store/…-gam-7.43.04.drv
after  ok (1 built, 18s)
        drv /nix/store/…-gam-7.43.04.drv

| output:path | before | after |
|---|---|---|
| out:/lib/python3.14/site-packages/gam/cacerts.pem | pem 26 certs: 1 not in cacert, 5 in cacert but not for TLS, 98 cacert TLS roots missing | symlink->cacert:ca-bundle.crt pem 169 certs (118 TLS roots + 51 non-TLS, i.e. cacert's own trust-rules bundle) |

inside archives (scanner only; a symlink in the installed output cannot reach them, issue #576542 class):
  before dist:/gam7-7.43.4-py3-none-any.whl!gam/cacerts.pem  roots=23
  after  dist:/gam7-7.43.4-py3-none-any.whl!gam/cacerts.pem  roots=23

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=BE, O=GlobalSign nv-sa, OU=Root CA, CN=GlobalSign Root CA
  - C=GB, O=COMODO CA Limited, CN=COMODO Certification Authority
  - C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Assured ID Root CA
  - C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Global Root CA
  - C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert High Assurance EV Root CA
  - C=US, O=Google Trust Services LLC, CN=GTS Root R2
VERDICT gam: FIXED: before trusted CAs outside cacert; after: 1 store(s) == cacert, none with extra CAs (+ bundles inside archives remain, see above)

base=8915027df75d0403ef013dd0cbf09ff3c602fd03 shim=shims/gam.nix
  package derivations to build for the matrix: 1 gam-7.43.04.drv
  before-stock: REFUSED -> /nix/store/…-ca-behave-gam-stock
  before-test: REFUSED -> /nix/store/…-ca-behave-gam-test
  after-stock: REFUSED -> /nix/store/…-ca-behave-gam-stock
  after-test: CONNECTED -> /nix/store/…-ca-behave-gam-test

gam  (before 8915027df75d0403ef013dd0cbf09ff3c602fd03, after github:irgolic/nixpkgs/a4e862f94ddd4a16abd6335dc2219e085e4e4bee)
         | stock cacert | + test root  | override with test-root cacert
before   | REFUSED      | REFUSED      | yes (rebuilt with cacert + test root)
after    | REFUSED      | CONNECTED    | yes (rebuilt with cacert + test root)
control (before cells): curl --cacert test-root: CONNECTED, curl --cacert stock: REFUSED
VERDICT gam: 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. The test starts gam without its wrapper and with a new configuration directory. Then gam downloads a URL from a local openssl s_server with create drivefile url, before it uses Google credentials. 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. A different problem occurs before and after this change. The bin/gam wrapper stops with exit code 127, because each --run line keeps its outer ' marks.

Things done

Assisted-by: Claude Code (Claude Fable 5.1)
Assisted-by: Claude Code (Claude Opus 5.5)
@nixpkgs-ci
nixpkgs-ci Bot requested a review from thanegill October 22, 2026 00:29
@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 22, 2026
@irgolic irgolic added the 1.severity: security Issues which raise a security issue, or PRs that fix one label Oct 22, 2026
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. llm-assisted Contributions that include code generation with LLMs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant