Skip to content

Commit

Permalink
[opencensus-go] initial integration (#10222)
Browse files Browse the repository at this point in the history
Signed-off-by: AdamKorcz <[email protected]>
  • Loading branch information
AdamKorcz authored May 3, 2023
1 parent ea219e5 commit fc633ab
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 0 deletions.
20 changes: 20 additions & 0 deletions projects/opencensus-go/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2023 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/census-instrumentation/opencensus-go
COPY build.sh fuzz_test.go $SRC/
WORKDIR $SRC/opencensus-go
21 changes: 21 additions & 0 deletions projects/opencensus-go/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#/bin/bash -eu
# Copyright 2023 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.
#
################################################################################

cp $SRC/fuzz_test.go ./plugin/ochttp/propagation/b3/
go mod tidy
go get github.com/AdamKorcz/go-118-fuzz-build/testing
compile_native_go_fuzzer go.opencensus.io/plugin/ochttp/propagation/b3 FuzzParseTraceID FuzzParseTraceID
26 changes: 26 additions & 0 deletions projects/opencensus-go/fuzz_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2023 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.
//

package b3

import (
"testing"
)

func FuzzParseTraceID(f *testing.F) {
f.Fuzz(func(t *testing.T, tid string) {
_, _ = ParseTraceID(tid)
})
}
9 changes: 9 additions & 0 deletions projects/opencensus-go/project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
homepage: "https://github.com/census-instrumentation/opencensus-go"
main_repo: "https://github.com/census-instrumentation/opencensus-go"
auto_ccs :
- "[email protected]"
language: go
fuzzing_engines:
- libfuzzer
sanitizers:
- address

0 comments on commit fc633ab

Please sign in to comment.