Add files using upload-large-folder tool
Browse files- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_measure +32 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_run_fuzzer +41 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/base-images/base-builder-go/gosigfuzz.c +47 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/base-images/base-builder-go/ossfuzz_coverage_runner.go +80 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/base-images/base-builder-swift/Dockerfile +22 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/base-images/base-builder-swift/precompile_swift +33 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/base-images/base-runner-debug/Dockerfile +26 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/cifuzz/actions/build_fuzzers/action.yml +55 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/cifuzz/filestore/git/git_test.py +122 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/cifuzz/filestore/github_actions/github_actions_test.py +283 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/cifuzz/test_data/external-project/.clusterfuzzlite/Dockerfile +22 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/cifuzz/test_data/external-project/Makefile +44 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/cifuzz/test_data/external-project/do_stuff_fuzzer.cpp +24 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/cifuzz/test_data/external-project/my_api.cpp +36 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/cifuzz/test_data/external-project/my_api.h +19 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/tools/wycheproof/.gitignore +1 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/tools/wycheproof/generate_job.py +50 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/tools/wycheproof/launcher.py +34 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/tools/wycheproof/package.bash +18 -0
- local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/tools/wycheproof/run.py +50 -0
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_measure
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#! /bin/bash -eux
|
| 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 |
+
# TODO(metzman): Make these configurable.
|
| 19 |
+
export DB_PATH=$OUT/experiment.db
|
| 20 |
+
export SNAPSHOT_PERIOD=30
|
| 21 |
+
export EXPERIMENT_FILESTORE=$OUT/filestore
|
| 22 |
+
export MAX_TOTAL_TIME=120
|
| 23 |
+
export EXPERIMENT=oss-fuzz-on-demand
|
| 24 |
+
|
| 25 |
+
rm -f $DB_PATH
|
| 26 |
+
|
| 27 |
+
# FUZZER=mopt BENCHMARK=skcms
|
| 28 |
+
|
| 29 |
+
export SQL_DATABASE_URL=sqlite:///$DB_PATH
|
| 30 |
+
|
| 31 |
+
cd $FUZZBENCH_PATH
|
| 32 |
+
PYTHONPATH=. python3 -B experiment/measurer/standalone.py $MAX_TOTAL_TIME
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/base-images/base-builder-fuzzbench/fuzzbench_run_fuzzer
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#! /bin/bash -eux
|
| 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 |
+
export RUNNER_NICENESS="-5"
|
| 19 |
+
export EXPERIMENT_FILESTORE=$OUT/filestore
|
| 20 |
+
export EXPERIMENT=oss-fuzz-on-demand
|
| 21 |
+
export OSS_FUZZ_ON_DEMAND=1
|
| 22 |
+
export OUTPUT_CORPUS_DIR=/output-corpus
|
| 23 |
+
export SEED_CORPUS_DIR=/input-corpus
|
| 24 |
+
mkdir $SEED_CORPUS_DIR
|
| 25 |
+
rm -rf $OUTPUT_CORPUS_DIR
|
| 26 |
+
mkdir $OUTPUT_CORPUS_DIR
|
| 27 |
+
export FUZZER=$FUZZING_ENGINE
|
| 28 |
+
# TODO(metzman): Make this configurable.
|
| 29 |
+
export MAX_TOTAL_TIME=120
|
| 30 |
+
export SNAPSHOT_PERIOD=30
|
| 31 |
+
export TRIAL_ID=1
|
| 32 |
+
export FORCE_LOCAL=1
|
| 33 |
+
|
| 34 |
+
# BENCHMARK, FUZZ_TARGET
|
| 35 |
+
cd $OUT
|
| 36 |
+
|
| 37 |
+
# Prevent permissions issues with pyc files and docker.
|
| 38 |
+
cp -r $FUZZBENCH_PATH /tmp/fuzzbench
|
| 39 |
+
|
| 40 |
+
PYTHONPATH=/tmp/fuzzbench nice -n $RUNNER_NICENESS python3 -B -u /tmp/fuzzbench/experiment/runner.py
|
| 41 |
+
cat $EXPERIMENT_FILESTORE/$EXPERIMENT/experiment-folders/$BENCHMARK-$FUZZER/trial-$TRIAL_ID/results/fuzzer-log.txt
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/base-images/base-builder-go/gosigfuzz.c
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 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 |
+
#include<stdlib.h>
|
| 18 |
+
#include<signal.h>
|
| 19 |
+
|
| 20 |
+
static void fixSignalHandler(int signum) {
|
| 21 |
+
struct sigaction new_action;
|
| 22 |
+
struct sigaction old_action;
|
| 23 |
+
sigemptyset (&new_action.sa_mask);
|
| 24 |
+
sigaction (signum, NULL, &old_action);
|
| 25 |
+
new_action.sa_flags = old_action.sa_flags | SA_ONSTACK;
|
| 26 |
+
new_action.sa_sigaction = old_action.sa_sigaction;
|
| 27 |
+
new_action.sa_handler = old_action.sa_handler;
|
| 28 |
+
sigaction (signum, &new_action, NULL);
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
static void FixStackSignalHandler() {
|
| 32 |
+
fixSignalHandler(SIGSEGV);
|
| 33 |
+
fixSignalHandler(SIGABRT);
|
| 34 |
+
fixSignalHandler(SIGALRM);
|
| 35 |
+
fixSignalHandler(SIGINT);
|
| 36 |
+
fixSignalHandler(SIGTERM);
|
| 37 |
+
fixSignalHandler(SIGBUS);
|
| 38 |
+
fixSignalHandler(SIGFPE);
|
| 39 |
+
fixSignalHandler(SIGXFSZ);
|
| 40 |
+
fixSignalHandler(SIGUSR1);
|
| 41 |
+
fixSignalHandler(SIGUSR2);
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
int LLVMFuzzerInitialize(int *argc, char ***argv) {
|
| 45 |
+
FixStackSignalHandler();
|
| 46 |
+
return 0;
|
| 47 |
+
}
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/base-images/base-builder-go/ossfuzz_coverage_runner.go
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
package mypackagebeingfuzzed
|
| 16 |
+
|
| 17 |
+
import (
|
| 18 |
+
"io/fs"
|
| 19 |
+
"io/ioutil"
|
| 20 |
+
"os"
|
| 21 |
+
"path/filepath"
|
| 22 |
+
"runtime/pprof"
|
| 23 |
+
"testing"
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
func TestFuzzCorpus(t *testing.T) {
|
| 27 |
+
dir := os.Getenv("FUZZ_CORPUS_DIR")
|
| 28 |
+
if dir == "" {
|
| 29 |
+
t.Logf("No fuzzing corpus directory set")
|
| 30 |
+
return
|
| 31 |
+
}
|
| 32 |
+
filename := ""
|
| 33 |
+
defer func() {
|
| 34 |
+
if r := recover(); r != nil {
|
| 35 |
+
t.Error("Fuzz panicked in "+filename, r)
|
| 36 |
+
}
|
| 37 |
+
}()
|
| 38 |
+
profname := os.Getenv("FUZZ_PROFILE_NAME")
|
| 39 |
+
if profname != "" {
|
| 40 |
+
f, err := os.Create(profname + ".cpu.prof")
|
| 41 |
+
if err != nil {
|
| 42 |
+
t.Logf("error creating profile file %s\n", err)
|
| 43 |
+
} else {
|
| 44 |
+
_ = pprof.StartCPUProfile(f)
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
_, err := ioutil.ReadDir(dir)
|
| 48 |
+
if err != nil {
|
| 49 |
+
t.Logf("Not fuzzing corpus directory %s", err)
|
| 50 |
+
return
|
| 51 |
+
}
|
| 52 |
+
// recurse for regressions subdirectory
|
| 53 |
+
err = filepath.Walk(dir, func(fname string, info fs.FileInfo, err error) error {
|
| 54 |
+
if info.IsDir() {
|
| 55 |
+
return nil
|
| 56 |
+
}
|
| 57 |
+
data, err := ioutil.ReadFile(fname)
|
| 58 |
+
if err != nil {
|
| 59 |
+
t.Error("Failed to read corpus file", err)
|
| 60 |
+
return err
|
| 61 |
+
}
|
| 62 |
+
filename = fname
|
| 63 |
+
FuzzFunction(data)
|
| 64 |
+
return nil
|
| 65 |
+
})
|
| 66 |
+
if err != nil {
|
| 67 |
+
t.Error("Failed to run corpus", err)
|
| 68 |
+
}
|
| 69 |
+
if profname != "" {
|
| 70 |
+
pprof.StopCPUProfile()
|
| 71 |
+
f, err := os.Create(profname + ".heap.prof")
|
| 72 |
+
if err != nil {
|
| 73 |
+
t.Logf("error creating heap profile file %s\n", err)
|
| 74 |
+
}
|
| 75 |
+
if err = pprof.WriteHeapProfile(f); err != nil {
|
| 76 |
+
t.Logf("error writing heap profile file %s\n", err)
|
| 77 |
+
}
|
| 78 |
+
f.Close()
|
| 79 |
+
}
|
| 80 |
+
}
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/base-images/base-builder-swift/Dockerfile
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
#
|
| 15 |
+
################################################################################
|
| 16 |
+
|
| 17 |
+
ARG IMG_TAG=latest
|
| 18 |
+
FROM ghcr.io/aixcc-finals/base-builder:${IMG_TAG}
|
| 19 |
+
|
| 20 |
+
RUN install_swift.sh
|
| 21 |
+
|
| 22 |
+
COPY precompile_swift /usr/local/bin/
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/base-images/base-builder-swift/precompile_swift
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash -eu
|
| 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 |
+
################################################################################
|
| 17 |
+
|
| 18 |
+
cp /usr/local/bin/llvm-symbolizer-swift $OUT/llvm-symbolizer
|
| 19 |
+
|
| 20 |
+
export SWIFTFLAGS="-Xswiftc -parse-as-library -Xswiftc -static-stdlib --static-swift-stdlib"
|
| 21 |
+
if [ "$SANITIZER" = "coverage" ]
|
| 22 |
+
then
|
| 23 |
+
export SWIFTFLAGS="$SWIFTFLAGS -Xswiftc -profile-generate -Xswiftc -profile-coverage-mapping -Xswiftc -sanitize=fuzzer"
|
| 24 |
+
else
|
| 25 |
+
export SWIFTFLAGS="$SWIFTFLAGS -Xswiftc -sanitize=fuzzer,$SANITIZER --sanitize=$SANITIZER"
|
| 26 |
+
for f in $CFLAGS; do
|
| 27 |
+
export SWIFTFLAGS="$SWIFTFLAGS -Xcc=$f"
|
| 28 |
+
done
|
| 29 |
+
|
| 30 |
+
for f in $CXXFLAGS; do
|
| 31 |
+
export SWIFTFLAGS="$SWIFTFLAGS -Xcxx=$f"
|
| 32 |
+
done
|
| 33 |
+
fi
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/base-images/base-runner-debug/Dockerfile
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2016 Google Inc.
|
| 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 |
+
ARG IMG_TAG=latest
|
| 18 |
+
FROM ghcr.io/aixcc-finals/base-runner:${IMG_TAG}
|
| 19 |
+
RUN apt-get update && apt-get install -y valgrind zip
|
| 20 |
+
|
| 21 |
+
# Installing GDB 12, re https://github.com/google/oss-fuzz/issues/7513.
|
| 22 |
+
RUN apt-get install -y build-essential libgmp-dev && \
|
| 23 |
+
wget https://ftp.gnu.org/gnu/gdb/gdb-12.1.tar.xz && \
|
| 24 |
+
tar -xf gdb-12.1.tar.xz && cd gdb-12.1 && ./configure && \
|
| 25 |
+
make -j $(expr $(nproc) / 2) && make install && cd .. && \
|
| 26 |
+
rm -rf gdb-12.1* && apt-get remove --purge -y build-essential libgmp-dev
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/cifuzz/actions/build_fuzzers/action.yml
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# action.yml
|
| 2 |
+
name: 'build-fuzzers'
|
| 3 |
+
description: "Builds an OSS-Fuzz project's fuzzers."
|
| 4 |
+
inputs:
|
| 5 |
+
oss-fuzz-project-name:
|
| 6 |
+
description: 'Name of the corresponding OSS-Fuzz project.'
|
| 7 |
+
required: true
|
| 8 |
+
language:
|
| 9 |
+
description: 'Programming language project is written in.'
|
| 10 |
+
required: false
|
| 11 |
+
default: 'c++'
|
| 12 |
+
dry-run:
|
| 13 |
+
description: 'If set, run the action without actually reporting a failure.'
|
| 14 |
+
default: false
|
| 15 |
+
allowed-broken-targets-percentage:
|
| 16 |
+
description: 'The percentage of broken targets allowed in bad_build_check.'
|
| 17 |
+
required: false
|
| 18 |
+
sanitizer:
|
| 19 |
+
description: 'The sanitizer to build the fuzzers with.'
|
| 20 |
+
default: 'address'
|
| 21 |
+
architecture:
|
| 22 |
+
description: 'The architecture used to build the fuzzers.'
|
| 23 |
+
default: 'x86_64'
|
| 24 |
+
project-src-path:
|
| 25 |
+
description: "The path to the project's source code checkout."
|
| 26 |
+
required: false
|
| 27 |
+
bad-build-check:
|
| 28 |
+
description: "Whether or not OSS-Fuzz's check for bad builds should be done."
|
| 29 |
+
required: false
|
| 30 |
+
default: true
|
| 31 |
+
keep-unaffected-fuzz-targets:
|
| 32 |
+
description: "Whether to keep unaffected fuzzers or delete them."
|
| 33 |
+
required: false
|
| 34 |
+
default: false
|
| 35 |
+
output-sarif:
|
| 36 |
+
description: "Whether to output fuzzing results to SARIF."
|
| 37 |
+
required: false
|
| 38 |
+
default: false
|
| 39 |
+
runs:
|
| 40 |
+
using: 'docker'
|
| 41 |
+
image: '../../../build_fuzzers.Dockerfile'
|
| 42 |
+
env:
|
| 43 |
+
OSS_FUZZ_PROJECT_NAME: ${{ inputs.oss-fuzz-project-name }}
|
| 44 |
+
LANGUAGE: ${{ inputs.language }}
|
| 45 |
+
DRY_RUN: ${{ inputs.dry-run}}
|
| 46 |
+
ALLOWED_BROKEN_TARGETS_PERCENTAGE: ${{ inputs.allowed-broken-targets-percentage}}
|
| 47 |
+
SANITIZER: ${{ inputs.sanitizer }}
|
| 48 |
+
ARCHITECTURE: ${{ inputs.architecture }}
|
| 49 |
+
PROJECT_SRC_PATH: ${{ inputs.project-src-path }}
|
| 50 |
+
LOW_DISK_SPACE: 'True'
|
| 51 |
+
BAD_BUILD_CHECK: ${{ inputs.bad-build-check }}
|
| 52 |
+
CIFUZZ_DEBUG: 'True'
|
| 53 |
+
CFL_PLATFORM: 'github'
|
| 54 |
+
KEEP_UNAFFECTED_FUZZ_TARGETS: ${{ inputs.keep-unaffected-fuzz-targets }}
|
| 55 |
+
OUTPUT_SARIF: ${{ inputs.output-sarif }}
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/cifuzz/filestore/git/git_test.py
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 git."""
|
| 15 |
+
import filecmp
|
| 16 |
+
import os
|
| 17 |
+
import tempfile
|
| 18 |
+
import subprocess
|
| 19 |
+
import sys
|
| 20 |
+
import unittest
|
| 21 |
+
from unittest import mock
|
| 22 |
+
|
| 23 |
+
# pylint: disable=wrong-import-position
|
| 24 |
+
INFRA_DIR = os.path.dirname(
|
| 25 |
+
os.path.dirname(os.path.dirname(os.path.dirname(
|
| 26 |
+
os.path.abspath(__file__)))))
|
| 27 |
+
sys.path.append(INFRA_DIR)
|
| 28 |
+
|
| 29 |
+
from filestore import git
|
| 30 |
+
import test_helpers
|
| 31 |
+
|
| 32 |
+
# pylint: disable=protected-access,no-self-use
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class GitFilestoreTest(unittest.TestCase):
|
| 36 |
+
"""Tests for GitFilestore."""
|
| 37 |
+
|
| 38 |
+
def setUp(self):
|
| 39 |
+
self.git_dir = tempfile.TemporaryDirectory()
|
| 40 |
+
self.addCleanup(self.git_dir.cleanup)
|
| 41 |
+
|
| 42 |
+
self.local_dir = tempfile.TemporaryDirectory()
|
| 43 |
+
self.addCleanup(self.local_dir.cleanup)
|
| 44 |
+
|
| 45 |
+
self.download_dir = tempfile.TemporaryDirectory()
|
| 46 |
+
self.addCleanup(self.download_dir.cleanup)
|
| 47 |
+
|
| 48 |
+
with open(os.path.join(self.local_dir.name, 'a'), 'w') as handle:
|
| 49 |
+
handle.write('')
|
| 50 |
+
|
| 51 |
+
os.makedirs(os.path.join(self.local_dir.name, 'b'))
|
| 52 |
+
|
| 53 |
+
with open(os.path.join(self.local_dir.name, 'b', 'c'), 'w') as handle:
|
| 54 |
+
handle.write('')
|
| 55 |
+
|
| 56 |
+
self.git_repo = git.git_runner(self.git_dir.name)
|
| 57 |
+
self.git_repo('init', '--bare')
|
| 58 |
+
|
| 59 |
+
self.config = test_helpers.create_run_config(
|
| 60 |
+
git_store_repo='file://' + self.git_dir.name,
|
| 61 |
+
git_store_branch='main',
|
| 62 |
+
git_store_branch_coverage='cov-branch')
|
| 63 |
+
|
| 64 |
+
self.mock_ci_filestore = mock.MagicMock()
|
| 65 |
+
self.git_store = git.GitFilestore(self.config, self.mock_ci_filestore)
|
| 66 |
+
|
| 67 |
+
def assert_dirs_same(self, first, second):
|
| 68 |
+
"""Asserts two dirs are the same."""
|
| 69 |
+
dcmp = filecmp.dircmp(first, second)
|
| 70 |
+
if dcmp.diff_files or dcmp.left_only or dcmp.right_only:
|
| 71 |
+
return False
|
| 72 |
+
|
| 73 |
+
return all(
|
| 74 |
+
self.assert_dirs_same(os.path.join(first, subdir),
|
| 75 |
+
os.path.join(second, subdir))
|
| 76 |
+
for subdir in dcmp.common_dirs)
|
| 77 |
+
|
| 78 |
+
def get_repo_filelist(self, branch):
|
| 79 |
+
"""Get files in repo."""
|
| 80 |
+
return subprocess.check_output([
|
| 81 |
+
'git', '-C', self.git_dir.name, 'ls-tree', '-r', '--name-only', branch
|
| 82 |
+
]).decode().splitlines()
|
| 83 |
+
|
| 84 |
+
def test_upload_download_corpus(self):
|
| 85 |
+
"""Tests uploading and downloading corpus."""
|
| 86 |
+
self.git_store.upload_corpus('target', self.local_dir.name)
|
| 87 |
+
self.git_store.download_corpus('target', self.download_dir.name)
|
| 88 |
+
self.assert_dirs_same(self.local_dir.name, self.download_dir.name)
|
| 89 |
+
|
| 90 |
+
self.assertCountEqual([
|
| 91 |
+
'corpus/target/a',
|
| 92 |
+
'corpus/target/b/c',
|
| 93 |
+
], self.get_repo_filelist('main'))
|
| 94 |
+
|
| 95 |
+
def test_upload_download_coverage(self):
|
| 96 |
+
"""Tests uploading and downloading corpus."""
|
| 97 |
+
self.git_store.upload_coverage('latest', self.local_dir.name)
|
| 98 |
+
self.git_store.download_coverage('latest', self.download_dir.name)
|
| 99 |
+
self.assert_dirs_same(self.local_dir.name, self.download_dir.name)
|
| 100 |
+
|
| 101 |
+
self.assertCountEqual([
|
| 102 |
+
'coverage/latest/a',
|
| 103 |
+
'coverage/latest/b/c',
|
| 104 |
+
], self.get_repo_filelist('cov-branch'))
|
| 105 |
+
|
| 106 |
+
def test_upload_crashes(self):
|
| 107 |
+
"""Tests uploading crashes."""
|
| 108 |
+
self.git_store.upload_crashes('current', self.local_dir.name)
|
| 109 |
+
self.mock_ci_filestore.upload_crashes.assert_called_with(
|
| 110 |
+
'current', self.local_dir.name)
|
| 111 |
+
|
| 112 |
+
def test_upload_build(self):
|
| 113 |
+
"""Tests uploading build."""
|
| 114 |
+
self.git_store.upload_build('sanitizer', self.local_dir.name)
|
| 115 |
+
self.mock_ci_filestore.upload_build.assert_called_with(
|
| 116 |
+
'sanitizer', self.local_dir.name)
|
| 117 |
+
|
| 118 |
+
def test_download_build(self):
|
| 119 |
+
"""Tests downloading build."""
|
| 120 |
+
self.git_store.download_build('sanitizer', self.download_dir.name)
|
| 121 |
+
self.mock_ci_filestore.download_build.assert_called_with(
|
| 122 |
+
'sanitizer', self.download_dir.name)
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/cifuzz/filestore/github_actions/github_actions_test.py
ADDED
|
@@ -0,0 +1,283 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 github_actions."""
|
| 15 |
+
import os
|
| 16 |
+
import shutil
|
| 17 |
+
import sys
|
| 18 |
+
import tarfile
|
| 19 |
+
import tempfile
|
| 20 |
+
import unittest
|
| 21 |
+
from unittest import mock
|
| 22 |
+
|
| 23 |
+
from pyfakefs import fake_filesystem_unittest
|
| 24 |
+
|
| 25 |
+
# pylint: disable=wrong-import-position
|
| 26 |
+
INFRA_DIR = os.path.dirname(
|
| 27 |
+
os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
| 28 |
+
sys.path.append(INFRA_DIR)
|
| 29 |
+
|
| 30 |
+
from filestore import github_actions
|
| 31 |
+
import test_helpers
|
| 32 |
+
|
| 33 |
+
# pylint: disable=protected-access,no-self-use
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
class GithubActionsFilestoreTest(fake_filesystem_unittest.TestCase):
|
| 37 |
+
"""Tests for GithubActionsFilestore."""
|
| 38 |
+
|
| 39 |
+
@mock.patch('platform_config.github._get_event_data', return_value={})
|
| 40 |
+
def setUp(self, _): # pylint: disable=arguments-differ
|
| 41 |
+
test_helpers.patch_environ(self)
|
| 42 |
+
self.token = 'example githubtoken'
|
| 43 |
+
self.owner = 'exampleowner'
|
| 44 |
+
self.repo = 'examplerepo'
|
| 45 |
+
os.environ['GITHUB_REPOSITORY'] = f'{self.owner}/{self.repo}'
|
| 46 |
+
os.environ['GITHUB_EVENT_PATH'] = '/fake'
|
| 47 |
+
os.environ['CFL_PLATFORM'] = 'github'
|
| 48 |
+
os.environ['GITHUB_WORKSPACE'] = '/workspace'
|
| 49 |
+
self.config = test_helpers.create_run_config(token=self.token)
|
| 50 |
+
self.local_dir = '/local-dir'
|
| 51 |
+
self.testcase = os.path.join(self.local_dir, 'testcase')
|
| 52 |
+
|
| 53 |
+
def _get_expected_http_headers(self):
|
| 54 |
+
return {
|
| 55 |
+
'Authorization': f'token {self.token}',
|
| 56 |
+
'Accept': 'application/vnd.github.v3+json',
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
@mock.patch('filestore.github_actions.github_api.list_artifacts')
|
| 60 |
+
def test_list_artifacts(self, mock_list_artifacts):
|
| 61 |
+
"""Tests that _list_artifacts works as intended."""
|
| 62 |
+
filestore = github_actions.GithubActionsFilestore(self.config)
|
| 63 |
+
filestore._list_artifacts()
|
| 64 |
+
mock_list_artifacts.assert_called_with(self.owner, self.repo,
|
| 65 |
+
self._get_expected_http_headers())
|
| 66 |
+
|
| 67 |
+
@mock.patch('logging.warning')
|
| 68 |
+
@mock.patch('filestore.github_actions.GithubActionsFilestore._list_artifacts',
|
| 69 |
+
return_value=None)
|
| 70 |
+
@mock.patch('filestore.github_actions.github_api.find_artifact',
|
| 71 |
+
return_value=None)
|
| 72 |
+
def test_download_build_no_artifact(self, _, __, mock_warning):
|
| 73 |
+
"""Tests that download_build returns None and doesn't exception when
|
| 74 |
+
find_artifact can't find an artifact."""
|
| 75 |
+
filestore = github_actions.GithubActionsFilestore(self.config)
|
| 76 |
+
name = 'name'
|
| 77 |
+
build_dir = 'build-dir'
|
| 78 |
+
self.assertFalse(filestore.download_build(name, build_dir))
|
| 79 |
+
mock_warning.assert_called_with('Could not download artifact: %s.',
|
| 80 |
+
'cifuzz-build-' + name)
|
| 81 |
+
|
| 82 |
+
@mock.patch('logging.warning')
|
| 83 |
+
@mock.patch('filestore.github_actions.GithubActionsFilestore._list_artifacts',
|
| 84 |
+
return_value=None)
|
| 85 |
+
@mock.patch('filestore.github_actions.github_api.find_artifact',
|
| 86 |
+
return_value=None)
|
| 87 |
+
def test_download_corpus_no_artifact(self, _, __, mock_warning):
|
| 88 |
+
"""Tests that download_corpus_build returns None and doesn't exception when
|
| 89 |
+
find_artifact can't find an artifact."""
|
| 90 |
+
filestore = github_actions.GithubActionsFilestore(self.config)
|
| 91 |
+
name = 'name'
|
| 92 |
+
dst_dir = 'local-dir'
|
| 93 |
+
self.assertFalse(filestore.download_corpus(name, dst_dir))
|
| 94 |
+
mock_warning.assert_called_with('Could not download artifact: %s.',
|
| 95 |
+
'cifuzz-corpus-' + name)
|
| 96 |
+
|
| 97 |
+
@mock.patch('filestore.github_actions.tar_directory')
|
| 98 |
+
@mock.patch('filestore.github_actions._upload_artifact_with_upload_js')
|
| 99 |
+
def test_upload_corpus(self, mock_upload_artifact, mock_tar_directory):
|
| 100 |
+
"""Test uploading corpus."""
|
| 101 |
+
self._create_local_dir()
|
| 102 |
+
|
| 103 |
+
def mock_tar_directory_impl(_, archive_path):
|
| 104 |
+
self.fs.create_file(archive_path)
|
| 105 |
+
|
| 106 |
+
mock_tar_directory.side_effect = mock_tar_directory_impl
|
| 107 |
+
|
| 108 |
+
filestore = github_actions.GithubActionsFilestore(self.config)
|
| 109 |
+
filestore.upload_corpus('target', self.local_dir)
|
| 110 |
+
self.assert_upload(mock_upload_artifact, mock_tar_directory,
|
| 111 |
+
'corpus-target')
|
| 112 |
+
|
| 113 |
+
@mock.patch('filestore.github_actions._upload_artifact_with_upload_js')
|
| 114 |
+
def test_upload_crashes(self, mock_upload_artifact):
|
| 115 |
+
"""Test uploading crashes."""
|
| 116 |
+
self._create_local_dir()
|
| 117 |
+
|
| 118 |
+
filestore = github_actions.GithubActionsFilestore(self.config)
|
| 119 |
+
filestore.upload_crashes('current', self.local_dir)
|
| 120 |
+
mock_upload_artifact.assert_has_calls(
|
| 121 |
+
[mock.call('crashes-current', ['/local-dir/testcase'], '/local-dir')])
|
| 122 |
+
|
| 123 |
+
@mock.patch('filestore.github_actions.tar_directory')
|
| 124 |
+
@mock.patch('filestore.github_actions._upload_artifact_with_upload_js')
|
| 125 |
+
def test_upload_build(self, mock_upload_artifact, mock_tar_directory):
|
| 126 |
+
"""Test uploading build."""
|
| 127 |
+
self._create_local_dir()
|
| 128 |
+
|
| 129 |
+
def mock_tar_directory_impl(_, archive_path):
|
| 130 |
+
self.fs.create_file(archive_path)
|
| 131 |
+
|
| 132 |
+
mock_tar_directory.side_effect = mock_tar_directory_impl
|
| 133 |
+
|
| 134 |
+
filestore = github_actions.GithubActionsFilestore(self.config)
|
| 135 |
+
filestore.upload_build('sanitizer', self.local_dir)
|
| 136 |
+
self.assert_upload(mock_upload_artifact, mock_tar_directory,
|
| 137 |
+
'build-sanitizer')
|
| 138 |
+
|
| 139 |
+
@mock.patch('filestore.github_actions.tar_directory')
|
| 140 |
+
@mock.patch('filestore.github_actions._upload_artifact_with_upload_js')
|
| 141 |
+
def test_upload_coverage(self, mock_upload_artifact, mock_tar_directory):
|
| 142 |
+
"""Test uploading coverage."""
|
| 143 |
+
self._create_local_dir()
|
| 144 |
+
|
| 145 |
+
def mock_tar_directory_impl(_, archive_path):
|
| 146 |
+
self.fs.create_file(archive_path)
|
| 147 |
+
|
| 148 |
+
mock_tar_directory.side_effect = mock_tar_directory_impl
|
| 149 |
+
|
| 150 |
+
filestore = github_actions.GithubActionsFilestore(self.config)
|
| 151 |
+
filestore.upload_coverage('latest', self.local_dir)
|
| 152 |
+
self.assert_upload(mock_upload_artifact, mock_tar_directory,
|
| 153 |
+
'coverage-latest')
|
| 154 |
+
|
| 155 |
+
def assert_upload(self, mock_upload_artifact, mock_tar_directory,
|
| 156 |
+
expected_artifact_name):
|
| 157 |
+
"""Tests that upload_directory invokes tar_directory and
|
| 158 |
+
artifact_client.upload_artifact properly."""
|
| 159 |
+
# Don't assert what second argument will be since it's a temporary
|
| 160 |
+
# directory.
|
| 161 |
+
self.assertEqual(mock_tar_directory.call_args_list[0][0][0], self.local_dir)
|
| 162 |
+
|
| 163 |
+
# Don't assert what second and third arguments will be since they are
|
| 164 |
+
# temporary directories.
|
| 165 |
+
expected_artifact_name = 'cifuzz-' + expected_artifact_name
|
| 166 |
+
self.assertEqual(mock_upload_artifact.call_args_list[0][0][0],
|
| 167 |
+
expected_artifact_name)
|
| 168 |
+
|
| 169 |
+
# Assert artifacts list contains one tarfile.
|
| 170 |
+
artifacts_list = mock_upload_artifact.call_args_list[0][0][1]
|
| 171 |
+
self.assertEqual(len(artifacts_list), 1)
|
| 172 |
+
self.assertEqual(os.path.basename(artifacts_list[0]),
|
| 173 |
+
expected_artifact_name + '.tar')
|
| 174 |
+
|
| 175 |
+
def _create_local_dir(self):
|
| 176 |
+
"""Sets up pyfakefs and creates a corpus directory containing
|
| 177 |
+
self.testcase."""
|
| 178 |
+
self.setUpPyfakefs()
|
| 179 |
+
self.fs.create_file(self.testcase, contents='hi')
|
| 180 |
+
|
| 181 |
+
@mock.patch('filestore.github_actions.GithubActionsFilestore._find_artifact')
|
| 182 |
+
@mock.patch('http_utils.download_and_unpack_zip')
|
| 183 |
+
def test_download_artifact(self, mock_download_and_unpack_zip,
|
| 184 |
+
mock_find_artifact):
|
| 185 |
+
"""Tests that _download_artifact works as intended."""
|
| 186 |
+
artifact_download_url = 'http://example.com/download'
|
| 187 |
+
artifact_listing = {
|
| 188 |
+
'expired': False,
|
| 189 |
+
'name': 'corpus',
|
| 190 |
+
'archive_download_url': artifact_download_url
|
| 191 |
+
}
|
| 192 |
+
mock_find_artifact.return_value = artifact_listing
|
| 193 |
+
|
| 194 |
+
self._create_local_dir()
|
| 195 |
+
with tempfile.TemporaryDirectory() as temp_dir:
|
| 196 |
+
# Create a tarball.
|
| 197 |
+
archive_path = os.path.join(temp_dir, 'cifuzz-corpus.tar')
|
| 198 |
+
github_actions.tar_directory(self.local_dir, archive_path)
|
| 199 |
+
|
| 200 |
+
artifact_download_dst_dir = os.path.join(temp_dir, 'dst')
|
| 201 |
+
os.mkdir(artifact_download_dst_dir)
|
| 202 |
+
|
| 203 |
+
def mock_download_and_unpack_zip_impl(url, download_artifact_temp_dir,
|
| 204 |
+
headers):
|
| 205 |
+
self.assertEqual(url, artifact_download_url)
|
| 206 |
+
self.assertEqual(headers, self._get_expected_http_headers())
|
| 207 |
+
shutil.copy(
|
| 208 |
+
archive_path,
|
| 209 |
+
os.path.join(download_artifact_temp_dir,
|
| 210 |
+
os.path.basename(archive_path)))
|
| 211 |
+
return True
|
| 212 |
+
|
| 213 |
+
mock_download_and_unpack_zip.side_effect = (
|
| 214 |
+
mock_download_and_unpack_zip_impl)
|
| 215 |
+
filestore = github_actions.GithubActionsFilestore(self.config)
|
| 216 |
+
self.assertTrue(
|
| 217 |
+
filestore._download_artifact('corpus', artifact_download_dst_dir))
|
| 218 |
+
mock_find_artifact.assert_called_with('cifuzz-corpus')
|
| 219 |
+
self.assertTrue(
|
| 220 |
+
os.path.exists(
|
| 221 |
+
os.path.join(artifact_download_dst_dir,
|
| 222 |
+
os.path.basename(self.testcase))))
|
| 223 |
+
|
| 224 |
+
@mock.patch('filestore.github_actions.github_api.list_artifacts')
|
| 225 |
+
def test_find_artifact(self, mock_list_artifacts):
|
| 226 |
+
"""Tests that _find_artifact works as intended."""
|
| 227 |
+
artifact_listing_1 = {
|
| 228 |
+
'expired': False,
|
| 229 |
+
'name': 'other',
|
| 230 |
+
'archive_download_url': 'http://download1'
|
| 231 |
+
}
|
| 232 |
+
artifact_listing_2 = {
|
| 233 |
+
'expired': False,
|
| 234 |
+
'name': 'artifact',
|
| 235 |
+
'archive_download_url': 'http://download2'
|
| 236 |
+
}
|
| 237 |
+
artifact_listing_3 = {
|
| 238 |
+
'expired': True,
|
| 239 |
+
'name': 'artifact',
|
| 240 |
+
'archive_download_url': 'http://download3'
|
| 241 |
+
}
|
| 242 |
+
artifact_listing_4 = {
|
| 243 |
+
'expired': False,
|
| 244 |
+
'name': 'artifact',
|
| 245 |
+
'archive_download_url': 'http://download4'
|
| 246 |
+
}
|
| 247 |
+
artifacts = [
|
| 248 |
+
artifact_listing_1, artifact_listing_2, artifact_listing_3,
|
| 249 |
+
artifact_listing_4
|
| 250 |
+
]
|
| 251 |
+
mock_list_artifacts.return_value = artifacts
|
| 252 |
+
filestore = github_actions.GithubActionsFilestore(self.config)
|
| 253 |
+
# Test that find_artifact will return the most recent unexpired artifact
|
| 254 |
+
# with the correct name.
|
| 255 |
+
self.assertEqual(filestore._find_artifact('artifact'), artifact_listing_2)
|
| 256 |
+
mock_list_artifacts.assert_called_with(self.owner, self.repo,
|
| 257 |
+
self._get_expected_http_headers())
|
| 258 |
+
|
| 259 |
+
|
| 260 |
+
class TarDirectoryTest(unittest.TestCase):
|
| 261 |
+
"""Tests for tar_directory."""
|
| 262 |
+
|
| 263 |
+
def test_tar_directory(self):
|
| 264 |
+
"""Tests that tar_directory writes the archive to the correct location and
|
| 265 |
+
archives properly."""
|
| 266 |
+
with tempfile.TemporaryDirectory() as temp_dir:
|
| 267 |
+
archive_path = os.path.join(temp_dir, 'myarchive.tar')
|
| 268 |
+
archived_dir = os.path.join(temp_dir, 'toarchive')
|
| 269 |
+
os.mkdir(archived_dir)
|
| 270 |
+
archived_filename = 'file1'
|
| 271 |
+
archived_file_path = os.path.join(archived_dir, archived_filename)
|
| 272 |
+
with open(archived_file_path, 'w') as file_handle:
|
| 273 |
+
file_handle.write('hi')
|
| 274 |
+
github_actions.tar_directory(archived_dir, archive_path)
|
| 275 |
+
self.assertTrue(os.path.exists(archive_path))
|
| 276 |
+
|
| 277 |
+
# Now check it archives correctly.
|
| 278 |
+
unpacked_directory = os.path.join(temp_dir, 'unpacked')
|
| 279 |
+
with tarfile.TarFile(archive_path) as artifact_tarfile:
|
| 280 |
+
artifact_tarfile.extractall(unpacked_directory)
|
| 281 |
+
unpacked_archived_file_path = os.path.join(unpacked_directory,
|
| 282 |
+
archived_filename)
|
| 283 |
+
self.assertTrue(os.path.exists(unpacked_archived_file_path))
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/cifuzz/test_data/external-project/.clusterfuzzlite/Dockerfile
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
|
| 17 |
+
FROM ghcr.io/aixcc-finals/base-builder
|
| 18 |
+
RUN apt-get update && apt-get install -y make
|
| 19 |
+
|
| 20 |
+
COPY . $SRC/external-project
|
| 21 |
+
WORKDIR $SRC/external-project
|
| 22 |
+
COPY .clusterfuzzlite/build.sh $SRC/
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/cifuzz/test_data/external-project/Makefile
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2017 Google Inc. All Rights Reserved.
|
| 2 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 3 |
+
|
| 4 |
+
# Simple example of a build file that nicely integrates a fuzz target
|
| 5 |
+
# with the rest of the project.
|
| 6 |
+
#
|
| 7 |
+
# We use 'make' as the build system, but these ideas are applicable
|
| 8 |
+
# to any other build system
|
| 9 |
+
|
| 10 |
+
# By default, use our own standalone_fuzz_target_runner.
|
| 11 |
+
# This runner does no fuzzing, but simply executes the inputs
|
| 12 |
+
# provided via parameters.
|
| 13 |
+
# Run e.g. "make all LIB_FUZZING_ENGINE=/path/to/libFuzzer.a"
|
| 14 |
+
# to link the fuzzer(s) against a real fuzzing engine.
|
| 15 |
+
#
|
| 16 |
+
# OSS-Fuzz will define its own value for LIB_FUZZING_ENGINE.
|
| 17 |
+
LIB_FUZZING_ENGINE ?= standalone_fuzz_target_runner.o
|
| 18 |
+
|
| 19 |
+
# Values for CC, CFLAGS, CXX, CXXFLAGS are provided by OSS-Fuzz.
|
| 20 |
+
# Outside of OSS-Fuzz use the ones you prefer or rely on the default values.
|
| 21 |
+
# Do not use the -fsanitize=* flags by default.
|
| 22 |
+
# OSS-Fuzz will use different -fsanitize=* flags for different builds (asan, ubsan, msan, ...)
|
| 23 |
+
|
| 24 |
+
# You may add extra compiler flags like this:
|
| 25 |
+
CXXFLAGS += -std=c++11
|
| 26 |
+
|
| 27 |
+
all: do_stuff_fuzzer
|
| 28 |
+
|
| 29 |
+
clean:
|
| 30 |
+
rm -fv *.a *.o *_fuzzer crash-* *.zip
|
| 31 |
+
|
| 32 |
+
# Fuzz target, links against $LIB_FUZZING_ENGINE, so that
|
| 33 |
+
# you may choose which fuzzing engine to use.
|
| 34 |
+
do_stuff_fuzzer: do_stuff_fuzzer.cpp my_api.a standalone_fuzz_target_runner.o
|
| 35 |
+
${CXX} ${CXXFLAGS} $< my_api.a ${LIB_FUZZING_ENGINE} -o $@
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
# The library itself.
|
| 39 |
+
my_api.a: my_api.cpp my_api.h
|
| 40 |
+
${CXX} ${CXXFLAGS} $< -c
|
| 41 |
+
ar ruv my_api.a my_api.o
|
| 42 |
+
|
| 43 |
+
# The standalone fuzz target runner.
|
| 44 |
+
standalone_fuzz_target_runner.o: standalone_fuzz_target_runner.cpp
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/cifuzz/test_data/external-project/do_stuff_fuzzer.cpp
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
#include "my_api.h"
|
| 15 |
+
|
| 16 |
+
#include <string>
|
| 17 |
+
|
| 18 |
+
// Simple fuzz target for DoStuff().
|
| 19 |
+
// See https://llvm.org/docs/LibFuzzer.html for details.
|
| 20 |
+
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
| 21 |
+
std::string str(reinterpret_cast<const char *>(data), size);
|
| 22 |
+
DoStuff(str); // Disregard the output.
|
| 23 |
+
return 0;
|
| 24 |
+
}
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/cifuzz/test_data/external-project/my_api.cpp
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
// Implementation of "my_api".
|
| 16 |
+
#include "my_api.h"
|
| 17 |
+
|
| 18 |
+
#include <vector>
|
| 19 |
+
|
| 20 |
+
// Do some computations with 'str', return the result.
|
| 21 |
+
// This function contains a bug. Can you spot it?
|
| 22 |
+
size_t DoStuff(const std::string &str) {
|
| 23 |
+
std::vector<int> Vec({0, 1, 2, 3, 4});
|
| 24 |
+
size_t Idx = 0;
|
| 25 |
+
if (str.size() > 5)
|
| 26 |
+
Idx++;
|
| 27 |
+
if (str.find("foo") != std::string::npos)
|
| 28 |
+
Idx++;
|
| 29 |
+
if (str.find("bar") != std::string::npos)
|
| 30 |
+
Idx++;
|
| 31 |
+
if (str.find("ouch") != std::string::npos)
|
| 32 |
+
Idx++;
|
| 33 |
+
if (str.find("omg") != std::string::npos)
|
| 34 |
+
Idx++;
|
| 35 |
+
return Vec[Idx];
|
| 36 |
+
}
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/cifuzz/test_data/external-project/my_api.h
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
// A library that does ... stuff.
|
| 16 |
+
// Serves as an example of good fuzz testing and OSS-Fuzz integration.
|
| 17 |
+
#include <string>
|
| 18 |
+
|
| 19 |
+
size_t DoStuff(const std::string &str);
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/tools/wycheproof/.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
wycheproof.zip
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/tools/wycheproof/generate_job.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# Copyright 2022 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 |
+
"""Script for generating an OSS-Fuzz job for a wycheproof project."""
|
| 18 |
+
import sys
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def main():
|
| 22 |
+
"""Usage generate_job.py <project>."""
|
| 23 |
+
project = sys.argv[1]
|
| 24 |
+
print(f'Name: wycheproof_nosanitizer_{project}')
|
| 25 |
+
job_definition = f"""CUSTOM_BINARY = False
|
| 26 |
+
BAD_BUILD_CHECK = False
|
| 27 |
+
APP_NAME = WycheproofTarget.bash
|
| 28 |
+
THREAD_ALIVE_CHECK_INTERVAL = 10
|
| 29 |
+
TEST_TIMEOUT = 3600
|
| 30 |
+
CRASH_RETRIES = 1
|
| 31 |
+
AGGREGATE_COVERAGE = False
|
| 32 |
+
TESTCASE_COVERAGE = False
|
| 33 |
+
FILE_GITHUB_ISSUE = False
|
| 34 |
+
MANAGED = False
|
| 35 |
+
MAX_FUZZ_THREADS = 1
|
| 36 |
+
RELEASE_BUILD_BUCKET_PATH = gs://clusterfuzz-builds-wycheproof/{project}/{project}-none-([0-9]+).zip
|
| 37 |
+
PROJECT_NAME = {project}
|
| 38 |
+
SUMMARY_PREFIX = {project}
|
| 39 |
+
REVISION_VARS_URL = https://commondatastorage.googleapis.com/clusterfuzz-builds-wycheproof/{project}/{project}-none-%s.srcmap.json
|
| 40 |
+
FUZZ_LOGS_BUCKET = {project}-logs.clusterfuzz-external.appspot.com
|
| 41 |
+
CORPUS_BUCKET = {project}-corpus.clusterfuzz-external.appspot.com
|
| 42 |
+
QUARANTINE_BUCKET = {project}-quarantine.clusterfuzz-external.appspot.com
|
| 43 |
+
BACKUP_BUCKET = {project}-backup.clusterfuzz-external.appspot.com
|
| 44 |
+
AUTOMATIC_LABELS = Proj-{project},Engine-wycheproof
|
| 45 |
+
"""
|
| 46 |
+
print(job_definition)
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
if __name__ == '__main__':
|
| 50 |
+
main()
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/tools/wycheproof/launcher.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python
|
| 2 |
+
# Copyright 2022 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 |
+
"""Script for running wycheproof."""
|
| 18 |
+
|
| 19 |
+
import logging
|
| 20 |
+
import sys
|
| 21 |
+
import subprocess
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def main():
|
| 25 |
+
"""Runs wycheproof."""
|
| 26 |
+
if len(sys.argv) < 3:
|
| 27 |
+
logging.error('Usage: %s <test_app> <testcase>.', sys.argv[0])
|
| 28 |
+
return 1
|
| 29 |
+
|
| 30 |
+
return subprocess.run(sys.argv[1:], check=False).returncode
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
if __name__ == '__main__':
|
| 34 |
+
sys.exit(main())
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/tools/wycheproof/package.bash
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
# Copyright 2022 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 |
+
# Script for zipping ClusterFuzz's blackbox fuzzer for wycheproof.
|
| 18 |
+
zip wycheproof.zip run.py launcher.py
|
local-test-commons-compress-full-01-vuln_1/fuzz-tooling/infra/tools/wycheproof/run.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
# Copyright 2022 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 |
+
"""Script for creating "testcases" to run wycheproof on."""
|
| 18 |
+
|
| 19 |
+
import argparse
|
| 20 |
+
import os
|
| 21 |
+
import sys
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def get_args():
|
| 25 |
+
"""Returns parsed program arguments."""
|
| 26 |
+
parser = argparse.ArgumentParser()
|
| 27 |
+
parser.add_argument(
|
| 28 |
+
'--input_dir',
|
| 29 |
+
help='Ignored.',
|
| 30 |
+
)
|
| 31 |
+
parser.add_argument('--output_dir',
|
| 32 |
+
help='Directory for writing testcases.',
|
| 33 |
+
required=True)
|
| 34 |
+
parser.add_argument('--no_of_files', type=int, help='Ignored.')
|
| 35 |
+
return parser.parse_args()
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def main():
|
| 39 |
+
"""Generates a dummy testcase for use by a ClusterFuzz blackbox fuzzer."""
|
| 40 |
+
args = get_args()
|
| 41 |
+
if not os.path.exists(args.output_dir):
|
| 42 |
+
os.mkdir(args.output_dir)
|
| 43 |
+
testcase = os.path.join(args.output_dir, 'fuzz-0')
|
| 44 |
+
with open(testcase, 'w') as file_handle:
|
| 45 |
+
file_handle.write(' ')
|
| 46 |
+
return 0
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
if __name__ == '__main__':
|
| 50 |
+
sys.exit(main())
|