kataras / kataras/iris

plan to submit a fuzz driver to OSS-Fuzz

Open
#2,209 5 comments 0 reactions 1 assignee Claimed by @kataras View on GitHub
Dominant language
Go
Stars
25.6k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

We are developing a new technique to automatically transform your official unit tests into fuzz drivers. And our auto-generated fuzz driver successfully found your project's bugs #1967 #1968. Now we plan to submit this fuzz driver to [OSS-Fuzz Project](https://github.com/google/oss-fuzz). We hope to obtain your approval. Thanks a lot.

The fuzz driver's source code is followed. We are appreciated if you could provide us with some suggestions to improve our fuzz driver's quality.

```go
package iris_test

import (
"testing"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/httptest"
)

func FuzzTestUseRouterParentDisallow(f *testing.F) {
f.Add("no_userouter_allowed", "always", "_2", "_3", "/index", "/", "/user")
f.Fuzz(func(t *testing.T, data1 string, data2 string, data3 string, data4 string, data5 string, data6 string, data7 string) {
app := iris.New()
app.UseRouter(func(ctx iris.Context) {
ctx.WriteString(data2)
ctx.Next()
})
app.Get(data5, func(ctx iris.Context) {
ctx.WriteString(data1)
})

app.SetPartyMatcher(func(ctx iris.Context, p iris.Party) bool {
// modifies the PartyMatcher to not match any UseRouter,
// tests should receive the handlers response alone.
return false
})

app.PartyFunc(data6, func(p iris.Party) { // it's the same instance of app.
p.UseRouter(func(ctx iris.Context) {
ctx.WriteString(data3)
ctx.Next()
})
p.Get(data6, func(ctx iris.Context) {
ctx.WriteString(data1)
})
})

app.PartyFunc(data7, func(p iris.Party) {
p.UseRouter(func(ctx iris.Context) {
ctx.WriteString(data4)
ctx.Next()
})

p.Get(data6, func(ctx iris.Context) {
ctx.WriteString(data1)
})
})

e := httptest.New(t, app)
e.GET(data5)
e.GET(data6)
e.GET(data7)

})
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.