From a724158512441e6d7b17b991e52e2099817a3033 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sat, 18 Jul 2020 15:40:32 -0400 Subject: fix(3p/nix/nix-daemon): Add assertStorePath to all proto impls I missed calling store_->assertStorePath on paths in several daemon proto handlers, which the previous implementation did. Change-Id: Ifad6eeb03b5a5babec7b4bcf7aca060813f15bb7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1272 Tested-by: BuildkiteCI Reviewed-by: tazjin --- third_party/nix/src/nix-daemon/nix-daemon-proto.cc | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'third_party/nix/src/nix-daemon') diff --git a/third_party/nix/src/nix-daemon/nix-daemon-proto.cc b/third_party/nix/src/nix-daemon/nix-daemon-proto.cc index d94e34cb40cd..1717e6df5c90 100644 --- a/third_party/nix/src/nix-daemon/nix-daemon-proto.cc +++ b/third_party/nix/src/nix-daemon/nix-daemon-proto.cc @@ -94,6 +94,7 @@ class WorkerServiceImpl final : public WorkerService::Service { StorePaths* response) override { const auto paths = store_->queryAllValidPaths(); for (const auto& path : paths) { + store_->assertStorePath(path); response->add_paths(path); } @@ -103,6 +104,7 @@ class WorkerServiceImpl final : public WorkerService::Service { Status QueryPathInfo(grpc::ServerContext* context, const StorePath* request, PathInfo* response) override { auto path = request->path(); + store_->assertStorePath(path); try { auto info = store_->queryPathInfo(path); response->mutable_deriver()->set_path(info->deriver); @@ -137,6 +139,7 @@ class WorkerServiceImpl final : public WorkerService::Service { grpc::ServerContext* context, const StorePath* request, nix::proto::DerivationOutputNames* response) override { auto path = request->path(); + store_->assertStorePath(path); auto names = store_->queryDerivationOutputNames(path); for (const auto& name : names) { response->add_names(name); @@ -150,6 +153,7 @@ class WorkerServiceImpl final : public WorkerService::Service { StorePath* response) override { auto hash_part = request->hash_part(); auto path = store_->queryPathFromHashPart(hash_part); + store_->assertStorePath(path); response->set_path(path); return Status::OK; } @@ -159,6 +163,7 @@ class WorkerServiceImpl final : public WorkerService::Service { StorePaths* response) override { std::set paths; for (const auto& path : request->paths()) { + store_->assertStorePath(path); paths.insert(path); } @@ -176,6 +181,7 @@ class WorkerServiceImpl final : public WorkerService::Service { StorePaths* response) override { std::set paths; for (const auto& path : request->paths()) { + store_->assertStorePath(path); paths.insert(path); } @@ -245,6 +251,7 @@ class WorkerServiceImpl final : public WorkerService::Service { nix::proto::QueryMissingResponse* response) override { std::set targets; for (auto& path : request->paths()) { + store_->assertStorePath(path); targets.insert(path); } PathSet will_build; -- cgit 1.4.1