-
-
Notifications
You must be signed in to change notification settings - Fork 229
/
main.go
43 lines (34 loc) · 1.42 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2023 Juan Pablo Tosso and the OWASP Coraza contributors
// SPDX-License-Identifier: Apache-2.0
//go:build !tinygo
// +build !tinygo
package main
import (
"flag"
"fmt"
"os"
"github.com/corazawaf/coraza/v3/http/e2e"
)
// Flags:
// --nulled-body: Interruptions at response body phase are allowed to return 200 (Instead of 403), but with a body full of null bytes. Defaults to "false".
// --proxy-hostport: Proxy endpoint used to perform requests. Defaults to "localhost:8080".
// --httpbin-hostport: Upstream httpbin endpoint, used for health checking reasons. Defaults to "localhost:8081".
// A dedicated set of directives is expected to be loaded for e2e testing. Refer to the `Directives` const in http/e2e/e2e.go.
func main() {
// Initialize variables
var (
nulledBody = flag.Bool("nulled-body", false, "Accept a body filled of empty bytes as an enforced disruptive action. Default: false")
proxyHostport = flag.String("proxy-hostport", "localhost:8080", "Configures the URL in which the proxy is running. Default: \"localhost:8080\"")
httpbinHostport = flag.String("httpbin-hostport", "localhost:8081", "Configures the URL in which httpbin is running. Default: \"localhost:8081\"")
)
flag.Parse()
err := e2e.Run(e2e.Config{
NulledBody: *nulledBody,
ProxiedEntrypoint: *proxyHostport,
HttpbinEntrypoint: *httpbinHostport,
})
if err != nil {
fmt.Printf("[Fail] %s\n", err)
os.Exit(1)
}
}