Skip to content

Commit

Permalink
fuzz: add Fuzzit badge to README & enable fuzzers submission in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammed90 committed Sep 3, 2019
1 parent b9b4585 commit c234ac1
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 14 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Caddy 2 Development Branch
===========================

[![fuzzit](https://app.fuzzit.dev/badge?org_id=caddyserver)](https://app.fuzzit.dev/orgs/caddyserver/dashboard)

This is the development branch for Caddy 2. This code (version 2) is not yet feature-complete or production-ready, but is already being used in production, and we encourage you to deploy it today on sites that are not very visible or important so that it can obtain crucial experience in the field.

Please file issues to propose new features and report bugs, and after the bug or feature has been discussed, submit a pull request! We need your help to build this web server into what you want it to be. (Caddy 2 issues and pull requests will usually receive priority over Caddy 1 issues and pull requests.)
Expand Down
46 changes: 32 additions & 14 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,16 @@ steps:

- script: |
go get -v -t -d ./...
# temporary disable golangci-lint
#golangci-lint run -E gofmt -E goimports -E misspell
golangci-lint run -E gofmt -E goimports -E misspell
go test -race ./...
workingDirectory: '$(modulePath)'
displayName: Run tests

- bash: |
# Install Clang-9
sudo add-apt-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main"
# Install Clang
sudo add-apt-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main"
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt update && sudo apt install -y clang-9 lldb-9 lld-9
sudo apt update && sudo apt install -y clang lldb lld
go get -v github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-build
wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.24/fuzzit_Linux_x86_64
Expand All @@ -101,13 +100,32 @@ steps:
displayName: Download go-fuzz tools and the Fuzzit CLI, and move Fuzzit CLI to GOBIN
condition: eq( variables['Agent.OS'], 'Linux' )

# Uncomment once configuration is validated
# - script: fuzzit auth $FUZZIT_API_KEY
# condition: eq( variables['Agent.OS'], 'Linux' )
# env:
# FUZZIT_API_KEY: $(FUZZIT_API_KEY)
- script: fuzzit auth ${FUZZIT_API_KEY}
condition: eq( variables['Agent.OS'], 'Linux' )
displayName: Authenticate with Fuzzit
env:
FUZZIT_API_KEY: $(FUZZIT_API_KEY)

- bash: |
declare -A fuzzers_funcs=(\
["admin_fuzz.go"]="FuzzAdmin" \
["caddyfileAdapter_fuzz.go"]="FuzzCaddyfileAdapter" \
["parseAddress_fuzz.go"]="FuzzParseAddress" \
["parseCaddyfile_fuzz.go"]="FuzzParseCaddyfile" \
["parseListenAddr_fuzz.go"]="FuzzParseListenAddr" \
["replacer_fuzz.go"]="FuzzReplacer" \
)
declare -A fuzzers_targets=(\
["admin_fuzz.go"]="admin" \
["caddyfileAdapter_fuzz.go"]="caddyfile-adapter" \
["parseAddress_fuzz.go"]="parse-address" \
["parseCaddyfile_fuzz.go"]="parse-caddyfile" \
["parseListenAddr_fuzz.go"]="parse-listen-addr" \
["replacer_fuzz.go"]="replacer" \
)
go mod vendor
rm -rf gopath
mkdir -p gopath/src/
Expand All @@ -116,10 +134,10 @@ steps:
export GOPATH=$PWD/gopath
export GO111MODULES=off
for f in $(find . -maxdepth 1 -name \*_fuzz.go); do
FUZZ_FILENAME_PREFIX=$(echo $f | awk -F '/' '{printf $NF}' - | awk -F '_' '{printf $1}' -)
go-fuzz-build -func "Fuzz${FUZZ_FILENAME_PREFIX[@]^}" -libfuzzer -o "${FUZZ_FILENAME_PREFIX}_fuzz.a" .
clang-9 -fsanitize=fuzzer "${FUZZ_FILENAME_PREFIX}_fuzz.a" -o "${FUZZ_FILENAME_PREFIX}.fuzzer"
#fuzzit create job --type 'regression' --branch "PR-${System.PullRequest.PullRequestNumber}" caddyserver/$FUZZ_FILENAME_PREFIX ${FUZZ_FILENAME_PREFIX}.fuzzer
FUZZ_FILENAME=$(echo $f | awk -F '/' '{printf $NF}' -)
go-fuzz-build -func "${fuzzers_funcs[$FUZZ_FILENAME]}" -libfuzzer -o "${fuzzers_targets[$FUZZ_FILENAME]}.a" .
clang -fsanitize=fuzzer "${fuzzers_targets[$FUZZ_FILENAME]}.a" -o "${fuzzers_targets[$FUZZ_FILENAME]}.fuzzer"
#fuzzit create job --type 'regression' --branch "PR-${SYSTEM_PULLREQUEST_PULLREQUESTNUMBER}" --revision "${BUILD_SOURCEVERSION}" caddyserver/${fuzzers_targets[$FUZZ_FILENAME]} ${fuzzers_targets[$FUZZ_FILENAME]}.fuzzer
done
rm -rf gopath/ *.a *.fuzzer
workingDirectory: '$(modulePath)/fuzz'
Expand Down

0 comments on commit c234ac1

Please sign in to comment.