diff options
author | Alberto Sartori <alberto.sartori@huawei.com> | 2023-11-15 16:08:18 +0100 |
---|---|---|
committer | Alberto Sartori <alberto.sartori@huawei.com> | 2023-11-15 16:43:33 +0100 |
commit | 808352e5473f90b4042370e037788d3793f4b8c3 (patch) | |
tree | 1e49afff0eeafe875796d063f06a0941ff541255 /src/buildtool/execution_api/execution_service/ac_server.cpp | |
parent | e3e3cba99c06d1ee56200800fce727f8c5dd4d41 (diff) | |
download | justbuild-808352e5473f90b4042370e037788d3793f4b8c3.tar.gz |
just-execute: verify the validity of all the hashes received over the wire
Diffstat (limited to 'src/buildtool/execution_api/execution_service/ac_server.cpp')
-rw-r--r-- | src/buildtool/execution_api/execution_service/ac_server.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/buildtool/execution_api/execution_service/ac_server.cpp b/src/buildtool/execution_api/execution_service/ac_server.cpp index 304d70dd..a83ba8a9 100644 --- a/src/buildtool/execution_api/execution_service/ac_server.cpp +++ b/src/buildtool/execution_api/execution_service/ac_server.cpp @@ -14,13 +14,19 @@ #include "src/buildtool/execution_api/execution_service/ac_server.hpp" -#include "fmt/core.h" +#include <fmt/core.h> + #include "src/buildtool/storage/garbage_collector.hpp" +#include "src/utils/cpp/verify_hash.hpp" auto ActionCacheServiceImpl::GetActionResult( ::grpc::ServerContext* /*context*/, const ::bazel_re::GetActionResultRequest* request, ::bazel_re::ActionResult* response) -> ::grpc::Status { + if (auto error_msg = IsAHash(request->action_digest().hash()); error_msg) { + logger_.Emit(LogLevel::Debug, *error_msg); + return ::grpc::Status{::grpc::StatusCode::INVALID_ARGUMENT, *error_msg}; + } logger_.Emit(LogLevel::Trace, "GetActionResult: {}", request->action_digest().hash()); |