summaryrefslogtreecommitdiff
path: root/src/buildtool/execution_api/common/tree_reader_utils.cpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-09-13 15:38:20 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-09-16 10:01:34 +0200
commit0a9ff3a87edcf6dd8fe0a1f68083f25c90f513b6 (patch)
treea5fa084f6dff890e1a4ce318d428f3adf525d5b4 /src/buildtool/execution_api/common/tree_reader_utils.cpp
parent981ff03fb9bd229406c49f2c2f9837298f8fd878 (diff)
downloadjustbuild-0a9ff3a87edcf6dd8fe0a1f68083f25c90f513b6.tar.gz
local execution: Check validity of symlinks
Invalid entries, currently all upwards symlinks (pending implementation of a better way of handling them), are now identified and handled similarly to remote execution: in compatible mode on the client side, during handling of local response, and in native mode during the population of the local action result.
Diffstat (limited to 'src/buildtool/execution_api/common/tree_reader_utils.cpp')
-rw-r--r--src/buildtool/execution_api/common/tree_reader_utils.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/buildtool/execution_api/common/tree_reader_utils.cpp b/src/buildtool/execution_api/common/tree_reader_utils.cpp
index 855c1842..13775201 100644
--- a/src/buildtool/execution_api/common/tree_reader_utils.cpp
+++ b/src/buildtool/execution_api/common/tree_reader_utils.cpp
@@ -106,6 +106,12 @@ auto TreeReaderUtils::ReadObjectInfos(bazel_re::Directory const& dir,
}
for (auto const& l : dir.symlinks()) {
+ // check validity of symlinks
+ if (not PathIsNonUpwards(l.target())) {
+ Logger::Log(
+ LogLevel::Error, "found invalid symlink at {}", l.name());
+ return false;
+ }
if (not store_info(l.name(), CreateObjectInfo(hash_function, l))) {
return false;
}