Skip to content

Commit 6b47a7e

Browse files
committed
Merge remote-tracking branch 'upstream/main' into HEAD
2 parents 40fa4e3 + 86ab1ff commit 6b47a7e

40 files changed

+752
-661
lines changed

.github/workflows/ci.yaml

+9-5
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ env:
1919
envoyproxy/envoy:v1.29-latest
2020
envoyproxy/envoy:v1.28-latest
2121
envoyproxy/envoy-dev:latest
22-
istio/proxyv2:1.20.1
23-
istio/proxyv2:1.19.5
22+
istio/proxyv2:1.21.0
23+
istio/proxyv2:1.20.4
2424
2525
jobs:
2626
build:
@@ -89,9 +89,12 @@ jobs:
8989
name: ftw-envoy-logs
9090
path: build/ftw-envoy.log
9191

92+
- name: Set up QEMU
93+
uses: docker/setup-qemu-action@v3
94+
9295
- name: Set up Docker Buildx
9396
if: ${{ matrix.multiphase_eval=='true' }}
94-
uses: docker/setup-buildx-action@v2
97+
uses: docker/setup-buildx-action@v3
9598

9699
- name: Docker meta
97100
if: ${{ matrix.multiphase_eval=='true' }}
@@ -131,11 +134,12 @@ jobs:
131134

132135
- name: Build and push busybox based image
133136
if: ${{ matrix.multiphase_eval=='true' }}
134-
uses: docker/build-push-action@v3
137+
uses: docker/build-push-action@v5
135138
with:
136139
context: .
137140
push: ${{ github.event_name != 'pull_request' }}
138141
tags: ${{ steps.meta-busybox.outputs.tags }}
142+
platforms: linux/amd64,linux/arm64
139143
labels: ${{ steps.meta-busybox.outputs.labels }}
140144
cache-from: type=gha
141145
cache-to: type=gha,mode=max
@@ -144,7 +148,7 @@ jobs:
144148
145149
- name: Build and push
146150
if: ${{ matrix.multiphase_eval=='true' }}
147-
uses: docker/build-push-action@v3
151+
uses: docker/build-push-action@v5
148152
with:
149153
context: .
150154
push: ${{ github.event_name != 'pull_request' }}

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ For details and locally tweaking the configuration refer to [@recommended-conf](
167167

168168
In order to individually monitor envoy logs while performing requests, in another terminal you can run:
169169

170-
- Envoy logs: `docker-compose -f ./example/envoy/docker-compose.yml logs -f envoy-logs`.
171-
- Critical wasm (audit) logs: `docker-compose -f ./example/envoy/docker-compose.yml logs -f wasm-logs`
170+
- Envoy logs: `docker compose -f ./example/envoy/docker-compose.yml logs -f envoy-logs`.
171+
- Critical wasm (audit) logs: `docker compose -f ./example/envoy/docker-compose.yml logs -f wasm-logs`
172172

173173
The Envoy example comes also with a Grafana dashboard that can be accessed at `localhost:3000` (admin/admin) in order to monitor the memory consumption.
174174

ftw/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ RUN apk update && apk add curl
88
WORKDIR /workspace
99

1010
# TODO update when new CRS version is tagged: https://github.com/coreruleset/coreruleset/archive/refs/tags/v4.0.0-rc2.tar.gz
11-
ADD https://github.com/coreruleset/coreruleset/tarball/2b92d53ea708babbca8da06cd13decffbc9e31b5 /workspace/coreruleset/
12-
RUN cd coreruleset && tar -xf 2b92d53ea708babbca8da06cd13decffbc9e31b5 --strip-components 1
11+
ADD https://github.com/coreruleset/coreruleset/tarball/1d95422bb31983a5290720b7fb662ce3dd51f753 /workspace/coreruleset/
12+
RUN cd coreruleset && tar -xf 1d95422bb31983a5290720b7fb662ce3dd51f753 --strip-components 1
1313

1414
COPY ftw.yml /workspace/ftw.yml
1515
COPY tests.sh /workspace/tests.sh

ftw/ftw.yml

+11-5
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ testoverride:
1212
'920100-10': 'Invalid HTTP method. Rejected by Envoy with Error 400'
1313
'920100-14': 'Invalid HTTP method. Rejected by Envoy with Error 400'
1414
'920100-16': 'Invalid HTTP request line. Rejected by Envoy with Error 400'
15-
'949110-4': 'Related to 920100. Invalid HTTP method. Rejected by Envoy with Error 400'
16-
'941110-4': 'Referer header is sanitized by Envoy and removed from the request'
17-
'941101-1': 'Referer header is sanitized by Envoy and removed from the request'
1815
'920210-2': 'Connection header is stripped out by Envoy'
1916
'920210-3': 'Connection header is stripped out by Envoy'
2017
'920210-4': 'Connection header is stripped out by Envoy'
@@ -28,9 +25,18 @@ testoverride:
2825
'932161-10': 'Referer header is sanitized by Envoy and removed from the request'
2926
'932161-11': 'Referer header is sanitized by Envoy and removed from the request'
3027
'932161-12': 'Referer header is sanitized by Envoy and removed from the request'
28+
'932237-8': 'Referer header is sanitized by Envoy and removed from the request'
29+
'932237-18': 'Referer header is sanitized by Envoy and removed from the request'
3130
'932239-6': 'Referer header is sanitized by Envoy and removed from the request'
3231
'932239-7': 'Referer header is sanitized by Envoy and removed from the request'
3332
'932239-19': 'Referer header is sanitized by Envoy and removed from the request'
33+
'932239-27': 'Referer header is sanitized by Envoy and removed from the request'
34+
'932239-29': 'Referer header is sanitized by Envoy and removed from the request'
35+
'941101-1': 'Referer header is sanitized by Envoy and removed from the request'
36+
'941110-4': 'Referer header is sanitized by Envoy and removed from the request'
37+
'949110-4': 'Related to 920100. Invalid HTTP method. Rejected by Envoy with Error 400'
38+
'920181-1': 'Content-Length with Transfer-Encoding chunked is rejected by Envoy with Error 400'
39+
'932260-28': 'test bug, fixed upstream https://github.com/coreruleset/coreruleset/pull/3580'
3440

3541
# Rules working, tests excluded for different expected output
3642
'920270-4': 'Log contains 920270. Test has log_contains disabled.'
@@ -50,5 +56,5 @@ testoverride:
5056
'934120-26': 'Rule 934120 partially detected. With HTTP/1.1 Envoy return 400. With HTTP/2 Enclosed alphanumerics not detected. Coraza Side'
5157
'934120-39': 'Rule 934120 partially detected. With HTTP/1.1 Envoy return 400. With HTTP/2 Enclosed alphanumerics not detected. Coraza Side'
5258
'932200-13': 'Unfortunate match inside logs against a different rule log. wip'
53-
'934131-5': 'See https://github.com/corazawaf/coraza/pull/899'
54-
'934131-7': 'See https://github.com/corazawaf/coraza/pull/899'
59+
'942440-19': 'Coraza side: Seems like ARGS is not splitted in _GET and _POST in ruleRemoveTargetById. Further investigation needed.'
60+
'942440-20': 'Coraza side: Seems like ARGS is not splitted in _GET and _POST in ruleRemoveTargetById. Further investigation needed.'

magefiles/loadtest.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ func LoadTest() error {
2929
}
3030

3131
func doLoadTest(conf string, payloadSize int, threads int) error {
32-
if err := sh.RunV("docker-compose", "--file", "ftw/docker-compose.yml", "build", "--pull"); err != nil {
32+
if err := sh.RunV("docker", "compose", "--file", "ftw/docker-compose.yml", "build", "--pull"); err != nil {
3333
return err
3434
}
3535
defer func() {
36-
_ = sh.RunV("docker-compose", "--file", "ftw/docker-compose.yml", "kill")
37-
_ = sh.RunV("docker-compose", "--file", "ftw/docker-compose.yml", "down", "-v")
36+
_ = sh.RunV("docker", "compose", "--file", "ftw/docker-compose.yml", "kill")
37+
_ = sh.RunV("docker", "compose", "--file", "ftw/docker-compose.yml", "down", "-v")
3838
}()
39-
if err := sh.RunWithV(map[string]string{"ENVOY_CONFIG": fmt.Sprintf("/conf/%s", conf)}, "docker-compose",
39+
if err := sh.RunWithV(map[string]string{"ENVOY_CONFIG": fmt.Sprintf("/conf/%s", conf)}, "docker", "compose",
4040
"--file", "ftw/docker-compose.yml", "run", "--service-ports", "--rm", "-d", "envoy"); err != nil {
4141
return err
4242
}

magefiles/magefile.go

+14-14
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,14 @@ func Build() error {
223223
return patchWasm(filepath.Join("build", "mainraw.wasm"), filepath.Join("build", "main.wasm"), initialPages)
224224
}
225225

226-
// E2e runs e2e tests with a built plugin against the example deployment. Requires docker-compose.
226+
// E2e runs e2e tests with a built plugin against the example deployment. Requires docker.
227227
func E2e() error {
228228
var err error
229-
if err = sh.RunV("docker-compose", "--file", "e2e/docker-compose.yml", "up", "-d", "envoy"); err != nil {
229+
if err = sh.RunV("docker", "compose", "--file", "e2e/docker-compose.yml", "up", "-d", "envoy"); err != nil {
230230
return err
231231
}
232232
defer func() {
233-
_ = sh.RunV("docker-compose", "--file", "e2e/docker-compose.yml", "down", "-v")
233+
_ = sh.RunV("docker", "compose", "--file", "e2e/docker-compose.yml", "down", "-v")
234234
}()
235235

236236
envoyHost := os.Getenv("ENVOY_HOST")
@@ -245,18 +245,18 @@ func E2e() error {
245245
// --nulled-body is needed because coraza-proxy-wasm returns a 200 OK with a nulled body when if the interruption happens after phase 3
246246
if err = sh.RunV("go", "run", "github.com/corazawaf/coraza/v3/http/e2e/cmd/httpe2e@main", "--proxy-hostport",
247247
"http://"+envoyHost, "--httpbin-hostport", "http://"+httpbinHost, "--nulled-body"); err != nil {
248-
sh.RunV("docker-compose", "-f", "e2e/docker-compose.yml", "logs", "envoy")
248+
sh.RunV("docker", "compose", "-f", "e2e/docker-compose.yml", "logs", "envoy")
249249
}
250250
return err
251251
}
252252

253-
// Ftw runs ftw tests with a built plugin and Envoy. Requires docker-compose.
253+
// Ftw runs ftw tests with a built plugin and Envoy. Requires docker.
254254
func Ftw() error {
255-
if err := sh.RunV("docker-compose", "--file", "ftw/docker-compose.yml", "build", "--pull"); err != nil {
255+
if err := sh.RunV("docker", "compose", "--file", "ftw/docker-compose.yml", "build", "--pull"); err != nil {
256256
return err
257257
}
258258
defer func() {
259-
_ = sh.RunV("docker-compose", "--file", "ftw/docker-compose.yml", "down", "-v")
259+
_ = sh.RunV("docker", "compose", "--file", "ftw/docker-compose.yml", "down", "-v")
260260
}()
261261
env := map[string]string{
262262
"FTW_CLOUDMODE": os.Getenv("FTW_CLOUDMODE"),
@@ -270,22 +270,22 @@ func Ftw() error {
270270
if os.Getenv("MEMSTATS") == "true" {
271271
task = "ftw-memstats"
272272
}
273-
return sh.RunWithV(env, "docker-compose", "--file", "ftw/docker-compose.yml", "run", "--rm", task)
273+
return sh.RunWithV(env, "docker", "compose", "--file", "ftw/docker-compose.yml", "run", "--rm", task)
274274
}
275275

276-
// RunEnvoyExample spins up the test environment of envoy, access at http://localhost:8080. Requires docker-compose.
276+
// RunEnvoyExample spins up the test environment of envoy, access at http://localhost:8080. Requires docker.
277277
func RunEnvoyExample() error {
278-
return sh.RunWithV(map[string]string{"ENVOY_IMAGE": os.Getenv("ENVOY_IMAGE")}, "docker-compose", "--file", "example/envoy/docker-compose.yml", "up")
278+
return sh.RunWithV(map[string]string{"ENVOY_IMAGE": os.Getenv("ENVOY_IMAGE")}, "docker", "compose", "--file", "example/envoy/docker-compose.yml", "up")
279279
}
280280

281-
// TeardownEnvoyExample tears down the test environment of envoy. Requires docker-compose.
281+
// TeardownEnvoyExample tears down the test environment of envoy. Requires docker.
282282
func TeardownEnvoyExample() error {
283-
return sh.RunV("docker-compose", "--file", "example/envoy/docker-compose.yml", "down")
283+
return sh.RunV("docker", "compose", "--file", "example/envoy/docker-compose.yml", "down")
284284
}
285285

286-
// ReloadEnvoyExample reload the test environment (container) of envoy in case of envoy or wasm update. Requires docker-compose
286+
// ReloadEnvoyExample reload the test environment (container) of envoy in case of envoy or wasm update. Requires docker.
287287
func ReloadEnvoyExample() error {
288-
return sh.RunV("docker-compose", "--file", "example/envoy/docker-compose.yml", "restart")
288+
return sh.RunV("docker", "compose", "--file", "example/envoy/docker-compose.yml", "restart")
289289
}
290290

291291
var Default = Build

wasmplugin/rules/crs-setup.conf.example

+7-22
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# ------------------------------------------------------------------------
2-
# OWASP ModSecurity Core Rule Set ver.4.0.0-rc2
2+
# OWASP CRS ver.4.0.0
33
# Copyright (c) 2006-2020 Trustwave and contributors. All rights reserved.
4-
# Copyright (c) 2021-2023 Core Rule Set project. All rights reserved.
4+
# Copyright (c) 2021-2024 CRS project. All rights reserved.
55
#
6-
# The OWASP ModSecurity Core Rule Set is distributed under
6+
# The OWASP CRS is distributed under
77
# Apache Software License (ASL) version 2
88
# Please see the enclosed LICENSE file for full details.
99
# ------------------------------------------------------------------------
@@ -12,7 +12,7 @@
1212
#
1313
# -- [[ Introduction ]] --------------------------------------------------------
1414
#
15-
# The OWASP ModSecurity Core Rule Set (CRS) is a set of generic attack
15+
# The OWASP CRS is a set of generic attack
1616
# detection rules that provide a base level of protection for any web
1717
# application. They are written for the open source, cross-platform
1818
# ModSecurity Web Application Firewall.
@@ -619,6 +619,8 @@ SecAction \
619619
# Block request if number of arguments is too high
620620
# Default: unlimited
621621
# Example: 255
622+
# Note that a hard limit by the engine may also apply here (SecArgumentsLimit).
623+
# This would override this soft limit.
622624
# Uncomment this rule to set a limit.
623625
#SecAction \
624626
# "id:900300,\
@@ -692,7 +694,7 @@ SecAction \
692694
#
693695
# -- [[ Easing In / Sampling Percentage ]] -------------------------------------
694696
#
695-
# Adding the Core Rule Set to an existing productive site can lead to false
697+
# Adding the CRS to an existing productive site can lead to false
696698
# positives, unexpected performance issues and other undesired side effects.
697699
#
698700
# It can be beneficial to test the water first by enabling the CRS for a
@@ -746,23 +748,6 @@ SecAction \
746748
# setvar:tx.crs_validate_utf8_encoding=1"
747749

748750

749-
#
750-
# -- [[ Collection timeout ]] --------------------------------------------------
751-
#
752-
# Set the SecCollectionTimeout directive from the ModSecurity default (1 hour)
753-
# to a lower setting which is appropriate to most sites.
754-
# This increases performance by cleaning out stale collection (block) entries.
755-
#
756-
# This value should be greater than or equal to any block durations or timeouts
757-
# set by plugins that make use of ModSecurity's persistent collections (e.g. the
758-
# DoS protection and IP reputation plugins).
759-
#
760-
# Ref: https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual-(v2.x)#SecCollectionTimeout
761-
762-
# Please keep this directive uncommented.
763-
# Default: 600 (10 minutes)
764-
SecCollectionTimeout 600
765-
766751

767752
#
768753
# -- [[ End of setup ]] --------------------------------------------------------

wasmplugin/rules/crs/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.conf.example

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)