Add files using upload-large-folder tool
Browse files- local-test-tika-full-01-vuln_8/fuzz-tooling/infra/__pycache__/constants.cpython-312.pyc +0 -0
- local-test-tika-full-01-vuln_8/fuzz-tooling/infra/__pycache__/templates.cpython-312.pyc +0 -0
- local-test-tika-full-01-vuln_8/fuzz-tooling/infra/base-images/README.md +6 -0
- local-test-tika-full-01-vuln_8/fuzz-tooling/infra/base-images/aixcc_build_all.sh +59 -0
- local-test-tika-full-01-vuln_8/fuzz-tooling/infra/ci/build.py +292 -0
- local-test-tika-full-01-vuln_8/fuzz-tooling/infra/ci/build_test.py +124 -0
- local-test-tika-full-01-vuln_8/fuzz-tooling/infra/cifuzz/affected_fuzz_targets.py +113 -0
- local-test-tika-full-01-vuln_8/fuzz-tooling/infra/cifuzz/build-images.sh +34 -0
- local-test-tika-full-01-vuln_8/fuzz-tooling/infra/cifuzz/build_fuzzers_entrypoint.py +60 -0
- local-test-tika-full-01-vuln_8/fuzz-tooling/infra/cifuzz/clusterfuzz_deployment.py +385 -0
- local-test-tika-full-01-vuln_8/fuzz-tooling/infra/cifuzz/http_utils_test.py +71 -0
- local-test-tika-full-01-vuln_8/fuzz-tooling/infra/cifuzz/run_cifuzz.py +89 -0
- local-test-tika-full-01-vuln_8/fuzz-tooling/infra/uploader/Dockerfile +7 -0
- local-test-tika-full-01-vuln_8/fuzz-tooling/tools/vscode-extension/src/commands/cmdBuildFuzzerFromWorkspace.ts +80 -0
- local-test-tika-full-01-vuln_8/fuzz-tooling/tools/vscode-extension/src/commands/cmdBuildFuzzerFromWorkspaceCFLite.ts +49 -0
- local-test-tika-full-01-vuln_8/fuzz-tooling/tools/vscode-extension/src/commands/cmdDisplayCoverage.ts +71 -0
- local-test-tika-full-01-vuln_8/fuzz-tooling/tools/vscode-extension/src/commands/cmdFIGetOptimalTargets.ts +21 -0
- local-test-tika-full-01-vuln_8/fuzz-tooling/tools/vscode-extension/src/commands/cmdRunFI.ts +24 -0
- local-test-tika-full-01-vuln_8/fuzz-tooling/tools/vscode-extension/src/commands/cmdSetOSSFuzzPath.ts +59 -0
- local-test-tika-full-01-vuln_8/fuzz-tooling/tools/vscode-extension/src/commands/cmdTestFuzzer.ts +90 -0
local-test-tika-full-01-vuln_8/fuzz-tooling/infra/__pycache__/constants.cpython-312.pyc
ADDED
|
Binary file (802 Bytes). View file
|
|
|
local-test-tika-full-01-vuln_8/fuzz-tooling/infra/__pycache__/templates.cpython-312.pyc
ADDED
|
Binary file (3.04 kB). View file
|
|
|
local-test-tika-full-01-vuln_8/fuzz-tooling/infra/base-images/README.md
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Building all infra images:
|
| 2 |
+
|
| 3 |
+
```bash
|
| 4 |
+
# run from project root
|
| 5 |
+
infra/base-images/all.sh
|
| 6 |
+
```
|
local-test-tika-full-01-vuln_8/fuzz-tooling/infra/base-images/aixcc_build_all.sh
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash -eux
|
| 2 |
+
|
| 3 |
+
if [ "$1" = "--cache-from" ]; then
|
| 4 |
+
PULL_CACHE=1
|
| 5 |
+
shift
|
| 6 |
+
CACHE_TAG="${1//\//-}" # s/\//-/g -> for branch names that contain slashes
|
| 7 |
+
shift
|
| 8 |
+
elif [ "$1" = "--cache-to" ]; then
|
| 9 |
+
PUSH_CACHE=1
|
| 10 |
+
shift
|
| 11 |
+
CACHE_TAG="${1//\//-}" # s/\//-/g -> for branch names that contain slashes
|
| 12 |
+
shift
|
| 13 |
+
fi
|
| 14 |
+
|
| 15 |
+
ARG_TAG="$1"
|
| 16 |
+
shift
|
| 17 |
+
|
| 18 |
+
BASE_IMAGES=(
|
| 19 |
+
"ghcr.io/aixcc-finals/base-image infra/base-images/base-image"
|
| 20 |
+
"ghcr.io/aixcc-finals/base-clang infra/base-images/base-clang"
|
| 21 |
+
"ghcr.io/aixcc-finals/base-builder infra/base-images/base-builder"
|
| 22 |
+
"ghcr.io/aixcc-finals/base-builder-go infra/base-images/base-builder-go"
|
| 23 |
+
"ghcr.io/aixcc-finals/base-builder-jvm infra/base-images/base-builder-jvm"
|
| 24 |
+
"ghcr.io/aixcc-finals/base-builder-python infra/base-images/base-builder-python"
|
| 25 |
+
"ghcr.io/aixcc-finals/base-builder-rust infra/base-images/base-builder-rust"
|
| 26 |
+
"ghcr.io/aixcc-finals/base-builder-ruby infra/base-images/base-builder-ruby"
|
| 27 |
+
"ghcr.io/aixcc-finals/base-builder-swift infra/base-images/base-builder-swift"
|
| 28 |
+
"ghcr.io/aixcc-finals/base-runner infra/base-images/base-runner"
|
| 29 |
+
"ghcr.io/aixcc-finals/base-runner-debug infra/base-images/base-runner-debug"
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
for tuple in "${BASE_IMAGES[@]}"; do
|
| 33 |
+
read -r image path <<< "$tuple"
|
| 34 |
+
|
| 35 |
+
if [ "${PULL_CACHE+x}" ]; then
|
| 36 |
+
|
| 37 |
+
docker buildx build \
|
| 38 |
+
--build-arg IMG_TAG="${ARG_TAG}" \
|
| 39 |
+
--cache-from=type=registry,ref="${image}:${CACHE_TAG}" \
|
| 40 |
+
--tag "${image}:${ARG_TAG}" --push "$@" "${path}"
|
| 41 |
+
|
| 42 |
+
elif [ "${PUSH_CACHE+x}" ]; then
|
| 43 |
+
|
| 44 |
+
docker buildx build \
|
| 45 |
+
--build-arg IMG_TAG="${ARG_TAG}" \
|
| 46 |
+
--cache-from=type=registry,ref="${image}:${CACHE_TAG}" \
|
| 47 |
+
--cache-to=type=registry,ref="${image}:${CACHE_TAG}",mode=max \
|
| 48 |
+
--tag "${image}:${ARG_TAG}" --push "$@" "${path}"
|
| 49 |
+
|
| 50 |
+
else
|
| 51 |
+
|
| 52 |
+
docker buildx build \
|
| 53 |
+
--build-arg IMG_TAG="${ARG_TAG}" \
|
| 54 |
+
--tag "${image}:${ARG_TAG}" --push "$@" "${path}"
|
| 55 |
+
|
| 56 |
+
fi
|
| 57 |
+
|
| 58 |
+
done
|
| 59 |
+
|
local-test-tika-full-01-vuln_8/fuzz-tooling/infra/ci/build.py
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
# Copyright 2019 Google Inc.
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
#
|
| 16 |
+
################################################################################
|
| 17 |
+
"""Build modified projects."""
|
| 18 |
+
|
| 19 |
+
from __future__ import print_function
|
| 20 |
+
|
| 21 |
+
import enum
|
| 22 |
+
import os
|
| 23 |
+
import re
|
| 24 |
+
import sys
|
| 25 |
+
import subprocess
|
| 26 |
+
import yaml
|
| 27 |
+
|
| 28 |
+
# pylint: disable=wrong-import-position,import-error
|
| 29 |
+
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
| 30 |
+
|
| 31 |
+
import constants
|
| 32 |
+
|
| 33 |
+
CANARY_PROJECT = 'skcms'
|
| 34 |
+
|
| 35 |
+
DEFAULT_ARCHITECTURES = ['x86_64']
|
| 36 |
+
DEFAULT_ENGINES = ['afl', 'honggfuzz', 'libfuzzer', 'centipede']
|
| 37 |
+
DEFAULT_SANITIZERS = ['address', 'undefined']
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def get_changed_files_output():
|
| 41 |
+
"""Returns the output of a git command that discovers changed files."""
|
| 42 |
+
branch_commit_hash = subprocess.check_output(
|
| 43 |
+
['git', 'merge-base', 'HEAD', 'origin/HEAD']).strip().decode()
|
| 44 |
+
|
| 45 |
+
return subprocess.check_output(
|
| 46 |
+
['git', 'diff', '--name-only', branch_commit_hash + '..']).decode()
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
def get_modified_buildable_projects():
|
| 50 |
+
"""Returns a list of all the projects modified in this commit that have a
|
| 51 |
+
build.sh file."""
|
| 52 |
+
git_output = get_changed_files_output()
|
| 53 |
+
projects_regex = '.*projects/(?P<name>.*)/.*\n'
|
| 54 |
+
modified_projects = set(re.findall(projects_regex, git_output))
|
| 55 |
+
projects_dir = os.path.join(get_oss_fuzz_root(), 'projects')
|
| 56 |
+
# Filter out projects without Dockerfile files since new projects and reverted
|
| 57 |
+
# projects frequently don't have them. In these cases we don't want Travis's
|
| 58 |
+
# builds to fail.
|
| 59 |
+
modified_buildable_projects = []
|
| 60 |
+
for project in modified_projects:
|
| 61 |
+
if not os.path.exists(os.path.join(projects_dir, project, 'Dockerfile')):
|
| 62 |
+
print('Project {0} does not have Dockerfile. skipping build.'.format(
|
| 63 |
+
project))
|
| 64 |
+
continue
|
| 65 |
+
modified_buildable_projects.append(project)
|
| 66 |
+
return modified_buildable_projects
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
def get_oss_fuzz_root():
|
| 70 |
+
"""Get the absolute path of the root of the oss-fuzz checkout."""
|
| 71 |
+
script_path = os.path.realpath(__file__)
|
| 72 |
+
return os.path.abspath(
|
| 73 |
+
os.path.dirname(os.path.dirname(os.path.dirname(script_path))))
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
def execute_helper_command(helper_command):
|
| 77 |
+
"""Execute |helper_command| using helper.py."""
|
| 78 |
+
root = get_oss_fuzz_root()
|
| 79 |
+
script_path = os.path.join(root, 'infra', 'helper.py')
|
| 80 |
+
command = ['python', script_path] + helper_command
|
| 81 |
+
print('Running command: %s' % ' '.join(command))
|
| 82 |
+
subprocess.check_call(command)
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
def build_fuzzers(project, engine, sanitizer, architecture):
|
| 86 |
+
"""Execute helper.py's build_fuzzers command on |project|. Build the fuzzers
|
| 87 |
+
with |engine| and |sanitizer| for |architecture|."""
|
| 88 |
+
execute_helper_command([
|
| 89 |
+
'build_fuzzers', project, '--engine', engine, '--sanitizer', sanitizer,
|
| 90 |
+
'--architecture', architecture
|
| 91 |
+
])
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
def check_build(project, engine, sanitizer, architecture):
|
| 95 |
+
"""Execute helper.py's check_build command on |project|, assuming it was most
|
| 96 |
+
recently built with |engine| and |sanitizer| for |architecture|."""
|
| 97 |
+
execute_helper_command([
|
| 98 |
+
'check_build', project, '--engine', engine, '--sanitizer', sanitizer,
|
| 99 |
+
'--architecture', architecture
|
| 100 |
+
])
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
def should_build_coverage(project_yaml):
|
| 104 |
+
"""Returns True if a coverage build should be done based on project.yaml
|
| 105 |
+
contents."""
|
| 106 |
+
# Enable coverage builds on projects that use engines. Those that don't use
|
| 107 |
+
# engines shouldn't get coverage builds.
|
| 108 |
+
engines = project_yaml.get('fuzzing_engines', DEFAULT_ENGINES)
|
| 109 |
+
engineless = 'none' in engines
|
| 110 |
+
if engineless:
|
| 111 |
+
assert_message = ('Forbidden to specify multiple engines for '
|
| 112 |
+
'"fuzzing_engines" if "none" is specified.')
|
| 113 |
+
assert len(engines) == 1, assert_message
|
| 114 |
+
return False
|
| 115 |
+
if 'wycheproof' in engines:
|
| 116 |
+
return False
|
| 117 |
+
|
| 118 |
+
language = project_yaml.get('language')
|
| 119 |
+
if language not in constants.LANGUAGES_WITH_COVERAGE_SUPPORT:
|
| 120 |
+
print(('Project is written in "{language}", '
|
| 121 |
+
'coverage is not supported yet.').format(language=language))
|
| 122 |
+
return False
|
| 123 |
+
|
| 124 |
+
return True
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
def flatten_options(option_list):
|
| 128 |
+
"""Generator that flattens |option_list| (a list of sanitizers, architectures
|
| 129 |
+
or fuzzing engines) by returning each element in the list that isn't a
|
| 130 |
+
dictionary. For elements that are dictionaries, the sole key is returned."""
|
| 131 |
+
result = []
|
| 132 |
+
for option in option_list:
|
| 133 |
+
if isinstance(option, dict):
|
| 134 |
+
keys = list(option.keys())
|
| 135 |
+
assert len(keys) == 1
|
| 136 |
+
result.append(keys[0])
|
| 137 |
+
continue
|
| 138 |
+
result.append(option)
|
| 139 |
+
print(result)
|
| 140 |
+
return result
|
| 141 |
+
|
| 142 |
+
|
| 143 |
+
def should_build(project_yaml):
|
| 144 |
+
"""Returns True on if the build specified is enabled in the project.yaml."""
|
| 145 |
+
|
| 146 |
+
if os.getenv('SANITIZER') == 'coverage':
|
| 147 |
+
# This assumes we only do coverage builds with libFuzzer on x86_64.
|
| 148 |
+
return should_build_coverage(project_yaml)
|
| 149 |
+
|
| 150 |
+
def is_enabled(env_var, yaml_name, defaults):
|
| 151 |
+
"""Is the value of |env_var| enabled in |project_yaml| (in the |yaml_name|
|
| 152 |
+
section)? Uses |defaults| if |yaml_name| section is unspecified."""
|
| 153 |
+
return os.getenv(env_var) in flatten_options(
|
| 154 |
+
project_yaml.get(yaml_name, defaults))
|
| 155 |
+
|
| 156 |
+
return (is_enabled('ENGINE', 'fuzzing_engines', DEFAULT_ENGINES) and
|
| 157 |
+
is_enabled('SANITIZER', 'sanitizers', DEFAULT_SANITIZERS) and
|
| 158 |
+
is_enabled('ARCHITECTURE', 'architectures', DEFAULT_ARCHITECTURES))
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
def build_project(project):
|
| 162 |
+
"""Do the build of |project| that is specified by the environment variables -
|
| 163 |
+
SANITIZER, ENGINE, and ARCHITECTURE."""
|
| 164 |
+
root = get_oss_fuzz_root()
|
| 165 |
+
project_yaml_path = os.path.join(root, 'projects', project, 'project.yaml')
|
| 166 |
+
with open(project_yaml_path) as file_handle:
|
| 167 |
+
project_yaml = yaml.safe_load(file_handle)
|
| 168 |
+
|
| 169 |
+
if project_yaml.get('disabled', False):
|
| 170 |
+
print('Project {0} is disabled, skipping build.'.format(project))
|
| 171 |
+
return
|
| 172 |
+
|
| 173 |
+
engine = os.getenv('ENGINE')
|
| 174 |
+
sanitizer = os.getenv('SANITIZER')
|
| 175 |
+
architecture = os.getenv('ARCHITECTURE')
|
| 176 |
+
|
| 177 |
+
if not should_build(project_yaml):
|
| 178 |
+
print(('Specified build: engine: {0}, sanitizer: {1}, architecture: {2} '
|
| 179 |
+
'not enabled for this project: {3}. Skipping build.').format(
|
| 180 |
+
engine, sanitizer, architecture, project))
|
| 181 |
+
|
| 182 |
+
return
|
| 183 |
+
|
| 184 |
+
print('Building project', project)
|
| 185 |
+
build_fuzzers(project, engine, sanitizer, architecture)
|
| 186 |
+
|
| 187 |
+
run_tests = project_yaml.get('run_tests', True)
|
| 188 |
+
if engine != 'none' and sanitizer != 'coverage' and run_tests:
|
| 189 |
+
check_build(project, engine, sanitizer, architecture)
|
| 190 |
+
|
| 191 |
+
|
| 192 |
+
class BuildModifiedProjectsResult(enum.Enum):
|
| 193 |
+
"""Enum containing the return values of build_modified_projects()."""
|
| 194 |
+
NONE_BUILT = 0
|
| 195 |
+
BUILD_SUCCESS = 1
|
| 196 |
+
BUILD_FAIL = 2
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
def build_modified_projects():
|
| 200 |
+
"""Build modified projects. Returns BuildModifiedProjectsResult.NONE_BUILT if
|
| 201 |
+
no builds were attempted. Returns BuildModifiedProjectsResult.BUILD_SUCCESS if
|
| 202 |
+
all attempts succeed, otherwise returns
|
| 203 |
+
BuildModifiedProjectsResult.BUILD_FAIL."""
|
| 204 |
+
projects = get_modified_buildable_projects()
|
| 205 |
+
if not projects:
|
| 206 |
+
return BuildModifiedProjectsResult.NONE_BUILT
|
| 207 |
+
|
| 208 |
+
failed_projects = []
|
| 209 |
+
for project in projects:
|
| 210 |
+
try:
|
| 211 |
+
build_project(project)
|
| 212 |
+
except subprocess.CalledProcessError:
|
| 213 |
+
failed_projects.append(project)
|
| 214 |
+
|
| 215 |
+
if failed_projects:
|
| 216 |
+
print('Failed projects:', ' '.join(failed_projects))
|
| 217 |
+
return BuildModifiedProjectsResult.BUILD_FAIL
|
| 218 |
+
|
| 219 |
+
return BuildModifiedProjectsResult.BUILD_SUCCESS
|
| 220 |
+
|
| 221 |
+
|
| 222 |
+
def is_infra_changed():
|
| 223 |
+
"""Returns True if the infra directory was changed."""
|
| 224 |
+
git_output = get_changed_files_output()
|
| 225 |
+
infra_code_regex = '.*infra/.*\n'
|
| 226 |
+
return re.search(infra_code_regex, git_output) is not None
|
| 227 |
+
|
| 228 |
+
|
| 229 |
+
def build_base_images():
|
| 230 |
+
"""Builds base images."""
|
| 231 |
+
# TODO(jonathanmetzman): Investigate why caching fails so often and
|
| 232 |
+
# when we improve it, build base-clang as well. Also, move this function
|
| 233 |
+
# to a helper command when we can support base-clang.
|
| 234 |
+
execute_helper_command(['pull_images'])
|
| 235 |
+
images = [
|
| 236 |
+
'base-image',
|
| 237 |
+
'base-builder',
|
| 238 |
+
'base-builder-go',
|
| 239 |
+
'base-builder-javascript',
|
| 240 |
+
'base-builder-jvm',
|
| 241 |
+
'base-builder-python',
|
| 242 |
+
'base-builder-rust',
|
| 243 |
+
'base-builder-swift',
|
| 244 |
+
'base-builder-ruby',
|
| 245 |
+
'base-runner',
|
| 246 |
+
]
|
| 247 |
+
for image in images:
|
| 248 |
+
try:
|
| 249 |
+
execute_helper_command(['build_image', image, '--no-pull', '--cache'])
|
| 250 |
+
except subprocess.CalledProcessError:
|
| 251 |
+
return 1
|
| 252 |
+
|
| 253 |
+
return 0
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
def build_canary_project():
|
| 257 |
+
"""Builds a specific project when infra/ is changed to verify that infra/
|
| 258 |
+
changes don't break things. Returns False if build was attempted but
|
| 259 |
+
failed."""
|
| 260 |
+
|
| 261 |
+
try:
|
| 262 |
+
build_project('skcms')
|
| 263 |
+
except subprocess.CalledProcessError:
|
| 264 |
+
return False
|
| 265 |
+
|
| 266 |
+
return True
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
def main():
|
| 270 |
+
"""Build modified projects or canary project."""
|
| 271 |
+
os.environ['OSS_FUZZ_CI'] = '1'
|
| 272 |
+
infra_changed = is_infra_changed()
|
| 273 |
+
if infra_changed:
|
| 274 |
+
print('Pulling and building base images first.')
|
| 275 |
+
if build_base_images():
|
| 276 |
+
return 1
|
| 277 |
+
|
| 278 |
+
result = build_modified_projects()
|
| 279 |
+
if result == BuildModifiedProjectsResult.BUILD_FAIL:
|
| 280 |
+
return 1
|
| 281 |
+
|
| 282 |
+
# It's unnecessary to build the canary if we've built any projects already.
|
| 283 |
+
no_projects_built = result == BuildModifiedProjectsResult.NONE_BUILT
|
| 284 |
+
should_build_canary = no_projects_built and infra_changed
|
| 285 |
+
if should_build_canary and not build_canary_project():
|
| 286 |
+
return 1
|
| 287 |
+
|
| 288 |
+
return 0
|
| 289 |
+
|
| 290 |
+
|
| 291 |
+
if __name__ == '__main__':
|
| 292 |
+
sys.exit(main())
|
local-test-tika-full-01-vuln_8/fuzz-tooling/infra/ci/build_test.py
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2020 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
#
|
| 15 |
+
################################################################################
|
| 16 |
+
"""Tests for build.py"""
|
| 17 |
+
|
| 18 |
+
import os
|
| 19 |
+
import sys
|
| 20 |
+
import unittest
|
| 21 |
+
from unittest import mock
|
| 22 |
+
|
| 23 |
+
# pylint: disable=wrong-import-position
|
| 24 |
+
INFRA_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
| 25 |
+
sys.path.append(INFRA_DIR)
|
| 26 |
+
|
| 27 |
+
from ci import build
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def patch_environ(testcase_obj):
|
| 31 |
+
"""Patch environment."""
|
| 32 |
+
env = {}
|
| 33 |
+
patcher = mock.patch.dict(os.environ, env)
|
| 34 |
+
testcase_obj.addCleanup(patcher.stop)
|
| 35 |
+
patcher.start()
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def _set_coverage_build():
|
| 39 |
+
"""Set the right environment variables for a coverage build."""
|
| 40 |
+
os.environ['SANITIZER'] = 'coverage'
|
| 41 |
+
os.environ['ENGINE'] = 'libfuzzer'
|
| 42 |
+
os.environ['ARCHITECTURE'] = 'x86_64'
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
class TestShouldBuild(unittest.TestCase):
|
| 46 |
+
"""Tests that should_build() works as intended."""
|
| 47 |
+
|
| 48 |
+
def setUp(self):
|
| 49 |
+
patch_environ(self)
|
| 50 |
+
|
| 51 |
+
def test_none_engine_coverage_build(self):
|
| 52 |
+
"""Tests that should_build returns False for a coverage build of a
|
| 53 |
+
project that specifies 'none' for fuzzing_engines."""
|
| 54 |
+
_set_coverage_build()
|
| 55 |
+
project_yaml = {
|
| 56 |
+
'language': 'c++',
|
| 57 |
+
'fuzzing_engines': ['none'],
|
| 58 |
+
'sanitizers': ['address']
|
| 59 |
+
}
|
| 60 |
+
self.assertFalse(build.should_build(project_yaml))
|
| 61 |
+
|
| 62 |
+
def test_unspecified_engines_coverage_build(self):
|
| 63 |
+
"""Tests that should_build returns True for a coverage build of a
|
| 64 |
+
project that doesn't specify fuzzing_engines."""
|
| 65 |
+
_set_coverage_build()
|
| 66 |
+
project_yaml = {'language': 'c++'}
|
| 67 |
+
self.assertTrue(build.should_build(project_yaml))
|
| 68 |
+
|
| 69 |
+
def test_libfuzzer_coverage_build(self):
|
| 70 |
+
"""Tests that should_build returns True for coverage build of a project
|
| 71 |
+
specifying 'libfuzzer' for fuzzing_engines."""
|
| 72 |
+
_set_coverage_build()
|
| 73 |
+
project_yaml = {
|
| 74 |
+
'language': 'c++',
|
| 75 |
+
'fuzzing_engines': ['libfuzzer'],
|
| 76 |
+
'sanitizers': ['address']
|
| 77 |
+
}
|
| 78 |
+
self.assertTrue(build.should_build(project_yaml))
|
| 79 |
+
|
| 80 |
+
def test_go_coverage_build(self):
|
| 81 |
+
"""Tests that should_build returns True for coverage build of a project
|
| 82 |
+
specifying 'libfuzzer' for fuzzing_engines."""
|
| 83 |
+
_set_coverage_build()
|
| 84 |
+
project_yaml = {'language': 'go'}
|
| 85 |
+
self.assertTrue(build.should_build(project_yaml))
|
| 86 |
+
|
| 87 |
+
def test_engine_project_none_build(self):
|
| 88 |
+
"""Tests that should_build returns False for an engine: 'none' build when
|
| 89 |
+
the project doesn't specify engines."""
|
| 90 |
+
os.environ['SANITIZER'] = 'address'
|
| 91 |
+
os.environ['ENGINE'] = 'none'
|
| 92 |
+
os.environ['ARCHITECTURE'] = 'x86_64'
|
| 93 |
+
project_yaml = {
|
| 94 |
+
'language': 'c++',
|
| 95 |
+
'fuzzing_engines': ['libfuzzer'],
|
| 96 |
+
'sanitizers': ['address']
|
| 97 |
+
}
|
| 98 |
+
self.assertFalse(build.should_build(project_yaml))
|
| 99 |
+
|
| 100 |
+
def test_centipede_none_build(self):
|
| 101 |
+
"""Tests that should_build returns True for none sanitizer build of a
|
| 102 |
+
project specifying 'centipede' for fuzzing_engines."""
|
| 103 |
+
os.environ['SANITIZER'] = 'none'
|
| 104 |
+
os.environ['ENGINE'] = 'centipede'
|
| 105 |
+
os.environ['ARCHITECTURE'] = 'x86_64'
|
| 106 |
+
project_yaml = {
|
| 107 |
+
'language': 'c++',
|
| 108 |
+
'fuzzing_engines': ['centipede'],
|
| 109 |
+
'sanitizers': ['none']
|
| 110 |
+
}
|
| 111 |
+
self.assertTrue(build.should_build(project_yaml))
|
| 112 |
+
|
| 113 |
+
def test_centipede_address_build(self):
|
| 114 |
+
"""Tests that should_build returns True for address sanitizer build of a
|
| 115 |
+
project specifying 'centipede' for fuzzing_engines."""
|
| 116 |
+
os.environ['SANITIZER'] = 'address'
|
| 117 |
+
os.environ['ENGINE'] = 'centipede'
|
| 118 |
+
os.environ['ARCHITECTURE'] = 'x86_64'
|
| 119 |
+
project_yaml = {
|
| 120 |
+
'language': 'c++',
|
| 121 |
+
'fuzzing_engines': ['centipede'],
|
| 122 |
+
'sanitizers': ['address']
|
| 123 |
+
}
|
| 124 |
+
self.assertTrue(build.should_build(project_yaml))
|
local-test-tika-full-01-vuln_8/fuzz-tooling/infra/cifuzz/affected_fuzz_targets.py
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2021 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""Module for dealing with fuzz targets affected by the change-under-test
|
| 15 |
+
(CUT)."""
|
| 16 |
+
import logging
|
| 17 |
+
import os
|
| 18 |
+
import sys
|
| 19 |
+
|
| 20 |
+
# pylint: disable=wrong-import-position,import-error
|
| 21 |
+
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
| 22 |
+
import utils
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
def remove_unaffected_fuzz_targets(clusterfuzz_deployment, out_dir,
|
| 26 |
+
files_changed, repo_path):
|
| 27 |
+
"""Removes all non affected fuzz targets in the out directory.
|
| 28 |
+
|
| 29 |
+
Args:
|
| 30 |
+
clusterfuzz_deployment: The ClusterFuzz deployment object.
|
| 31 |
+
out_dir: The location of the fuzz target binaries.
|
| 32 |
+
files_changed: A list of files changed compared to HEAD.
|
| 33 |
+
repo_path: The location of the OSS-Fuzz repo in the docker image.
|
| 34 |
+
|
| 35 |
+
This function will not delete fuzz targets unless it knows that the fuzz
|
| 36 |
+
targets are unaffected. For example, this means that fuzz targets which don't
|
| 37 |
+
have coverage data on will not be deleted.
|
| 38 |
+
"""
|
| 39 |
+
if not files_changed:
|
| 40 |
+
# Don't remove any fuzz targets if there is no difference from HEAD.
|
| 41 |
+
logging.info('No files changed compared to HEAD.')
|
| 42 |
+
return
|
| 43 |
+
|
| 44 |
+
logging.info('Files changed in PR: %s', files_changed)
|
| 45 |
+
|
| 46 |
+
fuzz_target_paths = utils.get_fuzz_targets(out_dir)
|
| 47 |
+
if not fuzz_target_paths:
|
| 48 |
+
# Nothing to remove.
|
| 49 |
+
logging.error('No fuzz targets found in out dir.')
|
| 50 |
+
return
|
| 51 |
+
|
| 52 |
+
coverage = clusterfuzz_deployment.get_coverage(repo_path)
|
| 53 |
+
if not coverage:
|
| 54 |
+
# Don't remove any fuzz targets unless we have data.
|
| 55 |
+
logging.error('Could not find latest coverage report.')
|
| 56 |
+
return
|
| 57 |
+
|
| 58 |
+
affected_fuzz_targets = get_affected_fuzz_targets(coverage, fuzz_target_paths,
|
| 59 |
+
files_changed)
|
| 60 |
+
|
| 61 |
+
if not affected_fuzz_targets:
|
| 62 |
+
logging.info('No affected fuzz targets detected, keeping all as fallback.')
|
| 63 |
+
return
|
| 64 |
+
|
| 65 |
+
logging.info('Using affected fuzz targets: %s.', affected_fuzz_targets)
|
| 66 |
+
unaffected_fuzz_targets = set(fuzz_target_paths) - affected_fuzz_targets
|
| 67 |
+
logging.info('Removing unaffected fuzz targets: %s.', unaffected_fuzz_targets)
|
| 68 |
+
|
| 69 |
+
# Remove all the targets that are not affected.
|
| 70 |
+
for fuzz_target_path in unaffected_fuzz_targets:
|
| 71 |
+
try:
|
| 72 |
+
os.remove(fuzz_target_path)
|
| 73 |
+
except OSError as error:
|
| 74 |
+
logging.error('%s occurred while removing file %s', error,
|
| 75 |
+
fuzz_target_path)
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
def is_fuzz_target_affected(coverage, fuzz_target_path, files_changed):
|
| 79 |
+
"""Returns True if a fuzz target (|fuzz_target_path|) is affected by
|
| 80 |
+
|files_changed|."""
|
| 81 |
+
fuzz_target = os.path.basename(fuzz_target_path)
|
| 82 |
+
covered_files = coverage.get_files_covered_by_target(fuzz_target)
|
| 83 |
+
if not covered_files:
|
| 84 |
+
# Assume a fuzz target is affected if we can't get its coverage from
|
| 85 |
+
# OSS-Fuzz.
|
| 86 |
+
# TODO(metzman): Figure out what we should do if covered_files is [].
|
| 87 |
+
# Should we act as if we couldn't get the coverage?
|
| 88 |
+
logging.info('Could not get coverage for %s. Treating as affected.',
|
| 89 |
+
fuzz_target)
|
| 90 |
+
return True
|
| 91 |
+
|
| 92 |
+
covered_files = [
|
| 93 |
+
os.path.normpath(covered_file) for covered_file in covered_files
|
| 94 |
+
]
|
| 95 |
+
logging.info('Fuzz target %s is affected by: %s', fuzz_target, covered_files)
|
| 96 |
+
for filename in files_changed:
|
| 97 |
+
if filename in covered_files:
|
| 98 |
+
logging.info('Fuzz target %s is affected by changed file: %s',
|
| 99 |
+
fuzz_target, filename)
|
| 100 |
+
return True
|
| 101 |
+
|
| 102 |
+
logging.info('Fuzz target %s is not affected.', fuzz_target)
|
| 103 |
+
return False
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
def get_affected_fuzz_targets(coverage, fuzz_target_paths, files_changed):
|
| 107 |
+
"""Returns a list of paths of affected targets."""
|
| 108 |
+
affected_fuzz_targets = set()
|
| 109 |
+
for fuzz_target_path in fuzz_target_paths:
|
| 110 |
+
if is_fuzz_target_affected(coverage, fuzz_target_path, files_changed):
|
| 111 |
+
affected_fuzz_targets.add(fuzz_target_path)
|
| 112 |
+
|
| 113 |
+
return affected_fuzz_targets
|
local-test-tika-full-01-vuln_8/fuzz-tooling/infra/cifuzz/build-images.sh
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#! /bin/bash -eux
|
| 2 |
+
# Copyright 2021 Google LLC
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
|
| 16 |
+
# Script for building the docker images for cifuzz.
|
| 17 |
+
|
| 18 |
+
CIFUZZ_DIR=$(dirname "$0")
|
| 19 |
+
CIFUZZ_DIR=$(realpath $CIFUZZ_DIR)
|
| 20 |
+
INFRA_DIR=$(realpath $CIFUZZ_DIR/..)
|
| 21 |
+
OSS_FUZZ_ROOT=$(realpath $INFRA_DIR/..)
|
| 22 |
+
|
| 23 |
+
# Build cifuzz-base.
|
| 24 |
+
docker build --tag ghcr.io/aixcc-finals/cifuzz-base --file $CIFUZZ_DIR/cifuzz-base/Dockerfile $OSS_FUZZ_ROOT
|
| 25 |
+
|
| 26 |
+
# Build run-fuzzers and build-fuzzers images.
|
| 27 |
+
docker build \
|
| 28 |
+
--tag ghcr.io/aixcc-finals/clusterfuzzlite-build-fuzzers-test:v1 \
|
| 29 |
+
--tag ghcr.io/aixcc-finals/clusterfuzzlite-build-fuzzers:v1 \
|
| 30 |
+
--file $INFRA_DIR/build_fuzzers.Dockerfile $INFRA_DIR
|
| 31 |
+
docker build \
|
| 32 |
+
--tag ghcr.io/aixcc-finals/clusterfuzzlite-run-fuzzers:v1 \
|
| 33 |
+
--tag ghcr.io/aixcc-finals/clusterfuzzlite-run-fuzzers-test:v1 \
|
| 34 |
+
--file $INFRA_DIR/run_fuzzers.Dockerfile $INFRA_DIR
|
local-test-tika-full-01-vuln_8/fuzz-tooling/infra/cifuzz/build_fuzzers_entrypoint.py
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2020 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""Builds a specific OSS-Fuzz project's fuzzers for CI tools."""
|
| 15 |
+
import logging
|
| 16 |
+
import sys
|
| 17 |
+
|
| 18 |
+
import build_fuzzers
|
| 19 |
+
import logs
|
| 20 |
+
import config_utils
|
| 21 |
+
|
| 22 |
+
# pylint: disable=c-extension-no-member
|
| 23 |
+
# pylint gets confused because of the relative import of cifuzz.
|
| 24 |
+
|
| 25 |
+
logs.init()
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def build_fuzzers_entrypoint():
|
| 29 |
+
"""Builds OSS-Fuzz project's fuzzers for CI tools."""
|
| 30 |
+
config = config_utils.BuildFuzzersConfig()
|
| 31 |
+
|
| 32 |
+
if config.dry_run:
|
| 33 |
+
# Sets the default return code on error to success.
|
| 34 |
+
returncode = 0
|
| 35 |
+
else:
|
| 36 |
+
# The default return code when an error occurs.
|
| 37 |
+
returncode = 1
|
| 38 |
+
|
| 39 |
+
if not build_fuzzers.build_fuzzers(config):
|
| 40 |
+
logging.error('Error building fuzzers for (commit: %s, pr_ref: %s).',
|
| 41 |
+
config.git_sha, config.pr_ref)
|
| 42 |
+
return returncode
|
| 43 |
+
|
| 44 |
+
return 0
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
def main():
|
| 48 |
+
"""Builds OSS-Fuzz project's fuzzers for CI tools.
|
| 49 |
+
|
| 50 |
+
Note: The resulting fuzz target binaries of this build are placed in
|
| 51 |
+
the directory: ${GITHUB_WORKSPACE}/out
|
| 52 |
+
|
| 53 |
+
Returns:
|
| 54 |
+
0 on success or nonzero on failure.
|
| 55 |
+
"""
|
| 56 |
+
return build_fuzzers_entrypoint()
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
if __name__ == '__main__':
|
| 60 |
+
sys.exit(main())
|
local-test-tika-full-01-vuln_8/fuzz-tooling/infra/cifuzz/clusterfuzz_deployment.py
ADDED
|
@@ -0,0 +1,385 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2021 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""Module for interacting with the ClusterFuzz deployment."""
|
| 15 |
+
import logging
|
| 16 |
+
import os
|
| 17 |
+
import sys
|
| 18 |
+
import urllib.error
|
| 19 |
+
import urllib.request
|
| 20 |
+
|
| 21 |
+
import config_utils
|
| 22 |
+
import continuous_integration
|
| 23 |
+
import filestore_utils
|
| 24 |
+
import http_utils
|
| 25 |
+
import get_coverage
|
| 26 |
+
import repo_manager
|
| 27 |
+
|
| 28 |
+
# pylint: disable=wrong-import-position,import-error
|
| 29 |
+
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
| 30 |
+
import utils
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
class BaseClusterFuzzDeployment:
|
| 34 |
+
"""Base class for ClusterFuzz deployments."""
|
| 35 |
+
|
| 36 |
+
def __init__(self, config, workspace):
|
| 37 |
+
self.config = config
|
| 38 |
+
self.workspace = workspace
|
| 39 |
+
self.ci_system = continuous_integration.get_ci(config)
|
| 40 |
+
|
| 41 |
+
def download_latest_build(self):
|
| 42 |
+
"""Downloads the latest build from ClusterFuzz.
|
| 43 |
+
|
| 44 |
+
Returns:
|
| 45 |
+
A path to where the OSS-Fuzz build was stored, or None if it wasn't.
|
| 46 |
+
"""
|
| 47 |
+
raise NotImplementedError('Child class must implement method.')
|
| 48 |
+
|
| 49 |
+
def upload_build(self, commit):
|
| 50 |
+
"""Uploads the build with the given commit sha to the filestore."""
|
| 51 |
+
raise NotImplementedError('Child class must implement method.')
|
| 52 |
+
|
| 53 |
+
def download_corpus(self, target_name, corpus_dir):
|
| 54 |
+
"""Downloads the corpus for |target_name| from ClusterFuzz to |corpus_dir|.
|
| 55 |
+
|
| 56 |
+
Returns:
|
| 57 |
+
A path to where the OSS-Fuzz build was stored, or None if it wasn't.
|
| 58 |
+
"""
|
| 59 |
+
raise NotImplementedError('Child class must implement method.')
|
| 60 |
+
|
| 61 |
+
def upload_crashes(self):
|
| 62 |
+
"""Uploads crashes in |crashes_dir| to filestore."""
|
| 63 |
+
raise NotImplementedError('Child class must implement method.')
|
| 64 |
+
|
| 65 |
+
def upload_corpus(self, target_name, corpus_dir, replace=False): # pylint: disable=no-self-use,unused-argument
|
| 66 |
+
"""Uploads the corpus for |target_name| to filestore."""
|
| 67 |
+
raise NotImplementedError('Child class must implement method.')
|
| 68 |
+
|
| 69 |
+
def upload_coverage(self):
|
| 70 |
+
"""Uploads the coverage report to the filestore."""
|
| 71 |
+
raise NotImplementedError('Child class must implement method.')
|
| 72 |
+
|
| 73 |
+
def get_coverage(self, repo_path):
|
| 74 |
+
"""Returns the project coverage object for the project."""
|
| 75 |
+
raise NotImplementedError('Child class must implement method.')
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
def _make_empty_dir_if_nonexistent(path):
|
| 79 |
+
"""Makes an empty directory at |path| if it does not exist."""
|
| 80 |
+
os.makedirs(path, exist_ok=True)
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
class ClusterFuzzLite(BaseClusterFuzzDeployment):
|
| 84 |
+
"""Class representing a deployment of ClusterFuzzLite."""
|
| 85 |
+
|
| 86 |
+
COVERAGE_NAME = 'latest'
|
| 87 |
+
LATEST_BUILD_WINDOW = 3
|
| 88 |
+
|
| 89 |
+
def __init__(self, config, workspace):
|
| 90 |
+
super().__init__(config, workspace)
|
| 91 |
+
self.filestore = filestore_utils.get_filestore(self.config)
|
| 92 |
+
|
| 93 |
+
def download_latest_build(self):
|
| 94 |
+
if os.path.exists(self.workspace.clusterfuzz_build):
|
| 95 |
+
# This path is necessary because download_latest_build can be called
|
| 96 |
+
# multiple times.That is the case because it is called only when we need
|
| 97 |
+
# to see if a bug is novel, i.e. until we want to check a bug is novel we
|
| 98 |
+
# don't want to waste time calling this, but therefore this method can be
|
| 99 |
+
# called if multiple bugs are found.
|
| 100 |
+
return self.workspace.clusterfuzz_build
|
| 101 |
+
|
| 102 |
+
repo_dir = self.ci_system.repo_dir
|
| 103 |
+
if not repo_dir:
|
| 104 |
+
raise RuntimeError('Repo checkout does not exist.')
|
| 105 |
+
|
| 106 |
+
_make_empty_dir_if_nonexistent(self.workspace.clusterfuzz_build)
|
| 107 |
+
repo = repo_manager.RepoManager(repo_dir)
|
| 108 |
+
|
| 109 |
+
diff_base = self.ci_system.get_diff_base()
|
| 110 |
+
if not diff_base:
|
| 111 |
+
diff_base = 'HEAD^'
|
| 112 |
+
|
| 113 |
+
# Builds are stored by commit, so try the latest |LATEST_BUILD_WINDOW|
|
| 114 |
+
# commits before the current diff base.
|
| 115 |
+
# TODO(ochang): If API usage becomes an issue, this can be optimized by the
|
| 116 |
+
# filestore accepting a list of filenames to try.
|
| 117 |
+
try:
|
| 118 |
+
# TODO(metzman): Why do we default to 'origin', we should avoid going down
|
| 119 |
+
# this path entirely and not need to catch an exception.
|
| 120 |
+
commit_list = repo.get_commit_list(diff_base,
|
| 121 |
+
limit=self.LATEST_BUILD_WINDOW)
|
| 122 |
+
except ValueError as error:
|
| 123 |
+
logging.error('Can\'t get commit list: %s', error)
|
| 124 |
+
return None
|
| 125 |
+
|
| 126 |
+
for old_commit in commit_list:
|
| 127 |
+
logging.info('Trying to downloading previous build %s.', old_commit)
|
| 128 |
+
build_name = self._get_build_name(old_commit)
|
| 129 |
+
try:
|
| 130 |
+
if self.filestore.download_build(build_name,
|
| 131 |
+
self.workspace.clusterfuzz_build):
|
| 132 |
+
logging.info('Done downloading previous build.')
|
| 133 |
+
return self.workspace.clusterfuzz_build
|
| 134 |
+
|
| 135 |
+
logging.info('Build for %s does not exist.', old_commit)
|
| 136 |
+
except Exception as err: # pylint: disable=broad-except
|
| 137 |
+
logging.error('Could not download build for %s because of: %s',
|
| 138 |
+
old_commit, err)
|
| 139 |
+
|
| 140 |
+
return None
|
| 141 |
+
|
| 142 |
+
def download_corpus(self, target_name, corpus_dir):
|
| 143 |
+
_make_empty_dir_if_nonexistent(corpus_dir)
|
| 144 |
+
logging.info('Downloading corpus for %s to %s.', target_name, corpus_dir)
|
| 145 |
+
corpus_name = self._get_corpus_name(target_name)
|
| 146 |
+
try:
|
| 147 |
+
self.filestore.download_corpus(corpus_name, corpus_dir)
|
| 148 |
+
logging.info('Done downloading corpus. Contains %d elements.',
|
| 149 |
+
len(os.listdir(corpus_dir)))
|
| 150 |
+
except Exception as err: # pylint: disable=broad-except
|
| 151 |
+
logging.error('Failed to download corpus for target: %s. Error: %s',
|
| 152 |
+
target_name, str(err))
|
| 153 |
+
return corpus_dir
|
| 154 |
+
|
| 155 |
+
def _get_build_name(self, name):
|
| 156 |
+
return f'{self.config.sanitizer}-{name}'
|
| 157 |
+
|
| 158 |
+
def _get_corpus_name(self, target_name): # pylint: disable=no-self-use
|
| 159 |
+
"""Returns the name of the corpus artifact."""
|
| 160 |
+
return target_name
|
| 161 |
+
|
| 162 |
+
def upload_corpus(self, target_name, corpus_dir, replace=False):
|
| 163 |
+
"""Upload the corpus produced by |target_name|."""
|
| 164 |
+
logging.info('Uploading corpus in %s for %s.', corpus_dir, target_name)
|
| 165 |
+
name = self._get_corpus_name(target_name)
|
| 166 |
+
try:
|
| 167 |
+
self.filestore.upload_corpus(name, corpus_dir, replace=replace)
|
| 168 |
+
logging.info('Done uploading corpus.')
|
| 169 |
+
except Exception as err: # pylint: disable=broad-except
|
| 170 |
+
logging.error('Failed to upload corpus for target: %s. Error: %s.',
|
| 171 |
+
target_name, err)
|
| 172 |
+
|
| 173 |
+
def upload_build(self, commit):
|
| 174 |
+
"""Upload the build produced by CIFuzz as the latest build."""
|
| 175 |
+
logging.info('Uploading latest build in %s.', self.workspace.out)
|
| 176 |
+
build_name = self._get_build_name(commit)
|
| 177 |
+
try:
|
| 178 |
+
result = self.filestore.upload_build(build_name, self.workspace.out)
|
| 179 |
+
logging.info('Done uploading latest build.')
|
| 180 |
+
return result
|
| 181 |
+
except Exception as err: # pylint: disable=broad-except
|
| 182 |
+
logging.error('Failed to upload latest build: %s. Error: %s',
|
| 183 |
+
self.workspace.out, err)
|
| 184 |
+
|
| 185 |
+
def upload_crashes(self):
|
| 186 |
+
"""Uploads crashes."""
|
| 187 |
+
artifact_dirs = os.listdir(self.workspace.artifacts)
|
| 188 |
+
if not artifact_dirs:
|
| 189 |
+
logging.info('No crashes in %s. Not uploading.', self.workspace.artifacts)
|
| 190 |
+
return
|
| 191 |
+
|
| 192 |
+
for crash_target in artifact_dirs:
|
| 193 |
+
artifact_dir = os.path.join(self.workspace.artifacts, crash_target)
|
| 194 |
+
if not os.path.isdir(artifact_dir):
|
| 195 |
+
logging.warning('%s is not an expected artifact directory, skipping.',
|
| 196 |
+
crash_target)
|
| 197 |
+
continue
|
| 198 |
+
|
| 199 |
+
logging.info('Uploading crashes in %s.', artifact_dir)
|
| 200 |
+
try:
|
| 201 |
+
self.filestore.upload_crashes(crash_target, artifact_dir)
|
| 202 |
+
logging.info('Done uploading crashes.')
|
| 203 |
+
except Exception as err: # pylint: disable=broad-except
|
| 204 |
+
logging.error('Failed to upload crashes. Error: %s', err)
|
| 205 |
+
|
| 206 |
+
def upload_coverage(self):
|
| 207 |
+
"""Uploads the coverage report to the filestore."""
|
| 208 |
+
self.filestore.upload_coverage(self.COVERAGE_NAME,
|
| 209 |
+
self.workspace.coverage_report)
|
| 210 |
+
|
| 211 |
+
def get_coverage(self, repo_path):
|
| 212 |
+
"""Returns the project coverage object for the project."""
|
| 213 |
+
_make_empty_dir_if_nonexistent(self.workspace.clusterfuzz_coverage)
|
| 214 |
+
try:
|
| 215 |
+
if not self.filestore.download_coverage(
|
| 216 |
+
self.COVERAGE_NAME, self.workspace.clusterfuzz_coverage):
|
| 217 |
+
logging.error('Could not download coverage.')
|
| 218 |
+
return None
|
| 219 |
+
return get_coverage.FilesystemCoverage(
|
| 220 |
+
repo_path, self.workspace.clusterfuzz_coverage)
|
| 221 |
+
except Exception as err: # pylint: disable=broad-except
|
| 222 |
+
logging.error('Could not get coverage: %s.', err)
|
| 223 |
+
return None
|
| 224 |
+
|
| 225 |
+
|
| 226 |
+
class OSSFuzz(BaseClusterFuzzDeployment):
|
| 227 |
+
"""The OSS-Fuzz ClusterFuzz deployment."""
|
| 228 |
+
|
| 229 |
+
# Location of clusterfuzz builds on GCS.
|
| 230 |
+
CLUSTERFUZZ_BUILDS = 'clusterfuzz-builds'
|
| 231 |
+
|
| 232 |
+
# Zip file name containing the corpus.
|
| 233 |
+
CORPUS_ZIP_NAME = 'public.zip'
|
| 234 |
+
|
| 235 |
+
def get_latest_build_name(self):
|
| 236 |
+
"""Gets the name of the latest OSS-Fuzz build of a project.
|
| 237 |
+
|
| 238 |
+
Returns:
|
| 239 |
+
A string with the latest build version or None.
|
| 240 |
+
"""
|
| 241 |
+
version_file = (
|
| 242 |
+
f'{self.config.oss_fuzz_project_name}-{self.config.sanitizer}'
|
| 243 |
+
'-latest.version')
|
| 244 |
+
version_url = utils.url_join(utils.GCS_BASE_URL, self.CLUSTERFUZZ_BUILDS,
|
| 245 |
+
self.config.oss_fuzz_project_name,
|
| 246 |
+
version_file)
|
| 247 |
+
try:
|
| 248 |
+
response = urllib.request.urlopen(version_url)
|
| 249 |
+
except urllib.error.HTTPError:
|
| 250 |
+
logging.error('Error getting latest build version for %s from: %s.',
|
| 251 |
+
self.config.oss_fuzz_project_name, version_url)
|
| 252 |
+
return None
|
| 253 |
+
return response.read().decode()
|
| 254 |
+
|
| 255 |
+
def download_latest_build(self):
|
| 256 |
+
"""Downloads the latest OSS-Fuzz build from GCS.
|
| 257 |
+
|
| 258 |
+
Returns:
|
| 259 |
+
A path to where the OSS-Fuzz build was stored, or None if it wasn't.
|
| 260 |
+
"""
|
| 261 |
+
if os.path.exists(self.workspace.clusterfuzz_build):
|
| 262 |
+
# This function can be called multiple times, don't download the build
|
| 263 |
+
# again.
|
| 264 |
+
return self.workspace.clusterfuzz_build
|
| 265 |
+
|
| 266 |
+
_make_empty_dir_if_nonexistent(self.workspace.clusterfuzz_build)
|
| 267 |
+
|
| 268 |
+
latest_build_name = self.get_latest_build_name()
|
| 269 |
+
if not latest_build_name:
|
| 270 |
+
return None
|
| 271 |
+
|
| 272 |
+
logging.info('Downloading latest build.')
|
| 273 |
+
oss_fuzz_build_url = utils.url_join(utils.GCS_BASE_URL,
|
| 274 |
+
self.CLUSTERFUZZ_BUILDS,
|
| 275 |
+
self.config.oss_fuzz_project_name,
|
| 276 |
+
latest_build_name)
|
| 277 |
+
if http_utils.download_and_unpack_zip(oss_fuzz_build_url,
|
| 278 |
+
self.workspace.clusterfuzz_build):
|
| 279 |
+
logging.info('Done downloading latest build.')
|
| 280 |
+
return self.workspace.clusterfuzz_build
|
| 281 |
+
|
| 282 |
+
return None
|
| 283 |
+
|
| 284 |
+
def upload_build(self, commit): # pylint: disable=no-self-use
|
| 285 |
+
"""Noop Implementation of upload_build."""
|
| 286 |
+
logging.info('Not uploading latest build because on OSS-Fuzz.')
|
| 287 |
+
|
| 288 |
+
def upload_corpus(self, target_name, corpus_dir, replace=False): # pylint: disable=no-self-use,unused-argument
|
| 289 |
+
"""Noop Implementation of upload_corpus."""
|
| 290 |
+
logging.info('Not uploading corpus because on OSS-Fuzz.')
|
| 291 |
+
|
| 292 |
+
def upload_crashes(self): # pylint: disable=no-self-use
|
| 293 |
+
"""Noop Implementation of upload_crashes."""
|
| 294 |
+
logging.info('Not uploading crashes because on OSS-Fuzz.')
|
| 295 |
+
|
| 296 |
+
def download_corpus(self, target_name, corpus_dir):
|
| 297 |
+
"""Downloads the latest OSS-Fuzz corpus for the target.
|
| 298 |
+
|
| 299 |
+
Returns:
|
| 300 |
+
The local path to to corpus or None if download failed.
|
| 301 |
+
"""
|
| 302 |
+
_make_empty_dir_if_nonexistent(corpus_dir)
|
| 303 |
+
project_qualified_fuzz_target_name = target_name
|
| 304 |
+
qualified_name_prefix = self.config.oss_fuzz_project_name + '_'
|
| 305 |
+
if not target_name.startswith(qualified_name_prefix):
|
| 306 |
+
project_qualified_fuzz_target_name = qualified_name_prefix + target_name
|
| 307 |
+
|
| 308 |
+
corpus_url = (f'{utils.GCS_BASE_URL}{self.config.oss_fuzz_project_name}'
|
| 309 |
+
'-backup.clusterfuzz-external.appspot.com/corpus/'
|
| 310 |
+
f'libFuzzer/{project_qualified_fuzz_target_name}/'
|
| 311 |
+
f'{self.CORPUS_ZIP_NAME}')
|
| 312 |
+
logging.info('Downloading corpus from OSS-Fuzz: %s', corpus_url)
|
| 313 |
+
|
| 314 |
+
if not http_utils.download_and_unpack_zip(corpus_url, corpus_dir):
|
| 315 |
+
logging.warning('Failed to download corpus for %s.', target_name)
|
| 316 |
+
return corpus_dir
|
| 317 |
+
|
| 318 |
+
def upload_coverage(self):
|
| 319 |
+
"""Noop Implementation of upload_coverage_report."""
|
| 320 |
+
logging.info('Not uploading coverage report because on OSS-Fuzz.')
|
| 321 |
+
|
| 322 |
+
def get_coverage(self, repo_path):
|
| 323 |
+
"""Returns the project coverage object for the project."""
|
| 324 |
+
try:
|
| 325 |
+
return get_coverage.OSSFuzzCoverage(repo_path,
|
| 326 |
+
self.config.oss_fuzz_project_name)
|
| 327 |
+
except get_coverage.CoverageError:
|
| 328 |
+
return None
|
| 329 |
+
|
| 330 |
+
|
| 331 |
+
class NoClusterFuzzDeployment(BaseClusterFuzzDeployment):
|
| 332 |
+
"""ClusterFuzzDeployment implementation used when there is no deployment of
|
| 333 |
+
ClusterFuzz to use."""
|
| 334 |
+
|
| 335 |
+
def upload_build(self, commit): # pylint: disable=no-self-use
|
| 336 |
+
"""Noop Implementation of upload_build."""
|
| 337 |
+
logging.info('Not uploading latest build because no ClusterFuzz '
|
| 338 |
+
'deployment.')
|
| 339 |
+
|
| 340 |
+
def upload_corpus(self, target_name, corpus_dir, replace=False): # pylint: disable=no-self-use,unused-argument
|
| 341 |
+
"""Noop Implementation of upload_corpus."""
|
| 342 |
+
logging.info('Not uploading corpus because no ClusterFuzz deployment.')
|
| 343 |
+
|
| 344 |
+
def upload_crashes(self): # pylint: disable=no-self-use
|
| 345 |
+
"""Noop Implementation of upload_crashes."""
|
| 346 |
+
logging.info('Not uploading crashes because no ClusterFuzz deployment.')
|
| 347 |
+
|
| 348 |
+
def download_corpus(self, target_name, corpus_dir):
|
| 349 |
+
"""Noop Implementation of download_corpus."""
|
| 350 |
+
logging.info('Not downloading corpus because no ClusterFuzz deployment.')
|
| 351 |
+
return _make_empty_dir_if_nonexistent(corpus_dir)
|
| 352 |
+
|
| 353 |
+
def download_latest_build(self): # pylint: disable=no-self-use
|
| 354 |
+
"""Noop Implementation of download_latest_build."""
|
| 355 |
+
logging.info(
|
| 356 |
+
'Not downloading latest build because no ClusterFuzz deployment.')
|
| 357 |
+
|
| 358 |
+
def upload_coverage(self):
|
| 359 |
+
"""Noop Implementation of upload_coverage."""
|
| 360 |
+
logging.info(
|
| 361 |
+
'Not uploading coverage report because no ClusterFuzz deployment.')
|
| 362 |
+
|
| 363 |
+
def get_coverage(self, repo_path):
|
| 364 |
+
"""Noop Implementation of get_coverage."""
|
| 365 |
+
logging.info(
|
| 366 |
+
'Not getting project coverage because no ClusterFuzz deployment.')
|
| 367 |
+
|
| 368 |
+
|
| 369 |
+
_PLATFORM_CLUSTERFUZZ_DEPLOYMENT_MAPPING = {
|
| 370 |
+
config_utils.BaseConfig.Platform.INTERNAL_GENERIC_CI: OSSFuzz,
|
| 371 |
+
config_utils.BaseConfig.Platform.INTERNAL_GITHUB: OSSFuzz,
|
| 372 |
+
config_utils.BaseConfig.Platform.EXTERNAL_GENERIC_CI: ClusterFuzzLite,
|
| 373 |
+
config_utils.BaseConfig.Platform.EXTERNAL_GITHUB: ClusterFuzzLite,
|
| 374 |
+
}
|
| 375 |
+
|
| 376 |
+
|
| 377 |
+
def get_clusterfuzz_deployment(config, workspace):
|
| 378 |
+
"""Returns object reprsenting deployment of ClusterFuzz used by |config|."""
|
| 379 |
+
deployment_cls = _PLATFORM_CLUSTERFUZZ_DEPLOYMENT_MAPPING[config.platform]
|
| 380 |
+
if config.no_clusterfuzz_deployment:
|
| 381 |
+
logging.info('Overriding ClusterFuzzDeployment. Using None.')
|
| 382 |
+
deployment_cls = NoClusterFuzzDeployment
|
| 383 |
+
result = deployment_cls(config, workspace)
|
| 384 |
+
logging.info('ClusterFuzzDeployment: %s.', result)
|
| 385 |
+
return result
|
local-test-tika-full-01-vuln_8/fuzz-tooling/infra/cifuzz/http_utils_test.py
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2021 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""Tests for http_utils.py"""
|
| 15 |
+
|
| 16 |
+
import unittest
|
| 17 |
+
from unittest import mock
|
| 18 |
+
|
| 19 |
+
from pyfakefs import fake_filesystem_unittest
|
| 20 |
+
|
| 21 |
+
import http_utils
|
| 22 |
+
|
| 23 |
+
mock_get_response = mock.MagicMock(status_code=200, content=b'')
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
class DownloadUrlTest(unittest.TestCase):
|
| 27 |
+
"""Tests that download_url works."""
|
| 28 |
+
URL = 'https://example.com/file'
|
| 29 |
+
FILE_PATH = '/tmp/file'
|
| 30 |
+
|
| 31 |
+
@mock.patch('time.sleep')
|
| 32 |
+
@mock.patch('requests.get', return_value=mock_get_response)
|
| 33 |
+
def test_download_url_no_error(self, mock_urlretrieve, _):
|
| 34 |
+
"""Tests that download_url works when there is no error."""
|
| 35 |
+
self.assertTrue(http_utils.download_url(self.URL, self.FILE_PATH))
|
| 36 |
+
self.assertEqual(1, mock_urlretrieve.call_count)
|
| 37 |
+
|
| 38 |
+
@mock.patch('time.sleep')
|
| 39 |
+
@mock.patch('logging.error')
|
| 40 |
+
@mock.patch('requests.get',
|
| 41 |
+
return_value=mock.MagicMock(status_code=404, content=b''))
|
| 42 |
+
def test_download_url_http_error(self, mock_get, mock_error, _):
|
| 43 |
+
"""Tests that download_url doesn't retry when there is an HTTP error."""
|
| 44 |
+
self.assertFalse(http_utils.download_url(self.URL, self.FILE_PATH))
|
| 45 |
+
mock_error.assert_called_with(
|
| 46 |
+
'Unable to download from: %s. Code: %d. Content: %s.', self.URL, 404,
|
| 47 |
+
b'')
|
| 48 |
+
self.assertEqual(1, mock_get.call_count)
|
| 49 |
+
|
| 50 |
+
@mock.patch('time.sleep')
|
| 51 |
+
@mock.patch('requests.get', side_effect=ConnectionResetError)
|
| 52 |
+
def test_download_url_connection_error(self, mock_get, mock_sleep):
|
| 53 |
+
"""Tests that download_url doesn't retry when there is an HTTP error."""
|
| 54 |
+
self.assertFalse(http_utils.download_url(self.URL, self.FILE_PATH))
|
| 55 |
+
self.assertEqual(4, mock_get.call_count)
|
| 56 |
+
self.assertEqual(3, mock_sleep.call_count)
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
class DownloadAndUnpackZipTest(fake_filesystem_unittest.TestCase):
|
| 60 |
+
"""Tests download_and_unpack_zip."""
|
| 61 |
+
|
| 62 |
+
def setUp(self):
|
| 63 |
+
self.setUpPyfakefs()
|
| 64 |
+
|
| 65 |
+
@mock.patch('requests.get', return_value=mock_get_response)
|
| 66 |
+
def test_bad_zip_download(self, _):
|
| 67 |
+
"""Tests download_and_unpack_zip returns none when a bad zip is passed."""
|
| 68 |
+
self.fs.create_file('/url_tmp.zip', contents='Test file.')
|
| 69 |
+
self.assertFalse(
|
| 70 |
+
http_utils.download_and_unpack_zip('/not/a/real/url',
|
| 71 |
+
'/extract-directory'))
|
local-test-tika-full-01-vuln_8/fuzz-tooling/infra/cifuzz/run_cifuzz.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2021 Google LLC
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
"""Script for running CIFuzz end-to-end. This is meant to work outside any
|
| 15 |
+
docker image. This cannot depend on any CIFuzz code or third party packages."""
|
| 16 |
+
import os
|
| 17 |
+
import subprocess
|
| 18 |
+
import sys
|
| 19 |
+
import tempfile
|
| 20 |
+
import logging
|
| 21 |
+
|
| 22 |
+
INFRA_DIR = os.path.dirname(os.path.dirname(__file__))
|
| 23 |
+
DEFAULT_ENVS = [('DRY_RUN', '0'), ('SANITIZER', 'address')]
|
| 24 |
+
BASE_CIFUZZ_DOCKER_TAG = 'ghcr.io/aixcc-finals'
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
def set_default_env_var_if_unset(env_var, default_value):
|
| 28 |
+
"""Sets the value of |env_var| in the environment to |default_value| if it was
|
| 29 |
+
not already set."""
|
| 30 |
+
if env_var not in os.environ:
|
| 31 |
+
os.environ[env_var] = default_value
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def docker_run(name, workspace, project_src_path):
|
| 35 |
+
"""Runs a CIFuzz docker container with |name|."""
|
| 36 |
+
command = [
|
| 37 |
+
'docker', 'run', '--name', name, '--rm', '-e', 'PROJECT_SRC_PATH', '-e',
|
| 38 |
+
'OSS_FUZZ_PROJECT_NAME', '-e', 'WORKSPACE', '-e', 'REPOSITORY', '-e',
|
| 39 |
+
'DRY_RUN', '-e', 'CI', '-e', 'SANITIZER', '-e', 'GIT_SHA', '-e',
|
| 40 |
+
'FILESTORE', '-e', 'NO_CLUSTERFUZZ_DEPLOYMENT'
|
| 41 |
+
]
|
| 42 |
+
if project_src_path:
|
| 43 |
+
command += ['-v', f'{project_src_path}:{project_src_path}']
|
| 44 |
+
command += [
|
| 45 |
+
'-v', '/var/run/docker.sock:/var/run/docker.sock', '-v',
|
| 46 |
+
f'{workspace}:{workspace}', f'{BASE_CIFUZZ_DOCKER_TAG}/{name}'
|
| 47 |
+
]
|
| 48 |
+
print('Running docker command:', command)
|
| 49 |
+
subprocess.run(command, check=True)
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
def docker_build(image):
|
| 53 |
+
"""Builds the CIFuzz |image|. Only suitable for building CIFuzz images."""
|
| 54 |
+
command = [
|
| 55 |
+
'docker', 'build', '-t', f'{BASE_CIFUZZ_DOCKER_TAG}/{image}', '--file',
|
| 56 |
+
f'{image}.Dockerfile', '.'
|
| 57 |
+
]
|
| 58 |
+
subprocess.run(command, check=True, cwd=INFRA_DIR)
|
| 59 |
+
|
| 60 |
+
|
| 61 |
+
def main():
|
| 62 |
+
"""Builds and runs fuzzers using CIFuzz."""
|
| 63 |
+
for env_var, default_value in DEFAULT_ENVS:
|
| 64 |
+
set_default_env_var_if_unset(env_var, default_value)
|
| 65 |
+
|
| 66 |
+
repository = os.getenv('REPOSITORY')
|
| 67 |
+
assert repository
|
| 68 |
+
|
| 69 |
+
project_src_path = os.getenv('PROJECT_SRC_PATH')
|
| 70 |
+
|
| 71 |
+
with tempfile.TemporaryDirectory() as temp_dir:
|
| 72 |
+
if 'WORKSPACE' not in os.environ:
|
| 73 |
+
os.environ['WORKSPACE'] = temp_dir
|
| 74 |
+
|
| 75 |
+
workspace = os.environ['WORKSPACE']
|
| 76 |
+
|
| 77 |
+
docker_build('build_fuzzers')
|
| 78 |
+
docker_run('build_fuzzers', workspace, project_src_path)
|
| 79 |
+
docker_build('run_fuzzers')
|
| 80 |
+
try:
|
| 81 |
+
docker_run('run_fuzzers', workspace, project_src_path)
|
| 82 |
+
except subprocess.CalledProcessError:
|
| 83 |
+
logging.error('run_fuzzers failed.')
|
| 84 |
+
return 1
|
| 85 |
+
return 0
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
if __name__ == '__main__':
|
| 89 |
+
sys.exit(main())
|
local-test-tika-full-01-vuln_8/fuzz-tooling/infra/uploader/Dockerfile
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from ubuntu:16.04
|
| 2 |
+
|
| 3 |
+
RUN apt-get update && apt-get upgrade -y
|
| 4 |
+
RUN apt-get install -y curl
|
| 5 |
+
|
| 6 |
+
ENTRYPOINT ["curl", "--retry", "5", "-X", "PUT", "-T"]
|
| 7 |
+
|
local-test-tika-full-01-vuln_8/fuzz-tooling/tools/vscode-extension/src/commands/cmdBuildFuzzerFromWorkspace.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2023 Google LLC
|
| 2 |
+
//
|
| 3 |
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
// you may not use this file except in compliance with the License.
|
| 5 |
+
// You may obtain a copy of the License at
|
| 6 |
+
//
|
| 7 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
//
|
| 9 |
+
// Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
// See the License for the specific language governing permissions and
|
| 13 |
+
// limitations under the License.
|
| 14 |
+
//
|
| 15 |
+
////////////////////////////////////////////////////////////////////////////////
|
| 16 |
+
|
| 17 |
+
import * as vscode from 'vscode';
|
| 18 |
+
import {println} from '../logger';
|
| 19 |
+
import {commandHistory} from '../commandUtils';
|
| 20 |
+
import {
|
| 21 |
+
hasOssFuzzInWorkspace,
|
| 22 |
+
getOssFuzzWorkspaceProjectName,
|
| 23 |
+
setStatusText,
|
| 24 |
+
} from '../utils';
|
| 25 |
+
import {buildFuzzersFromWorkspace} from '../ossfuzzWrappers';
|
| 26 |
+
|
| 27 |
+
export async function cmdInputCollectorBuildFuzzersFromWorkspace() {
|
| 28 |
+
let ossFuzzProjectName = '';
|
| 29 |
+
// First determine if we have a name in the workspace
|
| 30 |
+
if (await hasOssFuzzInWorkspace()) {
|
| 31 |
+
/**
|
| 32 |
+
* The fuzzers are in the workspace, as opposed to e.g. the oss-fuzz dirctory.
|
| 33 |
+
*/
|
| 34 |
+
ossFuzzProjectName = await getOssFuzzWorkspaceProjectName();
|
| 35 |
+
} else {
|
| 36 |
+
// If we did not have that, ask the user.
|
| 37 |
+
|
| 38 |
+
const ossFuzzProjectNameInput = await vscode.window.showInputBox({
|
| 39 |
+
value: '',
|
| 40 |
+
placeHolder: 'The OSS-Fuzz project name',
|
| 41 |
+
});
|
| 42 |
+
if (!ossFuzzProjectNameInput) {
|
| 43 |
+
println('Did not get a ossFuzzTargetProject');
|
| 44 |
+
return false;
|
| 45 |
+
}
|
| 46 |
+
ossFuzzProjectName = ossFuzzProjectNameInput.toString();
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
// Create an history object
|
| 50 |
+
const args = new Object({
|
| 51 |
+
projectName: ossFuzzProjectName,
|
| 52 |
+
sanitizer: '',
|
| 53 |
+
toClean: false,
|
| 54 |
+
});
|
| 55 |
+
|
| 56 |
+
const commandObject = new Object({
|
| 57 |
+
commandType: 'oss-fuzz.WSBuildFuzzers',
|
| 58 |
+
Arguments: args,
|
| 59 |
+
dispatcherFunc: cmdDispatchBuildFuzzersFromWorkspace,
|
| 60 |
+
});
|
| 61 |
+
console.log('L1: ' + commandHistory.length);
|
| 62 |
+
commandHistory.push(commandObject);
|
| 63 |
+
|
| 64 |
+
await cmdDispatchBuildFuzzersFromWorkspace(args);
|
| 65 |
+
return true;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
async function cmdDispatchBuildFuzzersFromWorkspace(args: any) {
|
| 69 |
+
await setStatusText('Building fuzzers: starting');
|
| 70 |
+
const res = await buildFuzzersFromWorkspace(
|
| 71 |
+
args.projectName,
|
| 72 |
+
args.sanitizer,
|
| 73 |
+
args.toClean
|
| 74 |
+
);
|
| 75 |
+
if (res) {
|
| 76 |
+
await setStatusText('Building fuzzers: finished');
|
| 77 |
+
} else {
|
| 78 |
+
await setStatusText('Building fuzzers: failed');
|
| 79 |
+
}
|
| 80 |
+
}
|
local-test-tika-full-01-vuln_8/fuzz-tooling/tools/vscode-extension/src/commands/cmdBuildFuzzerFromWorkspaceCFLite.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
| 2 |
+
// Copyright 2023 Google LLC
|
| 3 |
+
//
|
| 4 |
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
// you may not use this file except in compliance with the License.
|
| 6 |
+
// You may obtain a copy of the License at
|
| 7 |
+
//
|
| 8 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
//
|
| 10 |
+
// Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
// See the License for the specific language governing permissions and
|
| 14 |
+
// limitations under the License.
|
| 15 |
+
//
|
| 16 |
+
////////////////////////////////////////////////////////////////////////////////
|
| 17 |
+
|
| 18 |
+
import {commandHistory} from '../commandUtils';
|
| 19 |
+
import {setStatusText} from '../utils';
|
| 20 |
+
import {buildFuzzersFromWorkspaceClusterfuzzLite} from '../ossfuzzWrappers';
|
| 21 |
+
|
| 22 |
+
export async function cmdInputCollectorBuildFuzzersFromWorkspaceCFLite() {
|
| 23 |
+
// Create an history object
|
| 24 |
+
const args = new Object({
|
| 25 |
+
toClean: false,
|
| 26 |
+
});
|
| 27 |
+
|
| 28 |
+
const commandObject = new Object({
|
| 29 |
+
commandType: 'oss-fuzz.WSBuildFuzzers',
|
| 30 |
+
Arguments: args,
|
| 31 |
+
dispatcherFunc: cmdDispatchbuildFuzzersFromWorkspaceClusterfuzzLite,
|
| 32 |
+
});
|
| 33 |
+
console.log('L1: ' + commandHistory.length);
|
| 34 |
+
commandHistory.push(commandObject);
|
| 35 |
+
|
| 36 |
+
await cmdDispatchbuildFuzzersFromWorkspaceClusterfuzzLite(args);
|
| 37 |
+
return true;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
| 41 |
+
async function cmdDispatchbuildFuzzersFromWorkspaceClusterfuzzLite(_args: any) {
|
| 42 |
+
await setStatusText('[CFLite] Building fuzzers: starting');
|
| 43 |
+
const res = await buildFuzzersFromWorkspaceClusterfuzzLite();
|
| 44 |
+
if (res) {
|
| 45 |
+
await setStatusText('[CFLite] Building fuzzers: finished');
|
| 46 |
+
} else {
|
| 47 |
+
await setStatusText('[CFLite] Building fuzzers: failed');
|
| 48 |
+
}
|
| 49 |
+
}
|
local-test-tika-full-01-vuln_8/fuzz-tooling/tools/vscode-extension/src/commands/cmdDisplayCoverage.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2023 Google LLC
|
| 2 |
+
//
|
| 3 |
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
// you may not use this file except in compliance with the License.
|
| 5 |
+
// You may obtain a copy of the License at
|
| 6 |
+
//
|
| 7 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
//
|
| 9 |
+
// Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
// See the License for the specific language governing permissions and
|
| 13 |
+
// limitations under the License.
|
| 14 |
+
//
|
| 15 |
+
////////////////////////////////////////////////////////////////////////////////
|
| 16 |
+
|
| 17 |
+
import * as vscode from 'vscode';
|
| 18 |
+
import {loadCoverageIntoWorkspace} from '../coverageHelper';
|
| 19 |
+
import {println} from '../logger';
|
| 20 |
+
import {getApi, FileDownloader} from '@microsoft/vscode-file-downloader-api';
|
| 21 |
+
|
| 22 |
+
/*
|
| 23 |
+
* Displays code coverage from OSS-Fuzz.
|
| 24 |
+
*
|
| 25 |
+
* Downloads a code coverage report from the OSS-Fuzz online storage, and then overlays
|
| 26 |
+
* the relevant source files with the coverage information.
|
| 27 |
+
*/
|
| 28 |
+
export async function displayCodeCoverageFromOssFuzz(
|
| 29 |
+
context: vscode.ExtensionContext
|
| 30 |
+
) {
|
| 31 |
+
const projectName = await vscode.window.showInputBox({
|
| 32 |
+
value: '',
|
| 33 |
+
placeHolder: "The project you'd like to get code coverage for.",
|
| 34 |
+
});
|
| 35 |
+
if (!projectName) {
|
| 36 |
+
return;
|
| 37 |
+
}
|
| 38 |
+
println('Getting code coverage for ' + projectName);
|
| 39 |
+
|
| 40 |
+
const fileDownloader: FileDownloader = await getApi();
|
| 41 |
+
|
| 42 |
+
const currentDate = new Date();
|
| 43 |
+
const yesterday = new Date(currentDate);
|
| 44 |
+
yesterday.setDate(yesterday.getDate() - 1);
|
| 45 |
+
|
| 46 |
+
const day = yesterday.getDate();
|
| 47 |
+
const month = yesterday.getMonth();
|
| 48 |
+
const year = yesterday.getFullYear();
|
| 49 |
+
|
| 50 |
+
try {
|
| 51 |
+
const codeCoverageFile: vscode.Uri = await fileDownloader.downloadFile(
|
| 52 |
+
vscode.Uri.parse(
|
| 53 |
+
'https://storage.googleapis.com/oss-fuzz-coverage/' +
|
| 54 |
+
projectName +
|
| 55 |
+
'/textcov_reports/' +
|
| 56 |
+
year.toString() +
|
| 57 |
+
month.toString() +
|
| 58 |
+
day.toString() +
|
| 59 |
+
'/all_cov.json'
|
| 60 |
+
),
|
| 61 |
+
'all_cov.json',
|
| 62 |
+
context
|
| 63 |
+
);
|
| 64 |
+
await loadCoverageIntoWorkspace(context, codeCoverageFile);
|
| 65 |
+
} catch (err) {
|
| 66 |
+
println(
|
| 67 |
+
'Could not get the URL. Currently, this feature is only supported for Python projects'
|
| 68 |
+
);
|
| 69 |
+
return;
|
| 70 |
+
}
|
| 71 |
+
}
|
local-test-tika-full-01-vuln_8/fuzz-tooling/tools/vscode-extension/src/commands/cmdFIGetOptimalTargets.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2025 Google LLC
|
| 2 |
+
//
|
| 3 |
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
// you may not use this file except in compliance with the License.
|
| 5 |
+
// You may obtain a copy of the License at
|
| 6 |
+
//
|
| 7 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
//
|
| 9 |
+
// Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
// See the License for the specific language governing permissions and
|
| 13 |
+
// limitations under the License.
|
| 14 |
+
//
|
| 15 |
+
////////////////////////////////////////////////////////////////////////////////
|
| 16 |
+
|
| 17 |
+
import {getOptimalTargetsFromIntrospector} from '../fuzzIntrospectorHelper';
|
| 18 |
+
|
| 19 |
+
export async function runGetOptimalTargetsHandler() {
|
| 20 |
+
getOptimalTargetsFromIntrospector();
|
| 21 |
+
}
|
local-test-tika-full-01-vuln_8/fuzz-tooling/tools/vscode-extension/src/commands/cmdRunFI.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2024 Google LLC
|
| 2 |
+
//
|
| 3 |
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
// you may not use this file except in compliance with the License.
|
| 5 |
+
// You may obtain a copy of the License at
|
| 6 |
+
//
|
| 7 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
//
|
| 9 |
+
// Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
// See the License for the specific language governing permissions and
|
| 13 |
+
// limitations under the License.
|
| 14 |
+
//
|
| 15 |
+
////////////////////////////////////////////////////////////////////////////////
|
| 16 |
+
|
| 17 |
+
import {runFuzzIntrospector} from '../fuzzIntrospectorHelper';
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* Function for setting up Fuzz Introspector by way of a Python virtual env.
|
| 21 |
+
*/
|
| 22 |
+
export async function runFuzzIntrospectorHandler() {
|
| 23 |
+
runFuzzIntrospector();
|
| 24 |
+
}
|
local-test-tika-full-01-vuln_8/fuzz-tooling/tools/vscode-extension/src/commands/cmdSetOSSFuzzPath.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2023 Google LLC
|
| 2 |
+
//
|
| 3 |
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
// you may not use this file except in compliance with the License.
|
| 5 |
+
// You may obtain a copy of the License at
|
| 6 |
+
//
|
| 7 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
//
|
| 9 |
+
// Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
// See the License for the specific language governing permissions and
|
| 13 |
+
// limitations under the License.
|
| 14 |
+
//
|
| 15 |
+
////////////////////////////////////////////////////////////////////////////////
|
| 16 |
+
|
| 17 |
+
import * as vscode from 'vscode';
|
| 18 |
+
|
| 19 |
+
import {println} from '../logger';
|
| 20 |
+
import {extensionConfig} from '../config';
|
| 21 |
+
|
| 22 |
+
// Set the oss-fuzz path.
|
| 23 |
+
export async function setOssFuzzPath() {
|
| 24 |
+
println('Setting path');
|
| 25 |
+
const newOssFuzzPath = await vscode.window.showInputBox({
|
| 26 |
+
value: '',
|
| 27 |
+
placeHolder: 'Type path',
|
| 28 |
+
});
|
| 29 |
+
if (!newOssFuzzPath) {
|
| 30 |
+
println('Failed getting path');
|
| 31 |
+
return;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
const fpathh = vscode.Uri.file(newOssFuzzPath);
|
| 35 |
+
let isValid = false;
|
| 36 |
+
try {
|
| 37 |
+
if (await vscode.workspace.fs.readDirectory(fpathh)) {
|
| 38 |
+
println('Is a directory');
|
| 39 |
+
const helperPathURI = vscode.Uri.file(
|
| 40 |
+
newOssFuzzPath + '/infra/helper.py'
|
| 41 |
+
);
|
| 42 |
+
if (await vscode.workspace.fs.readFile(helperPathURI)) {
|
| 43 |
+
println('Found helper file');
|
| 44 |
+
isValid = true;
|
| 45 |
+
}
|
| 46 |
+
isValid = true;
|
| 47 |
+
} else {
|
| 48 |
+
isValid = false;
|
| 49 |
+
}
|
| 50 |
+
} catch {
|
| 51 |
+
isValid = false;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
if (isValid) {
|
| 55 |
+
extensionConfig.ossFuzzPepositoryWorkPath = newOssFuzzPath;
|
| 56 |
+
} else {
|
| 57 |
+
println('Not setting OSS-Fuzz path');
|
| 58 |
+
}
|
| 59 |
+
}
|
local-test-tika-full-01-vuln_8/fuzz-tooling/tools/vscode-extension/src/commands/cmdTestFuzzer.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Copyright 2023 Google LLC
|
| 2 |
+
//
|
| 3 |
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
// you may not use this file except in compliance with the License.
|
| 5 |
+
// You may obtain a copy of the License at
|
| 6 |
+
//
|
| 7 |
+
// http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
//
|
| 9 |
+
// Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
// See the License for the specific language governing permissions and
|
| 13 |
+
// limitations under the License.
|
| 14 |
+
//
|
| 15 |
+
////////////////////////////////////////////////////////////////////////////////
|
| 16 |
+
|
| 17 |
+
import * as vscode from 'vscode';
|
| 18 |
+
import {println} from '../logger';
|
| 19 |
+
import {runFuzzerHandler, buildFuzzersFromWorkspace} from '../ossfuzzWrappers';
|
| 20 |
+
import {setStatusText} from '../utils';
|
| 21 |
+
import {commandHistory} from '../commandUtils';
|
| 22 |
+
import {extensionConfig} from '../config';
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* Does an end-to-end test of a project/fuzzer. This is done by
|
| 26 |
+
* first building the project and then running the fuzzer.
|
| 27 |
+
* @param context
|
| 28 |
+
* @returns
|
| 29 |
+
*/
|
| 30 |
+
|
| 31 |
+
export async function cmdInputCollectorTestFuzzer() {
|
| 32 |
+
setStatusText('Testing specific fuzzer: getting input');
|
| 33 |
+
// Get the project name and fuzzer name to test.
|
| 34 |
+
const ossFuzzProjectNameInput = await vscode.window.showInputBox({
|
| 35 |
+
value: '',
|
| 36 |
+
placeHolder: 'The OSS-Fuzz project name',
|
| 37 |
+
});
|
| 38 |
+
if (!ossFuzzProjectNameInput) {
|
| 39 |
+
println('Did not get a ossFuzzTargetProject');
|
| 40 |
+
return;
|
| 41 |
+
}
|
| 42 |
+
println('Project name: ' + ossFuzzProjectNameInput);
|
| 43 |
+
|
| 44 |
+
// Get the fuzzer to run
|
| 45 |
+
const fuzzerNameInput = await vscode.window.showInputBox({
|
| 46 |
+
value: '',
|
| 47 |
+
placeHolder: 'Type a fuzzer name',
|
| 48 |
+
});
|
| 49 |
+
if (!fuzzerNameInput) {
|
| 50 |
+
println('Failed to get fuzzer name');
|
| 51 |
+
return;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
// Create the args object for the dispatcher
|
| 55 |
+
const args = new Object({
|
| 56 |
+
projectName: ossFuzzProjectNameInput.toString(),
|
| 57 |
+
fuzzerName: fuzzerNameInput.toString(),
|
| 58 |
+
});
|
| 59 |
+
|
| 60 |
+
// Create a dispatcher object.
|
| 61 |
+
const commandObject = new Object({
|
| 62 |
+
commandType: 'oss-fuzz.TestFuzzer',
|
| 63 |
+
Arguments: args,
|
| 64 |
+
dispatcherFunc: cmdDispatchTestFuzzerHandler,
|
| 65 |
+
});
|
| 66 |
+
commandHistory.push(commandObject);
|
| 67 |
+
|
| 68 |
+
await cmdDispatchTestFuzzerHandler(args);
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
async function cmdDispatchTestFuzzerHandler(args: any) {
|
| 72 |
+
// Build the project
|
| 73 |
+
setStatusText('Test specific fuzzer: building fuzzers in workspace');
|
| 74 |
+
if (!(await buildFuzzersFromWorkspace(args.projectName, '', false))) {
|
| 75 |
+
println('Build projects');
|
| 76 |
+
return;
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
// Run the fuzzer for 10 seconds
|
| 80 |
+
println('Running fuzzer');
|
| 81 |
+
setStatusText('Test specific fuzzer: running fuzzer ' + args.fuzzerName);
|
| 82 |
+
await runFuzzerHandler(
|
| 83 |
+
args.projectName,
|
| 84 |
+
args.fuzzerName,
|
| 85 |
+
extensionConfig.numberOfSecondsForTestRuns.toString(),
|
| 86 |
+
''
|
| 87 |
+
);
|
| 88 |
+
setStatusText('Test specific fuzzer: test completed of ' + args.fuzzerName);
|
| 89 |
+
return;
|
| 90 |
+
}
|