@@ -287,7 +287,7 @@ def setup_testcase(testcase: data_types.Testcase, job_type: str,
287287 _copy_testcase_to_device_and_setup_environment (testcase , testcase_file_path )
288288
289289 # Push testcases to worker.
290- if environment . is_trusted_host ():
290+ if take_trusted_host_path ():
291291 from clusterfuzz ._internal .bot .untrusted_runner import file_host
292292 file_host .push_testcases_to_worker ()
293293
@@ -467,6 +467,12 @@ def _prepare_update_data_bundle(fuzzer, data_bundle):
467467 return data_bundle_directory
468468
469469
470+ def take_trusted_host_path ():
471+ if environment .is_uworker ():
472+ return False
473+ return environment .is_trusted_host ()
474+
475+
470476def update_data_bundle (
471477 fuzzer : data_types .Fuzzer ,
472478 data_bundle_corpus : uworker_msg_pb2 .DataBundleCorpus ) -> bool : # pylint: disable=no-member
@@ -486,10 +492,12 @@ def update_data_bundle(
486492 # case, the fuzzer will generate testcases from a gcs bucket periodically.
487493 if not _is_search_index_data_bundle (data_bundle .name ):
488494
489- if not (environment .is_trusted_host () and data_bundle .sync_to_worker ):
495+ if not (take_trusted_host_path () and data_bundle .sync_to_worker ):
496+ logs .info ('Data bundles: normal path.' )
490497 result = corpus_manager .sync_data_bundle_corpus_to_disk (
491498 data_bundle_corpus , data_bundle_directory )
492499 else :
500+ logs .info ('Data bundles: untrusted runner path.' )
493501 from clusterfuzz ._internal .bot .untrusted_runner import \
494502 corpus_manager as untrusted_corpus_manager
495503 from clusterfuzz ._internal .bot .untrusted_runner import file_host
@@ -515,7 +523,7 @@ def update_data_bundle(
515523 # Write last synced time in the sync file.
516524 sync_file_path = _get_data_bundle_sync_file_path (data_bundle_directory )
517525 utils .write_data_to_file (time_before_sync_start , sync_file_path )
518- if environment . is_trusted_host () and data_bundle .sync_to_worker :
526+ if take_trusted_host_path () and data_bundle .sync_to_worker :
519527 from clusterfuzz ._internal .bot .untrusted_runner import file_host
520528 worker_sync_file_path = file_host .rebase_to_worker_root (sync_file_path )
521529 file_host .copy_file_to_worker (sync_file_path , worker_sync_file_path )
@@ -690,7 +698,7 @@ def update_fuzzer_and_data_bundles(
690698
691699 # For launcher script usecase, we need the entire fuzzer directory on the
692700 # worker.
693- if environment . is_trusted_host ():
701+ if take_trusted_host_path ():
694702 from clusterfuzz ._internal .bot .untrusted_runner import file_host
695703 worker_fuzzer_directory = file_host .rebase_to_worker_root (
696704 fuzzer_directory )
@@ -710,7 +718,7 @@ def _is_data_bundle_up_to_date(data_bundle, data_bundle_directory):
710718 """Return true if the data bundle is up to date, false otherwise."""
711719 sync_file_path = _get_data_bundle_sync_file_path (data_bundle_directory )
712720
713- if environment . is_trusted_host ( ) and data_bundle .sync_to_worker :
721+ if not ( take_trusted_host_path ( ) and data_bundle .sync_to_worker ) :
714722 from clusterfuzz ._internal .bot .untrusted_runner import file_host
715723 worker_sync_file_path = file_host .rebase_to_worker_root (sync_file_path )
716724 shell .remove_file (sync_file_path )
0 commit comments