Skip to content

Commit

Permalink
Merge branch 'windows-fix-TestHardcodedIncludeDirectiveDDOS2' of gith…
Browse files Browse the repository at this point in the history
…ub.com:jabdr/coraza into windows-fix-TestHardcodedIncludeDirectiveDDOS2
  • Loading branch information
jabdr committed Aug 27, 2024
2 parents f0f1d06 + dbefb52 commit 7b25147
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ require (
github.com/petar-dambovaliev/aho-corasick v0.0.0-20240411101913-e07a1f0e8eb4
github.com/tidwall/gjson v1.17.1
golang.org/x/net v0.28.0
golang.org/x/sync v0.7.0
golang.org/x/sync v0.8.0
rsc.io/binaryregexp v0.2.0
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down
11 changes: 8 additions & 3 deletions internal/operators/inspect_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,24 @@ package operators
import (
_ "fmt"
"path/filepath"
"runtime"
"testing"

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

func TestInspectFile(t *testing.T) {
existCommand := "/bin/echo"
if runtime.GOOS == "windows" {
existCommand = "C:\\Windows\\system32\\tasklist.exe"
}

tests := []struct {
path string
exists bool
}{
{
// TODO(anuraaga): Don't have this rely on OS details.
path: "/bin/echo",
path: existCommand,
exists: true,
},
{
Expand All @@ -37,7 +42,7 @@ func TestInspectFile(t *testing.T) {
if err != nil {
t.Error("cannot init inspectfile operator")
}
if want, have := tt.exists, ipf.Evaluate(nil, ""); want != have {
if want, have := tt.exists, ipf.Evaluate(nil, "/?"); want != have {
t.Errorf("inspectfile path %s: want %v, have %v", tt.path, want, have)
}
})
Expand Down

0 comments on commit 7b25147

Please sign in to comment.