Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update import path #1

Merged
merged 15 commits into from
Dec 6, 2023
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
contact_links:
- name: Question 🙋
url: https://github.com/corazawaf/coraza/discussions/categories/q-a
url: https://github.com/crowdsecurity/coraza/discussions/categories/q-a
about: Ask your question in Coraza WAF Discussions
2 changes: 1 addition & 1 deletion collection/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package collection
import (
"regexp"

"github.com/corazawaf/coraza/v3/types"
"github.com/crowdsecurity/coraza/v3/types"
)

// Collection are used to store VARIABLE data
Expand Down
8 changes: 4 additions & 4 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ package coraza
import (
"io/fs"

"github.com/corazawaf/coraza/v3/debuglog"
"github.com/corazawaf/coraza/v3/experimental/plugins/plugintypes"
"github.com/corazawaf/coraza/v3/internal/corazawaf"
"github.com/corazawaf/coraza/v3/types"
"github.com/crowdsecurity/coraza/v3/debuglog"
"github.com/crowdsecurity/coraza/v3/experimental/plugins/plugintypes"
"github.com/crowdsecurity/coraza/v3/internal/corazawaf"
"github.com/crowdsecurity/coraza/v3/types"
)

// WAFConfig controls the behavior of the WAF.
Expand Down
2 changes: 1 addition & 1 deletion config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package coraza
import (
"testing"

"github.com/corazawaf/coraza/v3/types"
"github.com/crowdsecurity/coraza/v3/types"
)

func TestConfigRulesImmutable(t *testing.T) {
Expand Down
7 changes: 6 additions & 1 deletion examples/http-server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ module github.com/corazawaf/coraza/v3/examples/http-server

go 1.19

require github.com/corazawaf/coraza/v3 v3.0.0-20220914101451-05d352c89b24
require github.com/crowdsecurity/coraza/v3 v3.0.0-20231206165912-778ce24a85e7

require (
github.com/corazawaf/libinjection-go v0.1.2 // indirect
github.com/magefile/mage v1.15.0 // indirect
github.com/petar-dambovaliev/aho-corasick v0.0.0-20230725210150-fb29fc3c913e // indirect
github.com/tidwall/gjson v1.17.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sync v0.5.0 // indirect
rsc.io/binaryregexp v0.2.0 // indirect
)
19 changes: 17 additions & 2 deletions examples/http-server/go.sum
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
github.com/corazawaf/coraza/v3 v3.0.0-20220914101451-05d352c89b24 h1:dy3992o5ue40g1QWKupjsBwZTRWagsuiGcOsbV0b4xs=
github.com/corazawaf/coraza/v3 v3.0.0-20220914101451-05d352c89b24/go.mod h1:xhc7feR6FUfYgmBmRw3UObvLiyzT3XPQtlJD+huy+Mc=
github.com/corazawaf/libinjection-go v0.1.2 h1:oeiV9pc5rvJ+2oqOqXEAMJousPpGiup6f7Y3nZj5GoM=
github.com/corazawaf/libinjection-go v0.1.2/go.mod h1:OP4TM7xdJ2skyXqNX1AN1wN5nNZEmJNuWbNPOItn7aw=
github.com/crowdsecurity/coraza/v3 v3.0.0-20231206165912-778ce24a85e7 h1:3rnfZlcD6p5c1Xyc7yvOrqrX+xz4NFbNHftEra4msqg=
github.com/crowdsecurity/coraza/v3 v3.0.0-20231206165912-778ce24a85e7/go.mod h1:jNww1Y9SujXQc89zDR+XOb70bkC7mZ6ep7iKhUBBsiI=
github.com/foxcpp/go-mockdns v1.0.0 h1:7jBqxd3WDWwi/6WhDvacvH1XsN3rOLXyHM1uhvIx6FI=
github.com/magefile/mage v1.15.0 h1:BvGheCMAsG3bWUDbZ8AyXXpCNwU9u5CB6sM+HNb9HYg=
github.com/magefile/mage v1.15.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
github.com/miekg/dns v1.1.50 h1:DQUfb9uc6smULcREF09Uc+/Gd46YWqJd5DbpPE9xkcA=
github.com/petar-dambovaliev/aho-corasick v0.0.0-20230725210150-fb29fc3c913e h1:POJco99aNgosh92lGqmx7L1ei+kCymivB/419SD15PQ=
github.com/petar-dambovaliev/aho-corasick v0.0.0-20230725210150-fb29fc3c913e/go.mod h1:EHPiTAKtiFmrMldLUNswFwfZ2eJIYBHktdaUTZxYWRw=
github.com/tidwall/gjson v1.17.0 h1:/Jocvlh98kcTfpN2+JzGQWQcqrPQwDrVEMApx/M5ZwM=
github.com/tidwall/gjson v1.17.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U=
golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE=
golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
rsc.io/binaryregexp v0.2.0 h1:HfqmD5MEmC0zvwBuF187nq9mdnXjXsSivRiXN7SmRkE=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
6 changes: 3 additions & 3 deletions examples/http-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"os"
"strings"

"github.com/corazawaf/coraza/v3"
txhttp "github.com/corazawaf/coraza/v3/http"
"github.com/corazawaf/coraza/v3/types"
"github.com/crowdsecurity/coraza/v3"
txhttp "github.com/crowdsecurity/coraza/v3/http"
"github.com/crowdsecurity/coraza/v3/types"
)

func exampleHandler(w http.ResponseWriter, req *http.Request) {
Expand Down
2 changes: 1 addition & 1 deletion examples/http-server/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"os"
"testing"

txhttp "github.com/corazawaf/coraza/v3/http"
txhttp "github.com/crowdsecurity/coraza/v3/http"
)

func setupTestServer(t *testing.T) *httptest.Server {
Expand Down
4 changes: 2 additions & 2 deletions experimental/plugins/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
package plugins

import (
"github.com/corazawaf/coraza/v3/experimental/plugins/plugintypes"
"github.com/corazawaf/coraza/v3/internal/actions"
"github.com/crowdsecurity/coraza/v3/experimental/plugins/plugintypes"
"github.com/crowdsecurity/coraza/v3/internal/actions"
)

// ActionFactory is used to wrap a RuleAction so that it can be registered
Expand Down
6 changes: 3 additions & 3 deletions experimental/plugins/actions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ package plugins_test
import (
"testing"

"github.com/corazawaf/coraza/v3/experimental/plugins"
"github.com/corazawaf/coraza/v3/experimental/plugins/plugintypes"
"github.com/corazawaf/coraza/v3/internal/actions"
"github.com/crowdsecurity/coraza/v3/experimental/plugins"
"github.com/crowdsecurity/coraza/v3/experimental/plugins/plugintypes"
"github.com/crowdsecurity/coraza/v3/internal/actions"
)

func TestAction(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions experimental/plugins/auditlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
package plugins

import (
"github.com/corazawaf/coraza/v3/experimental/plugins/plugintypes"
"github.com/corazawaf/coraza/v3/internal/auditlog"
"github.com/crowdsecurity/coraza/v3/experimental/plugins/plugintypes"
"github.com/crowdsecurity/coraza/v3/internal/auditlog"
)

// RegisterAuditLogWriter registers a new audit log writer.
Expand Down
6 changes: 3 additions & 3 deletions experimental/plugins/auditlog_formatter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
package plugins_test

import (
"github.com/corazawaf/coraza/v3"
"github.com/corazawaf/coraza/v3/experimental/plugins"
"github.com/corazawaf/coraza/v3/experimental/plugins/plugintypes"
"github.com/crowdsecurity/coraza/v3"
"github.com/crowdsecurity/coraza/v3/experimental/plugins"
"github.com/crowdsecurity/coraza/v3/experimental/plugins/plugintypes"
)

type testFormatter struct{}
Expand Down
6 changes: 3 additions & 3 deletions experimental/plugins/auditlog_writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (
"net/http/httptest"
"strings"

"github.com/corazawaf/coraza/v3"
"github.com/corazawaf/coraza/v3/experimental/plugins"
"github.com/corazawaf/coraza/v3/experimental/plugins/plugintypes"
"github.com/crowdsecurity/coraza/v3"
"github.com/crowdsecurity/coraza/v3/experimental/plugins"
"github.com/crowdsecurity/coraza/v3/experimental/plugins/plugintypes"
)

type urlWriter struct {
Expand Down
4 changes: 2 additions & 2 deletions experimental/plugins/bodyprocessors.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
package plugins

import (
"github.com/corazawaf/coraza/v3/experimental/plugins/plugintypes"
"github.com/corazawaf/coraza/v3/internal/bodyprocessors"
"github.com/crowdsecurity/coraza/v3/experimental/plugins/plugintypes"
"github.com/crowdsecurity/coraza/v3/internal/bodyprocessors"
)

// RegisterBodyProcessor registers a body processor
Expand Down
6 changes: 3 additions & 3 deletions experimental/plugins/macro/macro.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"fmt"
"strings"

"github.com/corazawaf/coraza/v3/collection"
"github.com/corazawaf/coraza/v3/experimental/plugins/plugintypes"
"github.com/corazawaf/coraza/v3/types/variables"
"github.com/crowdsecurity/coraza/v3/collection"
"github.com/crowdsecurity/coraza/v3/experimental/plugins/plugintypes"
"github.com/crowdsecurity/coraza/v3/types/variables"
)

type Macro interface {
Expand Down
2 changes: 1 addition & 1 deletion experimental/plugins/macro/macro_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"
"testing"

"github.com/corazawaf/coraza/v3/types/variables"
"github.com/crowdsecurity/coraza/v3/types/variables"
)

func TestNewMacro(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions experimental/plugins/operators.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
package plugins

import (
"github.com/corazawaf/coraza/v3/experimental/plugins/plugintypes"
"github.com/corazawaf/coraza/v3/internal/operators"
"github.com/crowdsecurity/coraza/v3/experimental/plugins/plugintypes"
"github.com/crowdsecurity/coraza/v3/internal/operators"
)

// RegisterOperator registers a new operator
Expand Down
6 changes: 3 additions & 3 deletions experimental/plugins/operators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ package plugins_test
import (
"testing"

"github.com/corazawaf/coraza/v3/experimental/plugins"
"github.com/corazawaf/coraza/v3/experimental/plugins/plugintypes"
"github.com/corazawaf/coraza/v3/internal/operators"
"github.com/crowdsecurity/coraza/v3/experimental/plugins"
"github.com/crowdsecurity/coraza/v3/experimental/plugins/plugintypes"
"github.com/crowdsecurity/coraza/v3/internal/operators"
)

func TestGetOperator(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion experimental/plugins/plugintypes/auditlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package plugintypes
import (
"io/fs"

"github.com/corazawaf/coraza/v3/types"
"github.com/crowdsecurity/coraza/v3/types"
)

// AuditLog represents the main struct for audit log data
Expand Down
5 changes: 4 additions & 1 deletion experimental/plugins/plugintypes/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

package plugintypes

import "github.com/corazawaf/coraza/v3/types"
import "github.com/crowdsecurity/coraza/v3/types"

// Rule is a rule executed against a transaction.
type Rule interface {
Expand All @@ -21,4 +21,7 @@ type RuleMetadata interface {

// Status returns the status to set if the rule matches.
Status() int

// Tags returns the tags of the rule.
Tags() []string
}
8 changes: 4 additions & 4 deletions experimental/plugins/plugintypes/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
package plugintypes

import (
"github.com/corazawaf/coraza/v3/collection"
"github.com/corazawaf/coraza/v3/debuglog"
"github.com/corazawaf/coraza/v3/types"
"github.com/corazawaf/coraza/v3/types/variables"
"github.com/crowdsecurity/coraza/v3/collection"
"github.com/crowdsecurity/coraza/v3/debuglog"
"github.com/crowdsecurity/coraza/v3/types"
"github.com/crowdsecurity/coraza/v3/types/variables"
)

// TransactionState tracks the state of a transaction for use in actions and operators.
Expand Down
4 changes: 2 additions & 2 deletions experimental/plugins/transformations.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
package plugins

import (
"github.com/corazawaf/coraza/v3/experimental/plugins/plugintypes"
"github.com/corazawaf/coraza/v3/internal/transformations"
"github.com/crowdsecurity/coraza/v3/experimental/plugins/plugintypes"
"github.com/crowdsecurity/coraza/v3/internal/transformations"
)

// RegisterTransformation registers a transformation by name
Expand Down
4 changes: 2 additions & 2 deletions experimental/plugins/transformations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ package plugins_test
import (
"testing"

"github.com/corazawaf/coraza/v3/experimental/plugins"
"github.com/corazawaf/coraza/v3/internal/transformations"
"github.com/crowdsecurity/coraza/v3/experimental/plugins"
"github.com/crowdsecurity/coraza/v3/internal/transformations"
)

func TestTransformation(t *testing.T) {
Expand Down
23 changes: 23 additions & 0 deletions experimental/transaction.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package experimental

import (
"github.com/crowdsecurity/coraza/v3/collection"
"github.com/crowdsecurity/coraza/v3/experimental/plugins/plugintypes"
"github.com/crowdsecurity/coraza/v3/types"
"github.com/crowdsecurity/coraza/v3/types/variables"
)

func ToFullInterface(waf types.Transaction) FullTransaction {
x := waf.(FullTransaction)
return x
}

type FullTransaction interface {
types.Transaction
RemoveRuleByID(int)
RemoveRulesByID(...int)
RemoveRuleByTag(string)
RemoveRulesByTag(...string)
Variables() plugintypes.TransactionVariables
Collection(variables.RuleVariable) collection.Collection
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/corazawaf/coraza/v3
module github.com/crowdsecurity/coraza/v3

go 1.19

Expand Down
16 changes: 7 additions & 9 deletions go.work.sum
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/pelletier/go-toml v1.9.1/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.15.0 h1:frVn1TEaCEaZcn3Tmd7Y2b5KKPaZ+I32Q2OA3kYp5TA=
golang.org/x/crypto v0.15.0/go.mod h1:4ChreQoLWfG3xLDer1WdlH5NdlQ3+mwnQq1YTKY+72g=
github.com/crowdsecurity/coraza/v3 v3.0.0-20231206133559-d4e35eb98584/go.mod h1:jNww1Y9SujXQc89zDR+XOb70bkC7mZ6ep7iKhUBBsiI=
golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY=
golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ=
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.14.0/go.mod h1:TySc+nGkYR6qt8km8wUhuFRTVSMIX3XPR58y2lC8vww=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
2 changes: 1 addition & 1 deletion http/e2e/cmd/httpe2e/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"fmt"
"os"

"github.com/corazawaf/coraza/v3/http/e2e"
"github.com/crowdsecurity/coraza/v3/http/e2e"
)

// Flags:
Expand Down
2 changes: 1 addition & 1 deletion http/e2e/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func Run(cfg Config) error {
requestMethod: "POST",
// When sending a POST request, the "application/x-www-form-urlencoded" content-type header is needed
// being the only content-type for which by default Coraza enforces the request body processing.
// See https://github.com/corazawaf/coraza/issues/438
// See https://github.com/crowdsecurity/coraza/issues/438
requestHeaders: map[string]string{"Content-Type": "application/x-www-form-urlencoded"},
requestBody: "This is a legit payload",
expectedStatusCode: expectStatusCode(200),
Expand Down
2 changes: 1 addition & 1 deletion http/interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"log"
"net/http"

"github.com/corazawaf/coraza/v3/types"
"github.com/crowdsecurity/coraza/v3/types"
)

// rwInterceptor intercepts the ResponseWriter, so it can track response size
Expand Down
2 changes: 1 addition & 1 deletion http/interceptor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"net/http/httptest"
"testing"

"github.com/corazawaf/coraza/v3"
"github.com/crowdsecurity/coraza/v3"
)

func TestWriteHeader(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions http/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"strconv"
"strings"

"github.com/corazawaf/coraza/v3"
"github.com/corazawaf/coraza/v3/types"
"github.com/crowdsecurity/coraza/v3"
"github.com/crowdsecurity/coraza/v3/types"
)

// processRequest fills all transaction variables from an http.Request object
Expand Down
Loading
Loading