diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2025-05-16 17:35:41 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2025-06-04 14:34:44 +0200 |
commit | dd9fa2841fcb5983b4ea845d5f9dc1b635d8dd18 (patch) | |
tree | bdd2fb1206d3d3e3d9fda6ebdfbbfd8c6aca8d4e /src/buildtool/execution_engine/executor/executor.hpp | |
parent | 82cae74799e5a64c819556f6152ba3734f1e2035 (diff) | |
download | justbuild-dd9fa2841fcb5983b4ea845d5f9dc1b635d8dd18.tar.gz |
Executor: Check validity of action outputs in compatible mode
This ensures that any entries that the standard remote execution
protocol accepts but are invalid in justbuild, i.e., upwards
symlinks, are rejected.
For this purpose, do not fail in the action response instances,
just perform the check there, as all required information is
available, and set a flag that the executor can check as needed.
Diffstat (limited to 'src/buildtool/execution_engine/executor/executor.hpp')
-rw-r--r-- | src/buildtool/execution_engine/executor/executor.hpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/buildtool/execution_engine/executor/executor.hpp b/src/buildtool/execution_engine/executor/executor.hpp index cfdbf9fc..2d86a405 100644 --- a/src/buildtool/execution_engine/executor/executor.hpp +++ b/src/buildtool/execution_engine/executor/executor.hpp @@ -237,9 +237,30 @@ class ExecutorImpl { // set action options remote_action->SetCacheFlag(cache_flag); remote_action->SetTimeout(timeout); + + // execute action auto result = remote_action->Execute(&logger); - if (alternative_api) { - if (result) { + + // process result + if (result) { + // in compatible mode, check that all artifacts are valid + if (not ProtocolTraits::IsNative(api.GetHashType())) { + auto upwards_symlinks_check = result->HasUpwardsSymlinks(); + if (not upwards_symlinks_check) { + logger.Emit(LogLevel::Error, + upwards_symlinks_check.error()); + return nullptr; + } + if (upwards_symlinks_check.value()) { + logger.Emit( + LogLevel::Error, + "Executed action produced invalid outputs -- " + "upwards symlinks"); + return nullptr; + } + } + // if alternative endpoint used, transfer any missing blobs + if (alternative_api) { auto const artifacts = result->Artifacts(); if (not artifacts) { logger.Emit(LogLevel::Error, artifacts.error()); |