diff options
author | 2020-02-19 15:32:30 -0800 | |
---|---|---|
committer | 2020-02-19 15:32:30 -0800 | |
commit | 39fe0d725b9ae091d4b7ae1caf6eda3b2ff435f5 (patch) | |
tree | cfc007ba80ee6218f527b1412b310fe58738819f /infra/cifuzz/actions | |
parent | 4d8c828789adaeabac864df15fa42808e7129faf (diff) |
[CIFuzz] Check crash on most recent OSS-Fuzz build (#3385)
Adds functionality to check if a crash exists in the most recent OSS-Fuzz build. This is necessary to determine if a crash was introduced in the current pull request or existed in the project already. Crashes that are surfaced to the user will be both reproducible and novel to the OSS-Fuzz project.
Diffstat (limited to 'infra/cifuzz/actions')
4 files changed, 12 insertions, 6 deletions
diff --git a/infra/cifuzz/actions/build_fuzzers/action.yml b/infra/cifuzz/actions/build_fuzzers/action.yml index cea4c9f4..e9fb31ea 100644 --- a/infra/cifuzz/actions/build_fuzzers/action.yml +++ b/infra/cifuzz/actions/build_fuzzers/action.yml @@ -2,7 +2,7 @@ name: 'build-fuzzers' description: "Builds an OSS-Fuzz project's fuzzers." inputs: - project-name: + oss-fuzz-project-name: description: 'Name of the corresponding OSS-Fuzz project.' required: true dry-run: @@ -12,5 +12,5 @@ runs: using: 'docker' image: 'Dockerfile' env: - PROJECT_NAME: ${{ inputs.project-name }} + OSS_FUZZ_PROJECT_NAME: ${{ inputs.oss-fuzz-project-name }} DRY_RUN: ${{ inputs.dry-run}} diff --git a/infra/cifuzz/actions/build_fuzzers/build_fuzzers_entrypoint.py b/infra/cifuzz/actions/build_fuzzers/build_fuzzers_entrypoint.py index 92d795a3..9c0a982b 100644 --- a/infra/cifuzz/actions/build_fuzzers/build_fuzzers_entrypoint.py +++ b/infra/cifuzz/actions/build_fuzzers/build_fuzzers_entrypoint.py @@ -37,7 +37,7 @@ def main(): the directory: ${GITHUB_WORKSPACE}/out Required environment variables: - PROJECT_NAME: The name of OSS-Fuzz project. + OSS_FUZZ_PROJECT_NAME: The name of OSS-Fuzz project. GITHUB_REPOSITORY: The name of the Github repo that called this script. GITHUB_SHA: The commit SHA that triggered this script. GITHUB_REF: The pull request reference that triggered this script. @@ -47,7 +47,7 @@ def main(): Returns: 0 on success or 1 on Failure. """ - oss_fuzz_project_name = os.environ.get('PROJECT_NAME') + oss_fuzz_project_name = os.environ.get('OSS_FUZZ_PROJECT_NAME') github_repo_name = os.path.basename(os.environ.get('GITHUB_REPOSITORY')) pr_ref = os.environ.get('GITHUB_REF') commit_sha = os.environ.get('GITHUB_SHA') diff --git a/infra/cifuzz/actions/run_fuzzers/action.yml b/infra/cifuzz/actions/run_fuzzers/action.yml index c4ce0e49..ca40c4fe 100644 --- a/infra/cifuzz/actions/run_fuzzers/action.yml +++ b/infra/cifuzz/actions/run_fuzzers/action.yml @@ -2,6 +2,9 @@ name: 'run-fuzzers' description: 'Runs fuzz target binaries for a specified length of time.' inputs: + oss-fuzz-project-name: + description: 'The OSS-Fuzz project name.' + required: true fuzz-seconds: description: 'The total time allotted for fuzzing in seconds.' required: true @@ -13,5 +16,6 @@ runs: using: 'docker' image: 'Dockerfile' env: + OSS_FUZZ_PROJECT_NAME: ${{ inputs.oss-fuzz-project-name }} FUZZ_SECONDS: ${{ inputs.fuzz-seconds }} DRY_RUN: ${{ inputs.dry-run}} diff --git a/infra/cifuzz/actions/run_fuzzers/run_fuzzers_entrypoint.py b/infra/cifuzz/actions/run_fuzzers/run_fuzzers_entrypoint.py index 70a32f30..5aa83e5a 100644 --- a/infra/cifuzz/actions/run_fuzzers/run_fuzzers_entrypoint.py +++ b/infra/cifuzz/actions/run_fuzzers/run_fuzzers_entrypoint.py @@ -46,13 +46,14 @@ def main(): FUZZ_SECONDS: The length of time in seconds that fuzzers are to be run. GITHUB_WORKSPACE: The shared volume directory where input artifacts are. DRY_RUN: If true, no failures will surface. + OSS_FUZZ_PROJECT_NAME: The name of the relevant OSS-Fuzz project. Returns: 0 on success or 1 on Failure. """ fuzz_seconds = int(os.environ.get('FUZZ_SECONDS', 600)) workspace = os.environ.get('GITHUB_WORKSPACE') - + oss_fuzz_project_name = os.environ.get('OSS_FUZZ_PROJECT_NAME') # Check if failures should not be reported. dry_run = (os.environ.get('DRY_RUN').lower() == 'true') @@ -73,7 +74,8 @@ def main(): logging.error('This script needs to be run in the Github action context.') return error_code # Run the specified project's fuzzers from the build. - run_status, bug_found = cifuzz.run_fuzzers(fuzz_seconds, workspace) + run_status, bug_found = cifuzz.run_fuzzers(fuzz_seconds, workspace, + oss_fuzz_project_name) if not run_status: logging.error('Error occured while running in workspace %s.', workspace) return error_code |