Skip to content

[Backport release-26.05] beamPackages: inject cacert trust stores for deps that bundle root CA stores - #579058

Merged
erictapen merged 5 commits into
NixOS:release-26.05from
adamcstephens:push-yymvvrzypytt
Oct 26, 2026
Merged

erictapen merged 5 commits into
NixOS:release-26.05from
adamcstephens:push-yymvvrzypytt

Conversation

@adamcstephens

Copy link
Copy Markdown
Contributor
  • beamPackages.buildMix: replace castore bundle with cacert
  • beamPackages.mixRelease: replace castore bundle with cacert
  • beamPackages.buildRebar3: replace certifi bundle with cacert
  • beamPackages.mixRelease: replace certifi bundle with cacert
  • beamPackages.hex: replace bundled CA certs with cacert

Things done

Assisted-By: Claude Opus 5.5 low in claude-code/2.1.303
(cherry picked from commit 84a7dc6)
Assisted-By: Claude Opus 5.5 low in claude-code/2.1.303
(cherry picked from commit af76982)
Assisted-By: Claude Opus 5.5 low in claude-code/2.1.303
(cherry picked from commit 38c94b1)
Assisted-By: Claude Opus 5.5 low in claude-code/2.1.303
(cherry picked from commit fdb7d51)
Assisted-By: Claude Opus 5.5 low in claude-code/2.1.303
(cherry picked from commit 6f736f3)

@nixpkgs-commit-check nixpkgs-commit-check Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This report is automatically generated by the PR / Check / cherry-pick CI workflow.

Some of the commits in this PR require the author's and reviewer's attention.

Sometimes it is not possible to cherry-pick exactly the same patch.
This most frequently happens when resolving merge conflicts.
The range-diff will help to review the resolution of conflicts.

If you need to merge this PR despite the warnings, please dismiss this review shortly before merging.

Warning

Difference between e106df6 and original af76982 may warrant inspection.

Show diff
@@ Metadata
 Author: Adam C. Stephens <[email protected]>
 
  ## Commit message ##
-    beamPackages.mixFodDepsSetupHook: replace castore bundle with cacert
+    beamPackages.mixRelease: replace castore bundle with cacert
 
     Assisted-By: Claude Opus 5.5 low in claude-code/2.1.303
+    (cherry picked from commit af769820752c71bea3f5288d7b7e9be6a8dccf31)
 
- ## pkgs/development/beam-modules/hooks/default.nix ##
+ ## pkgs/development/beam-modules/mix-release.nix ##
 @@
- {
+   gnugrep,
+   gawk,
+   mixBuildDirHook,
 +  cacert,
-   lib,
-   makeSetupHook,
- }:
-@@
- 
-   mixFodDepsSetupHook = makeSetupHook {
-     name = "mix-fod-deps-setup-hook";
-+    substitutions.caBundle = "${cacert}/etc/ssl/certs/ca-bundle.crt";
-     meta.license = lib.licenses.mit;
-   } ./mix-fod-deps-setup-hook.sh;
+ }@inputs:
  
-
- ## pkgs/development/beam-modules/hooks/mix-fod-deps-setup-hook.sh ##
-@@ pkgs/development/beam-modules/hooks/mix-fod-deps-setup-hook.sh: mixFodDepsPostUnpack() {
+ {
+@@ pkgs/development/beam-modules/mix-release.nix: stdenv.mkDerivation (
          # writable, thus a copy to the $TEMPDIR is inevitable here.
          export MIX_DEPS_PATH="$TEMPDIR/deps"
          cp --no-preserve=mode -R "${mixFodDeps}" "$MIX_DEPS_PATH"
 +
 +        if [ -f "$MIX_DEPS_PATH/castore/priv/cacerts.pem" ]; then
-+      cp @caBundle@ "$MIX_DEPS_PATH/castore/priv/cacerts.pem"
++          cp "${cacert}/etc/ssl/certs/ca-bundle.crt" "$MIX_DEPS_PATH/castore/priv/cacerts.pem"
 +        fi
-   fi
- 
-   echo "Finished mixFodDepsPostUnpack"
+       ''}
+     ''
+     + (attrs.postUnpack or "");

Warning

Difference between 9b040d4 and original fdb7d51 may warrant inspection.

Show diff
@@ Metadata
 Author: Adam C. Stephens <[email protected]>
 
  ## Commit message ##
-    beamPackages.mixFodDepsSetupHook: replace certifi bundle with cacert
+    beamPackages.mixRelease: replace certifi bundle with cacert
 
     Assisted-By: Claude Opus 5.5 low in claude-code/2.1.303
+    (cherry picked from commit fdb7d51bd12101fdc6e6c44f3531c104b19a48ee)
 
- ## pkgs/development/beam-modules/hooks/mix-fod-deps-setup-hook.sh ##
-@@ pkgs/development/beam-modules/hooks/mix-fod-deps-setup-hook.sh: mixFodDepsPostUnpack() {
+ ## pkgs/development/beam-modules/mix-release.nix ##
+@@ pkgs/development/beam-modules/mix-release.nix: stdenv.mkDerivation (
          export MIX_DEPS_PATH="$TEMPDIR/deps"
          cp --no-preserve=mode -R "${mixFodDeps}" "$MIX_DEPS_PATH"
  
 -        if [ -f "$MIX_DEPS_PATH/castore/priv/cacerts.pem" ]; then
--      cp @caBundle@ "$MIX_DEPS_PATH/castore/priv/cacerts.pem"
+-          cp "${cacert}/etc/ssl/certs/ca-bundle.crt" "$MIX_DEPS_PATH/castore/priv/cacerts.pem"
 -        fi
 +        local dep
 +        for dep in castore certifi; do
 +          if [ -f "$MIX_DEPS_PATH/$dep/priv/cacerts.pem" ]; then
-+        cp @caBundle@ "$MIX_DEPS_PATH/$dep/priv/cacerts.pem"
++            cp "${cacert}/etc/ssl/certs/ca-bundle.crt"  "$MIX_DEPS_PATH/$dep/priv/cacerts.pem"
 +          fi
 +        done
-   fi
- 
-   echo "Finished mixFodDepsPostUnpack"
+       ''}
+     ''
+     + (attrs.postUnpack or "");

Hint: The full diffs are also available in the runner logs with slightly better highlighting.

@adamcstephens
adamcstephens dismissed nixpkgs-commit-check[bot]’s stale review October 26, 2026 02:47

master has hooks replacing mixRelease

@nixpkgs-ci
nixpkgs-ci Bot requested review from a team and ericbmerritt October 26, 2026 02:51
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. llm-assisted Contributions that include code generation with LLMs 6.topic: erlang General-purpose, concurrent, functional high-level programming language 4.workflow: backport This targets a stable branch labels Oct 26, 2026
@adamcstephens

Copy link
Copy Markdown
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 579058
Commit: bfee74d6267700908e4271d2d111668580122b88


x86_64-linux

⏩ 4 packages marked as broken and skipped:
  • firezone-server-domain
  • firezone-server
  • firezone-server-web
  • firezone-server-api
✅ 30 packages built:
  • beamMinimal27Packages.hex
  • beamMinimal28Packages.hex
  • akkoma
  • livebook (beamMinimal28Packages.livebook)
  • beamMinimal27Packages.livebook
  • beamMinimal29Packages.hex
  • beamMinimal28Packages.expert
  • beamMinimal29Packages.expert
  • beamMinimal29Packages.ex_doc
  • beamMinimal28Packages.ex_doc
  • beamMinimal29Packages.livebook
  • beamMinimal27Packages.ex_doc
  • beamMinimal27Packages.expert
  • beam27Packages.hex
  • beam29Packages.hex
  • beam28Packages.hex
  • beam28Packages.ex_doc
  • ex_doc (beam27Packages.ex_doc)
  • beam28Packages.expert
  • beam28Packages.livebook
  • protoc-gen-elixir
  • pinchflat
  • beam27Packages.livebook
  • beam27Packages.expert
  • beam29Packages.livebook
  • beam29Packages.expert
  • beam29Packages.ex_doc
  • plausible
  • pleroma
  • mobilizon

@erictapen

Copy link
Copy Markdown
Member

I just realised that this actually copies the cert store. We shouldn't do this but do symlinks. If we ever want to have automated scanning for this kind of problem, the scanner would detect this as a false positive. I'll open something for master and amend here…

@erictapen erictapen 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.

Okay, one step at a time, actually. This fixes the security issue, I'll open a second PR.

@erictapen
erictapen added this pull request to the merge queue Oct 26, 2026
@nixpkgs-ci nixpkgs-ci Bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Oct 26, 2026
Merged via the queue into NixOS:release-26.05 with commit a26fb13 Oct 26, 2026
37 checks passed
@adamcstephens
adamcstephens deleted the push-yymvvrzypytt branch October 26, 2026 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.workflow: backport This targets a stable branch 6.topic: erlang General-purpose, concurrent, functional high-level programming language 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 12.approvals: 1 This PR was reviewed and approved by one person. llm-assisted Contributions that include code generation with LLMs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants