diff --git a/.github/workflows/fuzzing.yaml b/.github/workflows/fuzzing.yaml new file mode 100644 index 0000000000..b521b5414e --- /dev/null +++ b/.github/workflows/fuzzing.yaml @@ -0,0 +1,32 @@ +name: "Fuzzing Testing" +on: # yamllint disable-line rule:truthy + push: + branches: + - "!dependabot/*" + - "main" + pull_request: + branches: ["*"] +jobs: + fuzz: + runs-on: "ubuntu-latest" + steps: + - name: "Build Fuzzers" + id: "build" + uses: "google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master" + with: + oss-fuzz-project-name: "spicedb" + language: "go" + dry-run: "false" + - name: "Run Fuzzers" + uses: "google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master" + with: + oss-fuzz-project-name: "spicedb" + language: "go" + fuzz-seconds: 300 + dry-run: false + - name: "Upload Crash" + uses: "actions/upload-artifact@v3" + if: failure() && steps.build.outcome == 'success' + with: + name: "artifacts" + path: "./out/artifacts" \ No newline at end of file diff --git a/pkg/schemadsl/parser/fuzz_test.go b/pkg/schemadsl/parser/fuzz_test.go new file mode 100644 index 0000000000..83c77e4231 --- /dev/null +++ b/pkg/schemadsl/parser/fuzz_test.go @@ -0,0 +1,13 @@ +package parser + +import ( + "testing" + + "github.com/authzed/spicedb/pkg/schemadsl/input" +) + +func FuzzParser(f *testing.F) { + f.Fuzz(func(t *testing.T, v string) { + _ = Parse(createAstNode, input.Source(v), v) + }) +}