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

Switch to go-re2 #1005

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions collection/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
package collection

import (
"regexp"

regexp "github.com/wasilibs/go-re2"
"github.com/corazawaf/coraza/v3/types"
)

Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ require (
github.com/mccutchen/go-httpbin/v2 v2.13.2
github.com/petar-dambovaliev/aho-corasick v0.0.0-20230725210150-fb29fc3c913e
github.com/tidwall/gjson v1.17.1
github.com/wasilibs/go-re2 v1.4.1
golang.org/x/net v0.21.0
golang.org/x/sync v0.6.0
rsc.io/binaryregexp v0.2.0
)

require (
github.com/miekg/dns v1.1.57 // indirect
github.com/tetratelabs/wazero v1.5.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
golang.org/x/mod v0.14.0 // indirect
Expand Down
7 changes: 5 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@ github.com/miekg/dns v1.1.57 h1:Jzi7ApEIzwEPLHWRcafCN9LZSBbqQpxjt/wpgvg7wcM=
github.com/miekg/dns v1.1.57/go.mod h1:uqRjCRUuEAA6qsOiJvDd+CFo/vW+y5WR6SNmHE55hZk=
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/tetratelabs/wazero v1.5.0 h1:Yz3fZHivfDiZFUXnWMPUoiW7s8tC1sjdBtlJn08qYa0=
github.com/tetratelabs/wazero v1.5.0/go.mod h1:0U0G41+ochRKoPKCJlh0jMg1CHkyfK8kDqiirMmKY8A=
github.com/tidwall/gjson v1.17.1 h1:wlYEnwqAHgzmhNUFfw7Xalt2JzQvsMx2Se4PcoFCT/U=
github.com/tidwall/gjson v1.17.1/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=
github.com/wasilibs/go-re2 v1.4.1 h1:E5+9O1M8UoGeqLB2A9omeoaWImqpuYDs9cKwvTJq/Oo=
github.com/wasilibs/go-re2 v1.4.1/go.mod h1:ynB8eCwd9JsqUnsk8WlPDk6cEeme8BguZmnqOSURE4Y=
github.com/wasilibs/nottinygc v0.4.0 h1:h1TJMihMC4neN6Zq+WKpLxgd9xCFMw7O9ETLwY2exJQ=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
Expand Down
2 changes: 1 addition & 1 deletion internal/collections/concat.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
package collections

import (
"regexp"
"strings"

regexp "github.com/wasilibs/go-re2"
"github.com/corazawaf/coraza/v3/collection"
"github.com/corazawaf/coraza/v3/internal/corazarules"
"github.com/corazawaf/coraza/v3/types"
Expand Down
2 changes: 1 addition & 1 deletion internal/collections/concat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
package collections

import (
"regexp"
"strings"
"testing"
regexp "github.com/wasilibs/go-re2"

"github.com/corazawaf/coraza/v3/types"
"github.com/corazawaf/coraza/v3/types/variables"
Expand Down
2 changes: 1 addition & 1 deletion internal/collections/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
package collections

import (
"regexp"
"strings"

regexp "github.com/wasilibs/go-re2"
"github.com/corazawaf/coraza/v3/collection"
"github.com/corazawaf/coraza/v3/internal/corazarules"
"github.com/corazawaf/coraza/v3/types"
Expand Down
2 changes: 1 addition & 1 deletion internal/collections/map_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ package collections

import (
"fmt"
"regexp"
regexp "github.com/wasilibs/go-re2"
"testing"

"github.com/corazawaf/coraza/v3/types/variables"
Expand Down
2 changes: 1 addition & 1 deletion internal/collections/named.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package collections

import (
"fmt"
"regexp"
regexp "github.com/wasilibs/go-re2"
"strings"

"github.com/corazawaf/coraza/v3/collection"
Expand Down
2 changes: 1 addition & 1 deletion internal/collections/named_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package collections

import (
"fmt"
"regexp"
regexp "github.com/wasilibs/go-re2"
"testing"

"github.com/corazawaf/coraza/v3/types/variables"
Expand Down
2 changes: 1 addition & 1 deletion internal/collections/sized.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package collections

import (
"fmt"
"regexp"
regexp "github.com/wasilibs/go-re2"
"strconv"
"strings"

Expand Down
2 changes: 1 addition & 1 deletion internal/corazawaf/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package corazawaf
import (
"fmt"
"reflect"
"regexp"
regexp "github.com/wasilibs/go-re2"
"strconv"
"strings"
"sync"
Expand Down
2 changes: 1 addition & 1 deletion internal/corazawaf/transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"bytes"
"fmt"
"io"
"regexp"
"runtime/debug"
"strconv"
"strings"
Expand All @@ -20,6 +19,7 @@ import (
"github.com/corazawaf/coraza/v3/internal/collections"
"github.com/corazawaf/coraza/v3/internal/corazarules"
utils "github.com/corazawaf/coraza/v3/internal/strings"
regexp "github.com/wasilibs/go-re2"
"github.com/corazawaf/coraza/v3/types"
"github.com/corazawaf/coraza/v3/types/variables"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/corazawaf/waf.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"io"
"io/fs"
"os"
"regexp"
regexp "github.com/wasilibs/go-re2"
"strconv"
"time"

Expand Down
2 changes: 1 addition & 1 deletion internal/operators/restpath.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package operators

import (
"fmt"
"regexp"
regexp "github.com/wasilibs/go-re2"
"strings"

"github.com/corazawaf/coraza/v3/experimental/plugins/plugintypes"
Expand Down
2 changes: 1 addition & 1 deletion internal/operators/rx.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package operators

import (
"fmt"
"regexp"
regexp "github.com/wasilibs/go-re2"
"strconv"
"unicode/utf8"

Expand Down
2 changes: 1 addition & 1 deletion internal/operators/rx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package operators

import (
"fmt"
"regexp"
regexp "github.com/wasilibs/go-re2"
"testing"

"github.com/corazawaf/coraza/v3/experimental/plugins/plugintypes"
Expand Down
2 changes: 1 addition & 1 deletion internal/operators/validate_nid.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package operators

import (
"fmt"
"regexp"
regexp "github.com/wasilibs/go-re2"
"strconv"
"strings"

Expand Down
2 changes: 1 addition & 1 deletion internal/seclang/directives.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"errors"
"fmt"
"io/fs"
"regexp"
regexp "github.com/wasilibs/go-re2"
"strconv"
"strings"

Expand Down
2 changes: 1 addition & 1 deletion internal/seclang/rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package seclang

import (
"regexp"
regexp "github.com/wasilibs/go-re2"
"strings"
"testing"

Expand Down
2 changes: 1 addition & 1 deletion internal/variables/generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"go/types"
"log"
"os"
"regexp"
regexp "github.com/wasilibs/go-re2"
"strings"
"text/template"
)
Expand Down