-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fuzzing the RequestFromRekor API call using go-fuzz. Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com>
- Loading branch information
1 parent
e003278
commit 2b68110
Showing
9 changed files
with
99 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ logid | |
swagger | ||
dist/* | ||
hack/tools/bin/* | ||
*fuzz.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
//go:build gofuzz | ||
// +build gofuzz | ||
|
||
// | ||
// Copyright 2021 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 fuzz | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
fuzz "github.com/AdaLogics/go-fuzz-headers" | ||
"github.com/sassoftware/relic/lib/pkcs9" | ||
"github.com/sigstore/rekor/pkg/api" | ||
) | ||
|
||
// FuzzTimeStamp uses go-fuzz fuzz the timestamp | ||
func FuzzTimeStamp(data []byte) int { | ||
f := fuzz.NewConsumer(data) | ||
x := pkcs9.TimeStampReq{} | ||
f.AllowUnexportedFields() | ||
if err := f.GenerateStruct(&x); err != nil { | ||
return 0 | ||
} | ||
result, err := api.RequestFromRekor(context.Background(), x) | ||
if err != nil { | ||
if result != nil { | ||
panic(fmt.Sprintf("result wasn't nil when there was an error %v, %v", err, result)) | ||
} | ||
return 0 | ||
} | ||
return 1 | ||
} |