diff --git a/pkg/types/helm/fuzz_test.go b/pkg/types/helm/fuzz_test.go new file mode 100644 index 000000000..67f254b66 --- /dev/null +++ b/pkg/types/helm/fuzz_test.go @@ -0,0 +1,35 @@ +// +// Copyright 2022 The Sigstore Authors. +// +// 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 helm + +import ( + "context" + "testing" + + fuzz "github.com/AdaLogics/go-fuzz-headers" + + "github.com/sigstore/rekor/pkg/types" +) + +func FuzzHelmCreateProposedEntry(f *testing.F) { + f.Fuzz(func(t *testing.T, version string, propsData []byte) { + ff := fuzz.NewConsumer(propsData) + props := types.ArtifactProperties{} + ff.GenerateStruct(&props) + it := New() + _, _ = it.CreateProposedEntry(context.Background(), version, props) + }) +} diff --git a/pkg/types/intoto/fuzz_test.go b/pkg/types/intoto/fuzz_test.go new file mode 100644 index 000000000..d47be83ba --- /dev/null +++ b/pkg/types/intoto/fuzz_test.go @@ -0,0 +1,35 @@ +// +// Copyright 2022 The Sigstore Authors. +// +// 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 intoto + +import ( + "context" + "testing" + + fuzz "github.com/AdaLogics/go-fuzz-headers" + + "github.com/sigstore/rekor/pkg/types" +) + +func FuzzIntotoCreateProposedEntry(f *testing.F) { + f.Fuzz(func(t *testing.T, version string, propsData []byte) { + ff := fuzz.NewConsumer(propsData) + props := types.ArtifactProperties{} + ff.GenerateStruct(&props) + it := New() + _, _ = it.CreateProposedEntry(context.Background(), version, props) + }) +} diff --git a/pkg/types/rfc3161/fuzz_test.go b/pkg/types/rfc3161/fuzz_test.go new file mode 100644 index 000000000..5504ed4e1 --- /dev/null +++ b/pkg/types/rfc3161/fuzz_test.go @@ -0,0 +1,35 @@ +// +// Copyright 2022 The Sigstore Authors. +// +// 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 rfc3161 + +import ( + "context" + "testing" + + fuzz "github.com/AdaLogics/go-fuzz-headers" + + "github.com/sigstore/rekor/pkg/types" +) + +func FuzzRfc3161CreateProposedEntry(f *testing.F) { + f.Fuzz(func(t *testing.T, version string, propsData []byte) { + ff := fuzz.NewConsumer(propsData) + props := types.ArtifactProperties{} + ff.GenerateStruct(&props) + it := New() + _, _ = it.CreateProposedEntry(context.Background(), version, props) + }) +} diff --git a/pkg/types/rpm/fuzz_test.go b/pkg/types/rpm/fuzz_test.go new file mode 100644 index 000000000..ed6223109 --- /dev/null +++ b/pkg/types/rpm/fuzz_test.go @@ -0,0 +1,35 @@ +// +// Copyright 2022 The Sigstore Authors. +// +// 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 rpm + +import ( + "context" + "testing" + + fuzz "github.com/AdaLogics/go-fuzz-headers" + + "github.com/sigstore/rekor/pkg/types" +) + +func FuzzRpmCreateProposedEntry(f *testing.F) { + f.Fuzz(func(t *testing.T, version string, propsData []byte) { + ff := fuzz.NewConsumer(propsData) + props := types.ArtifactProperties{} + ff.GenerateStruct(&props) + it := New() + _, _ = it.CreateProposedEntry(context.Background(), version, props) + }) +} diff --git a/pkg/types/tuf/fuzz_test.go b/pkg/types/tuf/fuzz_test.go new file mode 100644 index 000000000..9c2b3b031 --- /dev/null +++ b/pkg/types/tuf/fuzz_test.go @@ -0,0 +1,35 @@ +// +// Copyright 2022 The Sigstore Authors. +// +// 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 tuf + +import ( + "context" + "testing" + + fuzz "github.com/AdaLogics/go-fuzz-headers" + + "github.com/sigstore/rekor/pkg/types" +) + +func FuzzTufCreateProposedEntry(f *testing.F) { + f.Fuzz(func(t *testing.T, version string, propsData []byte) { + ff := fuzz.NewConsumer(propsData) + props := types.ArtifactProperties{} + ff.GenerateStruct(&props) + it := New() + _, _ = it.CreateProposedEntry(context.Background(), version, props) + }) +} diff --git a/tests/oss_fuzz.sh b/tests/oss_fuzz.sh index a8f60aab8..4044db51c 100755 --- a/tests/oss_fuzz.sh +++ b/tests/oss_fuzz.sh @@ -27,3 +27,8 @@ compile_native_go_fuzzer github.com/sigstore/rekor/pkg/sharding FuzzValidateUUID compile_native_go_fuzzer github.com/sigstore/rekor/pkg/sharding FuzzValidateTreeID FuzzValidateTreeID compile_native_go_fuzzer github.com/sigstore/rekor/pkg/sharding FuzzValidateEntryID FuzzValidateEntryID compile_native_go_fuzzer github.com/sigstore/rekor/pkg/types/alpine FuzzPackageUnmarshal FuzzPackageUnmarshal +compile_native_go_fuzzer github.com/sigstore/rekor/pkg/types/intoto FuzzIntotoCreateProposedEntry FuzzIntotoCreateProposedEntry +compile_native_go_fuzzer github.com/sigstore/rekor/pkg/types/tuf FuzzTufCreateProposedEntry FuzzTufCreateProposedEntry +compile_native_go_fuzzer github.com/sigstore/rekor/pkg/types/rfc3161 FuzzRfc3161CreateProposedEntry FuzzRfc3161CreateProposedEntry +compile_native_go_fuzzer github.com/sigstore/rekor/pkg/types/rpm FuzzRpmCreateProposedEntry FuzzRpmCreateProposedEntry +compile_native_go_fuzzer github.com/sigstore/rekor/pkg/types/helm FuzzHelmCreateProposedEntry FuzzHelmCreateProposedEntry