Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fuzzing: Initial commit #434

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions fuzz/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM golang:1.16-buster as builder

RUN apt-get update && apt-get install -y git vim clang
RUN git clone https://github.com/fluxcd/kustomize-controller /kustomize-controller

WORKDIR /kustomize-controller

# fillippo.io/age v1.0.0-beta7 throws an error
RUN sed 's/filippo.io\/age v1.0.0-beta7/filippo.io\/age v1.0.0/g' -i /kustomize-controller/go.mod
RUN make download-crd-deps
RUN mkdir /kustomize-controller/fuzz
COPY fuzz.go /kustomize-controller/controllers/

RUN go mod tidy

RUN cd / \
&& go get -u github.com/dvyukov/go-fuzz/go-fuzz@latest github.com/dvyukov/go-fuzz/go-fuzz-build@latest
RUN go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
RUN go get github.com/AdaLogics/go-fuzz-headers
RUN go mod download golang.org/x/sync
RUN go mod download github.com/dvyukov/go-fuzz

RUN mkdir /fuzzers
RUN cd /kustomize-controller/controllers \
&& go-fuzz-build -libfuzzer -func=Fuzz \
&& clang -o /fuzzers/Fuzz reflect-fuzz.a \
-fsanitize=fuzzer

RUN cd /kustomize-controller/controllers && /fuzzers/Fuzz
Loading