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
- Host: GitHub
- URL: https://github.com/jptosso/coraza-gin
- Owner: jptosso
- Created: 2021-08-31T04:43:31.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-06-17T04:19:57.000Z (over 3 years ago)
- Last Synced: 2025-04-12T00:16:59.742Z (6 months ago)
- Topics: gin-gonic, middleware, waf
- Language: Go
- Homepage:
- Size: 18.6 KB
- Stars: 26
- Watchers: 2
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
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")
}
```