An open API service indexing awesome lists of open source software.

https://github.com/jptosso/coraza-gin

Coraza WAF Gin-gonic middleware
https://github.com/jptosso/coraza-gin

gin-gonic middleware waf

Last synced: 6 months ago
JSON representation

Coraza WAF Gin-gonic middleware

Awesome Lists containing this project

README

          

This is a test middleware for Ginonic powered by [Coraza Web Application Firewall](https://github.com/jptosso/coraza-waf). You may check the WAF documentation at [coraza.io](https://coraza.io/)

Looking for contributors and testers.

## How to use

```go
import(
//...
"github.com/corazawaf/coraza"
"github.com/corazawaf/coraza/seclang"
corazagin"github.com/jptosso/coraza-gin"
)
func main() {
// Creates a router without any middleware by default
r := gin.New()
waf := coraza.NewWaf()
parser, _ := seclang.NewParser(waf)
//parser.FromString(`#... some rules`)
r.Use(corazagin.Coraza(waf))

// Per route middleware, you can add as many as you desire.
r.GET("/mypath", MyFunction(), Endpoint)

// Listen and serve on 0.0.0.0:8080
r.Run(":8080")
}
```