aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/daemon.cc
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-09-30 00:42:28 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-09-30 00:42:28 +0000
commit69afaeace355ab78010f0d849206ef4a4805d016 (patch)
treea8553d4eb406861149736443938a293c1a64ee8d /src/libstore/daemon.cc
parentb7597016529cebdc3c9432a101c1f8d9227713cc (diff)
parent76f000712ed3aa8f258d68fc5ef036f1255dfada (diff)
Merge remote-tracking branch 'upstream/master' into templated-daemon-protocol
Diffstat (limited to 'src/libstore/daemon.cc')
-rw-r--r--src/libstore/daemon.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libstore/daemon.cc b/src/libstore/daemon.cc
index 0713c4853..ae2fbec35 100644
--- a/src/libstore/daemon.cc
+++ b/src/libstore/daemon.cc
@@ -546,6 +546,20 @@ static void performOp(TunnelLogger * logger, ref<Store> store,
are in fact content-addressed if we don't trust them. */
assert(derivationIsCA(drv.type()) || trusted);
+ /* Recompute the derivation path when we cannot trust the original. */
+ if (!trusted) {
+ /* Recomputing the derivation path for input-address derivations
+ makes it harder to audit them after the fact, since we need the
+ original not-necessarily-resolved derivation to verify the drv
+ derivation as adequate claim to the input-addressed output
+ paths. */
+ assert(derivationIsCA(drv.type()));
+
+ Derivation drv2;
+ static_cast<BasicDerivation &>(drv2) = drv;
+ drvPath = writeDerivation(*store, Derivation { drv2 });
+ }
+
auto res = store->buildDerivation(drvPath, drv, buildMode);
logger->stopWork();
to << res.status << res.errorMsg;