Skip to content

Commit 5b0ff6e

Browse files
committed
Merge branch 'master' into releases/1.6.x
2 parents 416eb27 + c245b1e commit 5b0ff6e

36 files changed

+223
-174
lines changed

Diff for: .golangci.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ linters-settings:
4646
gomoddirectives:
4747
replace-allow-list:
4848
- golang.org/x/time/rate
49+
- github.com/corazawaf/coraza/v3
4950

5051
govet:
5152
enable-all: true
@@ -279,12 +280,10 @@ linters:
279280
# Recommended? (requires some work)
280281
#
281282

282-
- containedctx # containedctx is a linter that detects struct contained context.Context field
283283
- errname # Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`.
284284
- ireturn # Accept Interfaces, Return Concrete Types
285285
- mnd # An analyzer to detect magic numbers.
286286
- nilnil # Checks that there is no simultaneous return of `nil` error and an invalid value.
287-
- noctx # Finds sending http request without context.Context
288287
- unparam # Reports unused function parameters
289288

290289
#
@@ -502,3 +501,8 @@ issues:
502501
- usetesting
503502
path: "pkg/apiserver/(.+)_test.go"
504503
text: "os.CreateTemp.* could be replaced by os.CreateTemp.*"
504+
505+
- linters:
506+
- containedctx
507+
path: "cmd/notification-file/main.go"
508+
text: "found a struct that contains a context.Context field"

Diff for: cmd/crowdsec-cli/clihub/hub.go

+23
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ cscli hub upgrade`,
4646
DisableAutoGenTag: true,
4747
}
4848

49+
cmd.AddCommand(cli.newBranchCmd())
4950
cmd.AddCommand(cli.newListCmd())
5051
cmd.AddCommand(cli.newUpdateCmd())
5152
cmd.AddCommand(cli.newUpgradeCmd())
@@ -84,6 +85,28 @@ func (cli *cliHub) List(out io.Writer, hub *cwhub.Hub, all bool) error {
8485
return nil
8586
}
8687

88+
func (cli *cliHub) newBranchCmd() *cobra.Command {
89+
var all bool
90+
91+
cmd := &cobra.Command{
92+
Use: "branch",
93+
Short: "Show selected hub branch",
94+
Long: "Display the hub branch to be used, depending on configuration and crowdsec version",
95+
Args: args.NoArgs,
96+
DisableAutoGenTag: true,
97+
RunE: func(cmd *cobra.Command, _ []string) error {
98+
branch := require.HubBranch(cmd.Context(), cli.cfg())
99+
fmt.Println(branch)
100+
return nil
101+
},
102+
}
103+
104+
flags := cmd.Flags()
105+
flags.BoolVarP(&all, "all", "a", false, "List all available items, including those not installed")
106+
107+
return cmd
108+
}
109+
87110
func (cli *cliHub) newListCmd() *cobra.Command {
88111
var all bool
89112

Diff for: go.mod

+12-11
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@ require (
2323
github.com/corazawaf/libinjection-go v0.2.2
2424
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
2525
github.com/creack/pty v1.1.21 // indirect
26-
github.com/crowdsecurity/coraza/v3 v3.0.0-20250121111732-9b0043b679d7
2726
github.com/crowdsecurity/dlog v0.0.0-20170105205344-4fb5f8204f26
2827
github.com/crowdsecurity/go-cs-lib v0.0.16
2928
github.com/crowdsecurity/grokky v0.2.2
3029
github.com/crowdsecurity/machineid v1.0.2
31-
github.com/davecgh/go-spew v1.1.1
30+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
3231
github.com/dghubble/sling v1.4.2
3332
github.com/distribution/reference v0.6.0 // indirect
3433
github.com/docker/docker v27.3.1+incompatible
@@ -99,12 +98,12 @@ require (
9998
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0 // indirect
10099
go.opentelemetry.io/otel/sdk v1.28.0 // indirect
101100
go.opentelemetry.io/otel/trace v1.28.0 // indirect
102-
golang.org/x/crypto v0.32.0
101+
golang.org/x/crypto v0.36.0
103102
golang.org/x/mod v0.23.0
104-
golang.org/x/net v0.34.0 // indirect
105-
golang.org/x/sync v0.11.0 // indirect
106-
golang.org/x/sys v0.30.0
107-
golang.org/x/text v0.21.0
103+
golang.org/x/net v0.37.0 // indirect
104+
golang.org/x/sync v0.12.0
105+
golang.org/x/sys v0.31.0
106+
golang.org/x/text v0.23.0
108107
golang.org/x/time v0.6.0 // indirect
109108
google.golang.org/grpc v1.67.1
110109
google.golang.org/protobuf v1.36.3
@@ -117,6 +116,8 @@ require (
117116

118117
)
119118

119+
require github.com/corazawaf/coraza/v3 v3.3.2
120+
120121
require (
121122
ariga.io/atlas v0.31.1-0.20250212144724-069be8033e83 // indirect
122123
github.com/Masterminds/goutils v1.1.1 // indirect
@@ -130,7 +131,6 @@ require (
130131
github.com/bytedance/sonic/loader v0.2.1 // indirect
131132
github.com/cloudwego/base64x v0.1.4 // indirect
132133
github.com/cloudwego/iasm v0.2.0 // indirect
133-
github.com/corazawaf/coraza-coreruleset v0.0.0-20240226094324-415b1017abdc // indirect
134134
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
135135
github.com/felixge/httpsnoop v1.0.4 // indirect
136136
github.com/gabriel-vasile/mimetype v1.4.7 // indirect
@@ -164,7 +164,6 @@ require (
164164
github.com/jackc/pgproto3/v2 v2.3.3 // indirect
165165
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
166166
github.com/jackc/pgtype v1.14.0 // indirect
167-
github.com/jcchavezs/mergefs v0.1.0 // indirect
168167
github.com/jmespath/go-jmespath v0.4.0 // indirect
169168
github.com/josharian/intern v1.0.0 // indirect
170169
github.com/json-iterator/go v1.1.12 // indirect
@@ -188,7 +187,7 @@ require (
188187
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
189188
github.com/petar-dambovaliev/aho-corasick v0.0.0-20240411101913-e07a1f0e8eb4 // indirect
190189
github.com/pierrec/lz4/v4 v4.1.18 // indirect
191-
github.com/pmezard/go-difflib v1.0.0 // indirect
190+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
192191
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
193192
github.com/prometheus/common v0.44.0 // indirect
194193
github.com/prometheus/procfs v0.15.1 // indirect
@@ -219,7 +218,7 @@ require (
219218
go.opentelemetry.io/otel/metric v1.28.0 // indirect
220219
go.uber.org/atomic v1.10.0 // indirect
221220
golang.org/x/arch v0.12.0 // indirect
222-
golang.org/x/term v0.28.0 // indirect
221+
golang.org/x/term v0.30.0 // indirect
223222
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
224223
google.golang.org/appengine v1.6.8 // indirect
225224
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
@@ -235,3 +234,5 @@ require (
235234
)
236235

237236
replace golang.org/x/time/rate => github.com/crowdsecurity/crowdsec/pkg/time/rate v0.0.0
237+
238+
replace github.com/corazawaf/coraza/v3 => github.com/crowdsecurity/coraza/v3 v3.0.0-20250320231801-749b8bded21a

Diff for: go.sum

+18-18
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,6 @@ github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I=
9393
github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo=
9494
github.com/corazawaf/coraza-coreruleset v0.0.0-20240226094324-415b1017abdc h1:OlJhrgI3I+FLUCTI3JJW8MoqyM78WbqJjecqMnqG+wc=
9595
github.com/corazawaf/coraza-coreruleset v0.0.0-20240226094324-415b1017abdc/go.mod h1:7rsocqNDkTCira5T0M7buoKR2ehh7YZiPkzxRuAgvVU=
96-
github.com/corazawaf/coraza/v3 v3.3.2 h1:eG1HPLySTR9lND6y6fPOajubwbuHRF6aXCsCtxyqKTY=
97-
github.com/corazawaf/coraza/v3 v3.3.2/go.mod h1:4EqMZkRoil11FnResCT/2JIg61dH+6D7F48VG8SVzuA=
9896
github.com/corazawaf/libinjection-go v0.2.2 h1:Chzodvb6+NXh6wew5/yhD0Ggioif9ACrQGR4qjTCs1g=
9997
github.com/corazawaf/libinjection-go v0.2.2/go.mod h1:OP4TM7xdJ2skyXqNX1AN1wN5nNZEmJNuWbNPOItn7aw=
10098
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
@@ -109,8 +107,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
109107
github.com/creack/pty v1.1.17/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
110108
github.com/creack/pty v1.1.21 h1:1/QdRyBaHHJP61QkWMXlOIBfsgdDeeKfK8SYVUWJKf0=
111109
github.com/creack/pty v1.1.21/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
112-
github.com/crowdsecurity/coraza/v3 v3.0.0-20250121111732-9b0043b679d7 h1:nIwAjapWmiQD3W/uAWYE3z+DC5Coy/zTyPBCJ379fAw=
113-
github.com/crowdsecurity/coraza/v3 v3.0.0-20250121111732-9b0043b679d7/go.mod h1:A+uciRXu+yhZcHMtM052bSM6vyJsMMU37NJN+tVoGqo=
110+
github.com/crowdsecurity/coraza/v3 v3.0.0-20250320231801-749b8bded21a h1:2Nyr+47Y/K68wohQWCrE7jKRIOpp6hJ29XCEQO3FhOw=
111+
github.com/crowdsecurity/coraza/v3 v3.0.0-20250320231801-749b8bded21a/go.mod h1:xSaXWOhFMSbrV8qOOfBKAyw3aOqfwaSaOy5BgSF8XlA=
114112
github.com/crowdsecurity/dlog v0.0.0-20170105205344-4fb5f8204f26 h1:r97WNVC30Uen+7WnLs4xDScS/Ex988+id2k6mDf8psU=
115113
github.com/crowdsecurity/dlog v0.0.0-20170105205344-4fb5f8204f26/go.mod h1:zpv7r+7KXwgVUZnUNjyP22zc/D7LKjyoY02weH2RBbk=
116114
github.com/crowdsecurity/go-cs-lib v0.0.16 h1:2/htodjwc/sfsv4deX8F/2Fzg1bOI8w3O1/BPSvvsB0=
@@ -121,8 +119,9 @@ github.com/crowdsecurity/machineid v1.0.2 h1:wpkpsUghJF8Khtmn/tg6GxgdhLA1Xflerh5
121119
github.com/crowdsecurity/machineid v1.0.2/go.mod h1:XWUSlnS0R0+u/JK5ulidwlbceNT3ZOCKteoVQEn6Luo=
122120
github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
123121
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
124-
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
125122
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
123+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
124+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
126125
github.com/dghubble/sling v1.4.2 h1:vs1HIGBbSl2SEALyU+irpYFLZMfc49Fp+jYryFebQjM=
127126
github.com/dghubble/sling v1.4.2/go.mod h1:o0arCOz0HwfqYQJLrRtqunaWOn4X6jxE/6ORKRpVTD4=
128127
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
@@ -588,8 +587,9 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
588587
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
589588
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
590589
github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
591-
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
592590
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
591+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
592+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
593593
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c h1:ncq/mPwQF4JjgDlrVEn3C11VoGHZN7m8qihwgMEtzYw=
594594
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
595595
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
@@ -804,8 +804,8 @@ golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5y
804804
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
805805
golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
806806
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
807-
golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc=
808-
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
807+
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
808+
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
809809
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
810810
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
811811
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
@@ -837,8 +837,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
837837
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
838838
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
839839
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
840-
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
841-
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
840+
golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c=
841+
golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
842842
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
843843
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
844844
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -848,8 +848,8 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ
848848
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
849849
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
850850
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
851-
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
852-
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
851+
golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw=
852+
golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
853853
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
854854
golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
855855
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -885,17 +885,17 @@ golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
885885
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
886886
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
887887
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
888-
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
889-
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
888+
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
889+
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
890890
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
891891
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
892892
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
893893
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
894894
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
895895
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
896896
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
897-
golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg=
898-
golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek=
897+
golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y=
898+
golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g=
899899
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
900900
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
901901
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
@@ -908,8 +908,8 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
908908
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
909909
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
910910
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
911-
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
912-
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
911+
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
912+
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
913913
golang.org/x/time v0.6.0 h1:eTDhh4ZXt5Qf0augr54TN6suAUudPcawVZeIAPU7D4U=
914914
golang.org/x/time v0.6.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
915915
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

Diff for: pkg/acquisition/modules/appsec/appsec_runner.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111
log "github.com/sirupsen/logrus"
1212
"gopkg.in/tomb.v2"
1313

14-
"github.com/crowdsecurity/coraza/v3"
15-
corazatypes "github.com/crowdsecurity/coraza/v3/types"
14+
"github.com/corazawaf/coraza/v3"
15+
corazatypes "github.com/corazawaf/coraza/v3/types"
1616

1717
// load body processors via init()
1818
_ "github.com/crowdsecurity/crowdsec/pkg/acquisition/modules/appsec/bodyprocessors"

Diff for: pkg/acquisition/modules/appsec/bodyprocessors/raw.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"strconv"
66
"strings"
77

8-
"github.com/crowdsecurity/coraza/v3/experimental/plugins"
9-
"github.com/crowdsecurity/coraza/v3/experimental/plugins/plugintypes"
8+
"github.com/corazawaf/coraza/v3/experimental/plugins"
9+
"github.com/corazawaf/coraza/v3/experimental/plugins/plugintypes"
1010
)
1111

1212
type rawBodyProcessor struct{}

Diff for: pkg/acquisition/modules/appsec/rx_operator.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88
"github.com/wasilibs/go-re2"
99
"github.com/wasilibs/go-re2/experimental"
1010

11-
"github.com/crowdsecurity/coraza/v3/experimental/plugins"
12-
"github.com/crowdsecurity/coraza/v3/experimental/plugins/plugintypes"
11+
"github.com/corazawaf/coraza/v3/experimental/plugins"
12+
"github.com/corazawaf/coraza/v3/experimental/plugins/plugintypes"
1313
)
1414

1515
type rx struct {

Diff for: pkg/acquisition/modules/appsec/utils.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111
"github.com/prometheus/client_golang/prometheus"
1212
log "github.com/sirupsen/logrus"
1313

14-
"github.com/crowdsecurity/coraza/v3/collection"
15-
"github.com/crowdsecurity/coraza/v3/types/variables"
14+
"github.com/corazawaf/coraza/v3/collection"
15+
"github.com/corazawaf/coraza/v3/types/variables"
1616
"github.com/crowdsecurity/go-cs-lib/ptr"
1717

1818
"github.com/crowdsecurity/crowdsec/pkg/alertcontext"

Diff for: pkg/acquisition/modules/http/http_test.go

+25-5
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,12 @@ basic_auth:
254254

255255
time.Sleep(1 * time.Second)
256256

257-
res, err := http.Get(fmt.Sprintf("%s/test", testHTTPServerAddr))
257+
ctx := t.Context()
258+
259+
req, err := http.NewRequestWithContext(ctx, http.MethodGet, testHTTPServerAddr + "/test", http.NoBody)
260+
require.NoError(t, err)
261+
262+
res, err := http.DefaultClient.Do(req)
258263
require.NoError(t, err)
259264
assert.Equal(t, http.StatusMethodNotAllowed, res.StatusCode)
260265

@@ -265,6 +270,8 @@ basic_auth:
265270
}
266271

267272
func TestStreamingAcquisitionUnknownPath(t *testing.T) {
273+
ctx := t.Context()
274+
268275
h := &HTTPSource{}
269276
_, _, tomb := SetupAndRunHTTPSource(t, h, []byte(`
270277
source: http
@@ -277,7 +284,10 @@ basic_auth:
277284

278285
time.Sleep(1 * time.Second)
279286

280-
res, err := http.Get(fmt.Sprintf("%s/unknown", testHTTPServerAddr))
287+
req, err := http.NewRequestWithContext(ctx, http.MethodGet, testHTTPServerAddr + "/unknown", http.NoBody)
288+
require.NoError(t, err)
289+
290+
res, err := http.DefaultClient.Do(req)
281291
require.NoError(t, err)
282292
assert.Equal(t, http.StatusNotFound, res.StatusCode)
283293

@@ -303,11 +313,15 @@ basic_auth:
303313

304314
client := &http.Client{}
305315

306-
resp, err := http.Post(fmt.Sprintf("%s/test", testHTTPServerAddr), "application/json", strings.NewReader("test"))
316+
req, err := http.NewRequestWithContext(ctx, http.MethodPost, testHTTPServerAddr + "/test", strings.NewReader("test"))
317+
require.NoError(t, err)
318+
req.Header.Set("Content-Type", "application/json")
319+
320+
resp, err := http.DefaultClient.Do(req)
307321
require.NoError(t, err)
308322
assert.Equal(t, http.StatusUnauthorized, resp.StatusCode)
309323

310-
req, err := http.NewRequestWithContext(ctx, http.MethodPost, fmt.Sprintf("%s/test", testHTTPServerAddr), strings.NewReader("test"))
324+
req, err = http.NewRequestWithContext(ctx, http.MethodPost, testHTTPServerAddr + "/test", strings.NewReader("test"))
311325
require.NoError(t, err)
312326
req.SetBasicAuth("test", "WrongPassword")
313327

@@ -553,6 +567,8 @@ timeout: 1s`), 0)
553567
}
554568

555569
func TestStreamingAcquisitionTLSHTTPRequest(t *testing.T) {
570+
ctx := t.Context()
571+
556572
h := &HTTPSource{}
557573
_, _, tomb := SetupAndRunHTTPSource(t, h, []byte(`
558574
source: http
@@ -566,7 +582,11 @@ tls:
566582

567583
time.Sleep(1 * time.Second)
568584

569-
resp, err := http.Post(fmt.Sprintf("%s/test", testHTTPServerAddr), "application/json", strings.NewReader("test"))
585+
req, err := http.NewRequestWithContext(ctx, http.MethodPost, testHTTPServerAddr + "/test", strings.NewReader("test"))
586+
require.NoError(t, err)
587+
req.Header.Set("Content-Type", "application/json")
588+
589+
resp, err := http.DefaultClient.Do(req)
570590
require.NoError(t, err)
571591

572592
assert.Equal(t, http.StatusBadRequest, resp.StatusCode)

0 commit comments

Comments
 (0)