Repository navigation
[Backport release-26.05] beamPackages: inject cacert trust stores for deps that bundle root CA stores - #579058
Conversation
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)
There was a problem hiding this comment.
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.
master has hooks replacing mixRelease
|
|
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 |
erictapen
left a comment
There was a problem hiding this comment.
Okay, one step at a time, actually. This fixes the security issue, I'll open a second PR.
Things done
./result/bin/.nixpkgs-reviewon this PR. See nixpkgs-review usage.passthru.tests.