aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/local-store.hh
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2021-01-15 16:37:41 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2021-01-15 16:37:41 +0000
commit7af743470c09b835f910d2e25786c080ccfe52c1 (patch)
tree5d91f16367e376c75d3e93923fd9786191c20ea5 /src/libstore/local-store.hh
parent0027b05a15e5845c5ce70c86b5b1a34e7caff039 (diff)
Make public keys and `requireSigs` local-store specific again
Thanks @regnat and @edolstra for catching this and comming up with the solution. They way I had generalized those is wrong, because local settings for non-local stores is confusing default. And due to the nature of C++ inheritance, fixing the defaults is more annoying than it should be. Additionally, I thought we might just drop the check in the substitution logic since `Store::addToStore` is now streaming, but @regnat rightfully pointed out that as it downloads dependencies first, that would still be too late, and also waste effort on possibly unneeded/unwanted dependencies. The simple and correct thing to do is just make a store method for the boolean logic, keeping all the setting and key stuff the way it was before. That new method is both used by `LocalStore::addToStore` and the substitution goal check. Perhaps we might eventually make it fancier, e.g. sending the ValidPathInfo to remote stores for them to validate, but this is good enough for now.
Diffstat (limited to 'src/libstore/local-store.hh')
-rw-r--r--src/libstore/local-store.hh14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh
index 69704d266..9d235ba0a 100644
--- a/src/libstore/local-store.hh
+++ b/src/libstore/local-store.hh
@@ -35,6 +35,10 @@ struct LocalStoreConfig : virtual LocalFSStoreConfig
{
using LocalFSStoreConfig::LocalFSStoreConfig;
+ Setting<bool> requireSigs{(StoreConfig*) this,
+ settings.requireSigs,
+ "require-sigs", "whether store paths should have a trusted signature on import"};
+
const std::string name() override { return "Local Store"; }
};
@@ -71,6 +75,8 @@ private:
minFree but not much below availAfterGC, then there is no
point in starting a new GC. */
uint64_t availAfterGC = std::numeric_limits<uint64_t>::max();
+
+ std::unique_ptr<PublicKeys> publicKeys;
};
Sync<State> _state;
@@ -88,6 +94,12 @@ public:
const Path tempRootsDir;
const Path fnTempRoots;
+private:
+
+ const PublicKeys & getPublicKeys();
+
+public:
+
// Hack for build-remote.cc.
PathSet locksHeld;
@@ -124,6 +136,8 @@ public:
void querySubstitutablePathInfos(const StorePathCAMap & paths,
SubstitutablePathInfos & infos) override;
+ bool pathInfoIsTrusted(const ValidPathInfo &) override;
+
void addToStore(const ValidPathInfo & info, Source & source,
RepairFlag repair, CheckSigsFlag checkSigs) override;