1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 23:13:14 +02:00
nix/src
Adam Joseph e43bb655fe libstore/daemon.cc: note trust model difference in readDerivation()s
Below the comment added by this commit is a much longer comment
followed by a trust check, both of which have confused me on at
least two occasions.  I figured it out once, forgot it, then had to
ask @Ericson2314 to explain it, at which point I understood it
again.  I think this might confuse other people too, or maybe I will
just forget it a third time.  So let's add a comment.

Farther down in the function is the following check:

```
if (!(drvType.isCA() || trusted))
  throw Error("you are not privileged to build input-addressed derivations");
```

This seems really strange at first.  A key property of Nix is that
you can compute the outpath of a derivation using the derivation
(and its references-closure) without trusting anybody!

The missing insight is that at this point in the code the builder
doesn't necessarily have the references-closure of the derivation
being built, and therefore needs to trust that the derivation's
outPath is honest.  It's incredibly easy to overlook this, because
the only difference between these two cases is which of these
identically-named functions we used:

- `readDerivation(Source,Store)`
- `Store::readDerivation()`

These functions have different trust models (except in the special
case where the first function is used on the local store).  We
should call the reader's attention to this fact.

Co-authored-by: Cole Helbling <cole.e.helbling@outlook.com>
2023-12-10 17:47:07 -08:00
..
build-remote Allow dynamic derivation deps in inputDrvs 2023-09-07 10:39:37 -04:00
libcmd Merge pull request #9497 from edolstra/move-access-control 2023-12-08 22:21:50 +01:00
libexpr document fetchTree (#9258) 2023-12-10 05:16:32 +00:00
libfetchers Merge pull request #9497 from edolstra/move-access-control 2023-12-08 22:21:50 +01:00
libmain Use buildprefix in a few more places 2023-11-29 19:49:07 -05:00
libstore libstore/daemon.cc: note trust model difference in readDerivation()s 2023-12-10 17:47:07 -08:00
libutil Clarify SourceAccessor methods should never implicitly follow symlinks 2023-12-08 20:00:47 -05:00
nix document fetchTree (#9258) 2023-12-10 05:16:32 +00:00
nix-build Merge pull request #9497 from edolstra/move-access-control 2023-12-08 22:21:50 +01:00
nix-channel Split up util.{hh,cc} 2023-11-05 12:20:02 -05:00
nix-collect-garbage Split up util.{hh,cc} 2023-11-05 12:20:02 -05:00
nix-copy-closure Restrict some code to StoreDirConfig 2023-11-04 19:05:36 -04:00
nix-env PosixSourceAccessor: Don't follow any symlinks 2023-12-05 23:02:59 +01:00
nix-instantiate Move restricted/pure-eval access control out of the evaluator and into the accessor 2023-11-30 16:16:17 +01:00
nix-store Create ServeProto::BuildOptions and a serializer for it 2023-12-09 11:35:13 -05:00
resolve-system-dependencies Remove FormatOrString and remaining uses of format() 2023-03-02 15:57:54 +01:00
toml11 Replace cpptoml with toml11 2021-12-17 22:03:33 +01:00