@marcel91200 / caddy Mirror · read-only / commits / 6c533558
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 14, 05:15 UTC

fuzz-ci: fix & enhance fuzzing process (#2835)

* fuzz-ci: fix the authentication call for fuzzit by using the --api-key flag rather than the `auth` command * Allow fuzzing on schedules as well as non-fork PRs Closes #2710

Mohammed Al Sahaf committed Oct 28, 2019 at 20:45 UTC 6c533558a3db4b30a6b7a81d19ac180fe2000ca2
1 file changed +15 -15
azure-pipelines.yml
+15 -15
@@ -157,9 +157,9 @@ jobs:
157 displayName: Coerce correct build result
158
159 - job: fuzzing
160 - displayName: 'Scheduled Fuzzing'
161 - # Only run this job on schedules, not PRs.
162 - condition: eq(variables['Build.Reason'], 'Schedule')
160 + displayName: 'Fuzzing'
161 + # Only run this job on schedules or PRs for non-forks.
162 + condition: or(eq(variables['System.PullRequest.IsFork'], 'False'), eq(variables['Build.Reason'], 'Schedule') )
163 strategy:
164 matrix:
165 linux:
@@ -192,10 +192,10 @@ jobs:
192 displayName: Install Go on Linux
193
194 - bash: |
195 - # Install Clang
196 - sudo add-apt-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main"
195 + # Install Clang-7.0 because other versions seem to be missing the file libclang_rt.fuzzer-x86_64.a
196 + sudo add-apt-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main"
197 wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
198 - sudo apt update && sudo apt install -y clang lldb lld
198 + sudo apt update && sudo apt install -y clang-7 lldb-7 lld-7
199
200 go get -v github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-build
201 wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.74/fuzzit_Linux_x86_64
@@ -204,12 +204,6 @@ jobs:
204 displayName: Download go-fuzz tools and the Fuzzit CLI, and move Fuzzit CLI to GOBIN
205 condition: and(eq(variables['System.PullRequest.IsFork'], 'False') , eq( variables['Agent.OS'], 'Linux' ))
206
207 - - script: fuzzit auth ${FUZZIT_API_KEY}
208 - condition: and(eq(variables['System.PullRequest.IsFork'], 'False') , eq( variables['Agent.OS'], 'Linux' ))
209 - displayName: Authenticate with Fuzzit
210 - env:
211 - FUZZIT_API_KEY: $(FUZZIT_API_KEY)
212 -
207 - bash: |
208 declare -A fuzzers_funcs=(\
209 ["./admin_fuzz.go"]="FuzzAdmin" \
@@ -228,16 +222,22 @@ jobs:
222 ["./listeners_fuzz.go"]="parse-listen-addr" \
223 ["./replacer_fuzz.go"]="replacer" \
224 )
231 - fuzz_type="fuzzing"
225 +
226 + fuzz_type="regression"
227 + if [[ $(Build.Reason) == "Schedule" ]]; then
228 + fuzz_type="fuzzing"
229 + fi
230
231 for f in $(find . -name \*_fuzz.go); do
232 FUZZER_DIRECTORY=$(dirname $f)
233 echo "go-fuzz-build func ${fuzzers_funcs[$f]} residing in $f"
234 go-fuzz-build -func "${fuzzers_funcs[$f]}" -libfuzzer -o "$FUZZER_DIRECTORY/${fuzzers_targets[$f]}.a" $FUZZER_DIRECTORY
235 echo "Generating fuzzer binary of func ${fuzzers_funcs[$f]} which resides in $f"
238 - clang -fsanitize=fuzzer "$FUZZER_DIRECTORY/${fuzzers_targets[$f]}.a" -o "$FUZZER_DIRECTORY/${fuzzers_targets[$f]}.fuzzer"
239 - fuzzit create job --type "${fuzz_type}" --branch "${SYSTEM_PULLREQUEST_SOURCEBRANCH}" --revision "${BUILD_SOURCEVERSION}" caddyserver/${fuzzers_targets[$f]} $FUZZER_DIRECTORY/${fuzzers_targets[$f]}.fuzzer
236 + clang-7 -fsanitize=fuzzer "$FUZZER_DIRECTORY/${fuzzers_targets[$f]}.a" -o "$FUZZER_DIRECTORY/${fuzzers_targets[$f]}"
237 + fuzzit create job caddyserver/${fuzzers_targets[$f]} $FUZZER_DIRECTORY/${fuzzers_targets[$f]} --api-key ${FUZZIT_API_KEY} --type "${fuzz_type}" --branch "${SYSTEM_PULLREQUEST_SOURCEBRANCH}" --revision "${BUILD_SOURCEVERSION}"
238 echo "Completed $f"
239 done
240 + env:
241 + FUZZIT_API_KEY: $(FUZZIT_API_KEY)
242 workingDirectory: '$(modulePath)'
243 displayName: Generate fuzzers & submit them to Fuzzit