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
Add missing fuzzer (#2844)
* fuzz: add missing fuzzer by fixing .gitignore adding a negation for caddyfile/ directory * ci: print fuzzing type for debuggability and traceability * README: update the Fuzzit badge to point to the correct Caddy server Github organization
Mohammed Al Sahaf committed
Oct 30, 2019 at 23:57 UTC
4611537f06da0fe77214e4b2c3b4a3330ace0506
4 files changed
+39
-1
.gitignore
+1
@@ -1,6 +1,7 @@
1
_gitignore/
2
*.log
3
Caddyfile
4
+!caddyfile/
5
6
# artifacts from pprof tooling
7
*.prof
README.md
+1
-1
@@ -2,7 +2,7 @@ Caddy 2 Development Branch
2
===========================
3
4
[](https://dev.azure.com/mholt-dev/Caddy/_build/latest?definitionId=5&branchName=v2)
5
-[](https://app.fuzzit.dev/orgs/caddyserver/dashboard)
5
+[](https://app.fuzzit.dev/orgs/caddyserver-gh/dashboard)
6
7
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.
8
azure-pipelines.yml
+1
@@ -226,6 +226,7 @@ jobs:
226
if [[ $(Build.Reason) == "Schedule" ]]; then
227
fuzz_type="fuzzing"
228
fi
229
+ echo "Fuzzing type: $fuzz_type"
230
231
for f in $(find . -name \*_fuzz.go); do
232
FUZZER_DIRECTORY=$(dirname $f)
caddyconfig/caddyfile/parse_fuzz.go
new
+36
@@ -0,0 +1,36 @@
1
+// Copyright 2015 Matthew Holt and The Caddy Authors
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
+// +build gofuzz
16
+// +build gofuzz_libfuzzer
17
+
18
+package caddyfile
19
+
20
+import (
21
+ "bytes"
22
+)
23
+
24
+func FuzzParseCaddyfile(data []byte) (score int) {
25
+ sb, err := Parse("Caddyfile", bytes.NewReader(data))
26
+ if err != nil {
27
+ // if both an error is received and some ServerBlocks,
28
+ // then the parse was able to parse partially. Mark this
29
+ // result as interesting to push the fuzzer further through the parser.
30
+ if sb != nil && len(sb) > 0 {
31
+ return 1
32
+ }
33
+ return 0
34
+ }
35
+ return 1
36
+}