about summary refs log tree commit diff
path: root/third_party/nix/src/nix-daemon/nix-daemon-proto.cc
diff options
context:
space:
mode:
authorGriffin Smith <grfn@gws.fyi>2020-07-18T19·40-0400
committerglittershark <grfn@gws.fyi>2020-07-18T19·52+0000
commita724158512441e6d7b17b991e52e2099817a3033 (patch)
treeebefb050d122ee1093cc331b9b0288ddbecd7482 /third_party/nix/src/nix-daemon/nix-daemon-proto.cc
parentecf288e70aa32d532bed79f8d940c349419ce0e8 (diff)
fix(3p/nix/nix-daemon): Add assertStorePath to all proto impls r/1384
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 <mail@tazj.in>
Diffstat (limited to '')
-rw-r--r--third_party/nix/src/nix-daemon/nix-daemon-proto.cc7
1 files changed, 7 insertions, 0 deletions
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 d94e34cb40..1717e6df5c 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<Path> 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<Path> 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<Path> targets;
     for (auto& path : request->paths()) {
+      store_->assertStorePath(path);
       targets.insert(path);
     }
     PathSet will_build;