-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unsigned derivations uploaded to S3 #6960
Comments
We're seeing similar errors on Cachix side while I know they for sure get signed: cachix/cachix#428 Maybe client validation has changed somehow? |
I think both. I am maybe 60% sure I saw derivations with no signature (I checked using |
cc @edolstra, I think this is quite a serious regression on the Nix side. |
I had work create a second S3 bucket for testing, and re-ran CI against this bucket with Nix 2.10.3. After pulling down @domenkozar your client-side issue is probably real but different to this? |
Do you mean that the derivations are properly signed locally, but loose their signature when copied to the binary cache, or are they not signed at all? |
I havent investigated but I think I've witnessed something similar too. Is the cache mechanism tested in nix releases ? |
It is, of course, but you know, tests… |
I did not check this, but since the |
That's what I'd assume too, but I would like to get a confirmation just to be sure (and I couldn't reproduce it yet, so I can't check it myself) |
Oh actually it seems that I can reproduce it trivially and that not all the outputs are passed to the hook. Which obviously means that they aren't all signed. But an output that didn't get signed might still be copied because the copy is recursive (so if you copy something that depends on it, it'll be copied along the way) |
More precisely, what seems to happen (didn't check the code yet) is that the only outputs that Nix passes to the hook are the ones that Nix needs for the build (because something depends on it). The other ones (which are mostly a side-effect of the build at that point) aren't passed (and so aren't signed). |
A quick workaround might be to pass |
Ok I did, and it seems to be the case indeed as a side-effect of fe5509d : the list of paths passed to the hook is computed from the result of |
@JackKelly-Bellroy, you can also set the nix.conf value |
Along the lines of what @nrdxp suggested, adding the undocumented |
The docs used to recommend calling `nix store sign` in a post-build hook, but on more recent versions of nix, this results in unsigned store paths being copied into binary caches. See NixOS#6960 for details. Instead, use the `secret-key-files` config option, which signs all locally-built derivations with the private key.
The docs used to recommend calling `nix store sign` in a post-build hook, but on more recent versions of nix, this results in unsigned store paths being copied into binary caches. See NixOS#6960 for details. Instead, use the `secret-key-files` config option, which signs all locally-built derivations with the private key.
The docs used to recommend calling `nix store sign` in a post-build hook, but on more recent versions of nix, this results in unsigned store paths being copied into binary caches. See NixOS#6960 for details. Instead, use the `secret-key-files` config option, which signs all locally-built derivations with the private key.
* docs: Use secret-key-files when demonstrating post-build-hooks The docs used to recommend calling `nix store sign` in a post-build hook, but on more recent versions of nix, this results in unsigned store paths being copied into binary caches. See #6960 for details. Instead, use the `secret-key-files` config option, which signs all locally-built derivations with the private key. Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Discussed in Nix team meeting 2023-01-06:
|
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-01-06-nix-team-meeting-minutes-21/24573/1 |
There are several ways to sign things. Let's look at the current situation:
(If anything here is wrong, please point it out and it will be updated) non-regrettable steps
some complications
needs discussion/understanding
Signing more things by defaultUsers don't sign things because it can be confusing to get the settings right, frustrating to distribute keys safely, and managing signatures themselves is hard. A solution in this space requires a few things:
Proposal for discussionA store should be able to advertise a set of policies that must be true. This makes it easier for clients to check and verify those policies and provide better error messages. Example interactions:
|
Already done: #7408 changes the manual to recommend |
* docs: Use secret-key-files when demonstrating post-build-hooks The docs used to recommend calling `nix store sign` in a post-build hook, but on more recent versions of nix, this results in unsigned store paths being copied into binary caches. See NixOS#6960 for details. Instead, use the `secret-key-files` config option, which signs all locally-built derivations with the private key. Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-09-04-nix-team-meeting-minutes-85/32608/1 |
Describe the bug
On Nix 2.9.2 when signing/uploading store paths in CI using
post-build-hook
as suggested by the manual, unsigned derivations get uploaded to S3.Steps To Reproduce
post-build-hook
as per the manual:nix store gc
, ...),warning: the substitute for '/nix/store/whatever' from 's3://cache-bucket' is not signed by any of the keys in 'trusted-public-keys'
Expected behavior
All derivations uploaded to S3 are signed. I have confirmed that some of the derivations that make it to S3 are unsigned by using
nix path-info --json --sigs --store s3://cache-bucket /nix/store/whatever | jq
.Additional context
Nix 2.7 seems to work fine; Nix 2.8 was affected by #6446 which passed no paths at all to the post build hook. I suspect that leaves might be getting signed but not intermediate derivations; I'm not sure how to verify this. Should I be passing
-r
tonix store sign
? I can see little difference in hownix store sign
is implemented between versions 2.7.0 and 2.9.2.This makes me suspect the way the post-build-hook is invoked. On Nix 2.7.0:
nix/src/libstore/build/derivation-goal.cc
Lines 881 to 889 in ffe155a
On Nix 2.9.2:
nix/src/libstore/build/derivation-goal.cc
Lines 903 to 915 in f5070e2
But I don't know enough about Nix internals to know whether or not it's safe to go back to using
finalOutputs
here.The text was updated successfully, but these errors were encountered: