From 808352e5473f90b4042370e037788d3793f4b8c3 Mon Sep 17 00:00:00 2001 From: Alberto Sartori Date: Wed, 15 Nov 2023 16:08:18 +0100 Subject: just-execute: verify the validity of all the hashes received over the wire --- src/buildtool/execution_api/execution_service/operations_server.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/buildtool/execution_api/execution_service/operations_server.cpp') diff --git a/src/buildtool/execution_api/execution_service/operations_server.cpp b/src/buildtool/execution_api/execution_service/operations_server.cpp index 37d3552a..228b3595 100644 --- a/src/buildtool/execution_api/execution_service/operations_server.cpp +++ b/src/buildtool/execution_api/execution_service/operations_server.cpp @@ -15,12 +15,17 @@ #include "src/buildtool/execution_api/execution_service/operations_server.hpp" #include "src/buildtool/execution_api/execution_service/operation_cache.hpp" +#include "src/utils/cpp/verify_hash.hpp" auto OperarationsServiceImpl::GetOperation( ::grpc::ServerContext* /*context*/, const ::google::longrunning::GetOperationRequest* request, ::google::longrunning::Operation* response) -> ::grpc::Status { auto const& hash = request->name(); + if (auto error_msg = IsAHash(hash); error_msg) { + logger_.Emit(LogLevel::Debug, *error_msg); + return ::grpc::Status{::grpc::StatusCode::INVALID_ARGUMENT, *error_msg}; + } logger_.Emit(LogLevel::Trace, "GetOperation: {}", hash); std::optional<::google::longrunning::Operation> op; op = OperationCache::Query(hash); -- cgit v1.2.3