Skip to content

Commit 8aae278

Browse files
committed
feat: update overrides schema
- write and improve tests - deprecate `log_contains` and `no_log_contains` in favour of new `log` struct - add `expect_id` and `no_expect_id` to simplify standard log output matches
1 parent cd19db3 commit 8aae278

17 files changed

+2843
-1109
lines changed

cmd/generate-doc-yaml-schema/main.go

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
1-
// Copyright 2023 Felipe Zipitria
1+
// Copyright 2023 OWASP CRS
22
// SPDX-License-Identifier: Apache-2.0
33

44
package main
55

66
import (
77
"os"
88

9-
"github.com/coreruleset/ftw-tests-schema/test"
9+
"github.com/coreruleset/ftw-tests-schema/types"
1010
)
1111

1212
func main() {
13-
data, err := test.GetFTWTestDoc().Encode()
13+
data, err := types.GetFTWTestDoc().Encode()
14+
if err != nil {
15+
panic(err)
16+
}
17+
_, err = os.Stdout.Write(data)
18+
if err != nil {
19+
panic(err)
20+
}
21+
22+
data, err = types.GetFTWOverridesDoc().Encode()
1423
if err != nil {
1524
panic(err)
1625
}

go.mod

+6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ go 1.21
44

55
require github.com/magefile/mage v1.15.0
66

7+
require (
8+
github.com/davecgh/go-spew v1.1.1 // indirect
9+
github.com/pmezard/go-difflib v1.0.0 // indirect
10+
)
11+
712
require (
813
// Goccy verion is expected to stay at 1.9.2 (Same of go-ftw) because of https://github.com/goccy/go-yaml/issues/325
914
github.com/goccy/go-yaml v1.9.2
@@ -14,6 +19,7 @@ require (
1419
github.com/fatih/color v1.10.0 // indirect
1520
github.com/mattn/go-colorable v0.1.8 // indirect
1621
github.com/mattn/go-isatty v0.0.12 // indirect
22+
github.com/stretchr/testify v1.8.4
1723
golang.org/x/sys v0.6.0 // indirect
1824
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
1925
gopkg.in/yaml.v3 v3.0.1 // indirect

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ github.com/projectdiscovery/yamldoc-go v1.0.4 h1:eZoESapnMw6WAHiVgRwNqvbJEfNHEH1
2626
github.com/projectdiscovery/yamldoc-go v1.0.4/go.mod h1:8PIPRcUD55UbtQdcfFR1hpIGRWG0P7alClXNGt1TBik=
2727
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
2828
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
29-
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
30-
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
29+
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
30+
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
3131
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
3232
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
3333
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=

mage.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2022 Juan Pablo Tosso and the OWASP Coraza contributors
1+
// Copyright 2023 CRS
22
// SPDX-License-Identifier: Apache-2.0
33

44
//go:build ignore

magefile.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 Felipe Zipitria
1+
// Copyright 2023 CRS
22
// SPDX-License-Identifier: Apache-2.0
33

44
//go:build mage
@@ -36,7 +36,7 @@ func Format() error {
3636
// addlicense strangely logs skipped files to stderr despite not being erroneous, so use the long sh.Exec form to
3737
// discard stderr too.
3838
if _, err := sh.Exec(map[string]string{}, io.Discard, io.Discard, "go", "run", fmt.Sprintf("github.com/google/addlicense@%s", addLicenseVersion),
39-
"-c", "Felipe Zipitria",
39+
"-c", "OWASP CRS",
4040
"-s=only",
4141
"-ignore", "**/*.yml",
4242
"-ignore", "**/*.yaml",

overrides/overrides.go

-122
This file was deleted.

overrides/overrides_doc.go

-194
This file was deleted.

0 commit comments

Comments
 (0)