diff options
author | 2021-11-23 15:44:11 +0000 | |
---|---|---|
committer | 2021-11-23 10:44:11 -0500 | |
commit | 50064f5536f8680180ef74bb3f2749bf37ae0c56 (patch) | |
tree | 9a1aa24d02f662290498fe61a28938425dd15f77 | |
parent | 299221cad35435c5fa62451d9ed8502b6311501d (diff) |
[linkerd2] Initial integration (#6864)
-rw-r--r-- | projects/linkerd2/Dockerfile | 20 | ||||
-rw-r--r-- | projects/linkerd2/build.sh | 24 | ||||
-rw-r--r-- | projects/linkerd2/fuzzers.go | 49 | ||||
-rw-r--r-- | projects/linkerd2/project.yaml | 13 |
4 files changed, 106 insertions, 0 deletions
diff --git a/projects/linkerd2/Dockerfile b/projects/linkerd2/Dockerfile new file mode 100644 index 00000000..a6cf8501 --- /dev/null +++ b/projects/linkerd2/Dockerfile @@ -0,0 +1,20 @@ +# Copyright 2021 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +FROM gcr.io/oss-fuzz-base/base-builder-go +RUN git clone --depth 1 https://github.com/linkerd/linkerd2 +COPY build.sh fuzzers.go $SRC/ +WORKDIR $SRC/linkerd2 diff --git a/projects/linkerd2/build.sh b/projects/linkerd2/build.sh new file mode 100644 index 00000000..160c0d3c --- /dev/null +++ b/projects/linkerd2/build.sh @@ -0,0 +1,24 @@ +#!/bin/bash -eu +# Copyright 2020 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +mkdir $SRC/linkerd2/test/fuzzing + +mv $SRC/fuzzers.go $SRC/linkerd2/test/fuzzing/ + +compile_go_fuzzer github.com/linkerd/linkerd2/test/fuzzing FuzzParseContainerOpaquePorts FuzzParseContainerOpaquePorts +compile_go_fuzzer github.com/linkerd/linkerd2/test/fuzzing FuzzParsePorts FuzzParsePorts +compile_go_fuzzer github.com/linkerd/linkerd2/test/fuzzing FuzzHealthCheck FuzzHealthCheck diff --git a/projects/linkerd2/fuzzers.go b/projects/linkerd2/fuzzers.go new file mode 100644 index 00000000..63dc616e --- /dev/null +++ b/projects/linkerd2/fuzzers.go @@ -0,0 +1,49 @@ +package fuzzing + +import ( + fuzz "github.com/AdaLogics/go-fuzz-headers" + "github.com/linkerd/linkerd2/pkg/healthcheck" + "github.com/linkerd/linkerd2/pkg/util" + corev1 "k8s.io/api/core/v1" +) + +func FuzzParsePorts(data []byte) int { + _, _ = util.ParsePorts(string(data)) + return 1 +} + +func FuzzParseContainerOpaquePorts(data []byte) int { + f := fuzz.NewConsumer(data) + + qtyOfContainers, err := f.GetInt() + if err != nil { + return 0 + } + + containers := make([]corev1.Container, 0) + for i := 0; i < qtyOfContainers%20; i++ { + newContainer := corev1.Container{} + err = f.GenerateStruct(&newContainer) + if err != nil { + return 0 + } + containers = append(containers, newContainer) + } + override, err := f.GetString() + if err != nil { + return 0 + } + _ = util.ParseContainerOpaquePorts(override, containers) + return 1 +} + +func FuzzHealthCheck(data []byte) int { + f := fuzz.NewConsumer(data) + options := &healthcheck.Options{} + err := f.GenerateStruct(options) + if err != nil { + return 0 + } + _ = healthcheck.NewHealthChecker([]healthcheck.CategoryID{healthcheck.KubernetesAPIChecks}, options) + return 1 +} diff --git a/projects/linkerd2/project.yaml b/projects/linkerd2/project.yaml new file mode 100644 index 00000000..83cbcc56 --- /dev/null +++ b/projects/linkerd2/project.yaml @@ -0,0 +1,13 @@ +homepage: "https://linkerd.io/" +main_repo: "https://github.com/linkerd/linkerd2" +primary_contact: "ver@buoyant.io" +auto_ccs : + - "adam@adalogics.com" + - "david@adalogics.com" + - "eliza@buoyant.io" + - "kevinl@buoyant.io" +language: go +fuzzing_engines: + - libfuzzer +sanitizers: + - address |