Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/clusterfuzz/_internal/bot/tasks/utasks/uworker_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,12 @@ def check_handling_testcase_safe(testcase):
safely."""
if testcase.trusted:
return
if not environment.get_value('UNTRUSTED_UTASK'):
# TODO(https://b.corp.google.com/issues/328691756): Change this to
# log_fatal_and_exit once we are handling untrusted tasks properly.
logs.warning(f'Cannot handle {testcase.key.id()} in trusted task.')
if environment.is_uworker():
return

logs.log_fatal_and_exit(
f'Security Violation: Cannot handle untrusted testcase '
f'{testcase.key.id()} in long-lived bot.')


def check_running_fuzzer_safe(fuzzer):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def setUp(self):
"""Set up."""
super().setUp()
environment.set_value('JOB_NAME', 'libfuzzer_asan_job')
environment.set_value('UWORKER', True)

patcher = mock.patch(
'clusterfuzz._internal.bot.fuzzers.libFuzzer.fuzzer.LibFuzzer.fuzzer_directory',
Expand Down Expand Up @@ -376,7 +377,7 @@ def test_check_app_path_exit(self, setup_testcase, preprocess_setup_testcase,
setup_testcase.return_value = ([], '/path', None)
del setup_build
del check_app_path
testcase = data_types.Testcase()
testcase = data_types.Testcase(trusted=True)
testcase.put()
environment.set_value('FAIL_WAIT', 10)
uworker_input = uworker_msg_pb2.Input(
Expand Down
1 change: 1 addition & 0 deletions src/clusterfuzz/_internal/tests/test_libs/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def create_generic_testcase(created_days_ago=28):
testcase.timestamp = CURRENT_TIME - datetime.timedelta(days=created_days_ago)
testcase.project_name = 'project'
testcase.platform = 'linux'
testcase.trusted = True
testcase.put()

return testcase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def setUp(self):
self.uworker_env = commands.update_environment_for_job(environment_string)
job.put()
self.fuzz_target = 'test_fuzzer'
self.testcase = data_types.Testcase(job_type=self.job_type)
self.testcase = data_types.Testcase(job_type=self.job_type, trusted=True)
self.testcase.fuzzed_keys = blobs.write_blob(
os.path.join(TEST_LIBS_DATA_DIR,
'crash-adc83b19e793491b1c6ea0fd8b46cd9f32e592fc'))
Expand Down
Loading