mirror of https://github.com/google/oss-fuzz.git
[infra] Add block listed target name logic from ClusterFuzz (#6538)
* [infra] Add block listed target name logic from ClusterFuzz
This commit is contained in:
parent
ab547f1881
commit
5b4bd94235
|
@ -25,7 +25,8 @@ import helper
|
||||||
|
|
||||||
ALLOWED_FUZZ_TARGET_EXTENSIONS = ['', '.exe']
|
ALLOWED_FUZZ_TARGET_EXTENSIONS = ['', '.exe']
|
||||||
FUZZ_TARGET_SEARCH_STRING = 'LLVMFuzzerTestOneInput'
|
FUZZ_TARGET_SEARCH_STRING = 'LLVMFuzzerTestOneInput'
|
||||||
VALID_TARGET_NAME = re.compile(r'^[a-zA-Z0-9_-]+$')
|
VALID_TARGET_NAME_REGEX = re.compile(r'^[a-zA-Z0-9_-]+$')
|
||||||
|
BLOCKLISTED_TARGET_NAME_REGEX = re.compile(r'^(jazzer_driver.*)$')
|
||||||
|
|
||||||
# Location of google cloud storage for latest OSS-Fuzz builds.
|
# Location of google cloud storage for latest OSS-Fuzz builds.
|
||||||
GCS_BASE_URL = 'https://storage.googleapis.com/'
|
GCS_BASE_URL = 'https://storage.googleapis.com/'
|
||||||
|
@ -118,11 +119,17 @@ def is_fuzz_target_local(file_path):
|
||||||
Copied from clusterfuzz src/python/bot/fuzzers/utils.py
|
Copied from clusterfuzz src/python/bot/fuzzers/utils.py
|
||||||
with slight modifications.
|
with slight modifications.
|
||||||
"""
|
"""
|
||||||
|
# pylint: disable=too-many-return-statements
|
||||||
filename, file_extension = os.path.splitext(os.path.basename(file_path))
|
filename, file_extension = os.path.splitext(os.path.basename(file_path))
|
||||||
if not VALID_TARGET_NAME.match(filename):
|
if not VALID_TARGET_NAME_REGEX.match(filename):
|
||||||
# Check fuzz target has a valid name (without any special chars).
|
# Check fuzz target has a valid name (without any special chars).
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
if BLOCKLISTED_TARGET_NAME_REGEX.match(filename):
|
||||||
|
# Check fuzz target an explicitly disallowed name (e.g. binaries used for
|
||||||
|
# jazzer-based targets).
|
||||||
|
return False
|
||||||
|
|
||||||
if file_extension not in ALLOWED_FUZZ_TARGET_EXTENSIONS:
|
if file_extension not in ALLOWED_FUZZ_TARGET_EXTENSIONS:
|
||||||
# Ignore files with disallowed extensions (to prevent opening e.g. .zips).
|
# Ignore files with disallowed extensions (to prevent opening e.g. .zips).
|
||||||
return False
|
return False
|
||||||
|
|
Loading…
Reference in New Issue