Skip to content

Commit

Permalink
feat: update overrides schema
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
theseion committed Nov 12, 2023
1 parent cd19db3 commit 8aae278
Show file tree
Hide file tree
Showing 17 changed files with 2,843 additions and 1,109 deletions.
15 changes: 12 additions & 3 deletions cmd/generate-doc-yaml-schema/main.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
// Copyright 2023 Felipe Zipitria
// Copyright 2023 OWASP CRS
// SPDX-License-Identifier: Apache-2.0

package main

import (
"os"

"github.com/coreruleset/ftw-tests-schema/test"
"github.com/coreruleset/ftw-tests-schema/types"
)

func main() {
data, err := test.GetFTWTestDoc().Encode()
data, err := types.GetFTWTestDoc().Encode()
if err != nil {
panic(err)
}
_, err = os.Stdout.Write(data)
if err != nil {
panic(err)
}

data, err = types.GetFTWOverridesDoc().Encode()
if err != nil {
panic(err)
}
Expand Down
6 changes: 6 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ go 1.21

require github.com/magefile/mage v1.15.0

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
)

require (
// Goccy verion is expected to stay at 1.9.2 (Same of go-ftw) because of https://github.com/goccy/go-yaml/issues/325
github.com/goccy/go-yaml v1.9.2
Expand All @@ -14,6 +19,7 @@ require (
github.com/fatih/color v1.10.0 // indirect
github.com/mattn/go-colorable v0.1.8 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/stretchr/testify v1.8.4
golang.org/x/sys v0.6.0 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ github.com/projectdiscovery/yamldoc-go v1.0.4 h1:eZoESapnMw6WAHiVgRwNqvbJEfNHEH1
github.com/projectdiscovery/yamldoc-go v1.0.4/go.mod h1:8PIPRcUD55UbtQdcfFR1hpIGRWG0P7alClXNGt1TBik=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
Expand Down
2 changes: 1 addition & 1 deletion mage.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2022 Juan Pablo Tosso and the OWASP Coraza contributors
// Copyright 2023 CRS
// SPDX-License-Identifier: Apache-2.0

//go:build ignore
Expand Down
4 changes: 2 additions & 2 deletions magefile.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2023 Felipe Zipitria
// Copyright 2023 CRS
// SPDX-License-Identifier: Apache-2.0

//go:build mage
Expand Down Expand Up @@ -36,7 +36,7 @@ func Format() error {
// addlicense strangely logs skipped files to stderr despite not being erroneous, so use the long sh.Exec form to
// discard stderr too.
if _, err := sh.Exec(map[string]string{}, io.Discard, io.Discard, "go", "run", fmt.Sprintf("github.com/google/addlicense@%s", addLicenseVersion),
"-c", "Felipe Zipitria",
"-c", "OWASP CRS",
"-s=only",
"-ignore", "**/*.yml",
"-ignore", "**/*.yaml",
Expand Down
122 changes: 0 additions & 122 deletions overrides/overrides.go

This file was deleted.

194 changes: 0 additions & 194 deletions overrides/overrides_doc.go

This file was deleted.

Loading

0 comments on commit 8aae278

Please sign in to comment.