-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(e2e): swaps e2e with the official Coraza ones, updates Go to 1.20 #224
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ on: | |
- cron: "0 4 * * *" | ||
|
||
env: | ||
GO_VERSION: 1.19 | ||
GO_VERSION: '1.20' | ||
TINYGO_VERSION: 0.28.1 | ||
|
||
jobs: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,18 @@ | ||
services: | ||
httpbin: | ||
image: mccutchen/go-httpbin:v2.5.0 | ||
image: mccutchen/go-httpbin:v2.9.0 | ||
command: [ "/bin/go-httpbin", "-port", "8081" ] | ||
ports: | ||
- 8081:8081 | ||
envoy: | ||
depends_on: | ||
- httpbin | ||
image: ${ENVOY_IMAGE:-envoyproxy/envoy:v1.23-latest} | ||
image: ${ENVOY_IMAGE:-envoyproxy/envoy:v1.27-latest} | ||
command: | ||
- -c | ||
- /conf/envoy-config.yaml | ||
volumes: | ||
- ../build:/build | ||
- ../example:/conf # relying on envoy-config file from /example/ | ||
tests: | ||
depends_on: | ||
- envoy | ||
build: | ||
context: . | ||
dockerfile: ./Dockerfile.curl | ||
- .:/conf | ||
ports: | ||
- 8080:8080 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
stats_config: | ||
stats_tags: | ||
# Envoy extracts the first matching group as a value. | ||
# See https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/metrics/v3/stats.proto#config-metrics-v3-statsconfig. | ||
- tag_name: phase | ||
regex: "(_phase=([a-z_]+))" | ||
- tag_name: rule_id | ||
regex: "(_ruleid=([0-9]+))" | ||
- tag_name: identifier | ||
regex: "(_identifier=([0-9a-z.:]+))" | ||
- tag_name: owner | ||
regex: "(_owner=([0-9a-z.:]+))" | ||
- tag_name: authority | ||
regex: "(_authority=([0-9a-z.:]+))" | ||
|
||
static_resources: | ||
listeners: | ||
- address: | ||
socket_address: | ||
address: 0.0.0.0 | ||
port_value: 8080 | ||
filter_chains: | ||
- filters: | ||
- name: envoy.filters.network.http_connection_manager | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager | ||
stat_prefix: ingress_http | ||
codec_type: auto | ||
route_config: | ||
# A custom response header is added for e2e testing purposes. A local response, triggered by an interruption, | ||
# has to allow custom added headers like this. See https://github.com/corazawaf/coraza-proxy-wasm/pull/172 | ||
response_headers_to_add: | ||
- header: | ||
key: "custom_header" | ||
value: "custom_value" | ||
virtual_hosts: | ||
- name: local_route | ||
domains: | ||
- "*" | ||
routes: | ||
- match: | ||
prefix: "/" | ||
route: | ||
cluster: local_server | ||
http_filters: | ||
- name: envoy.filters.http.wasm | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.extensions.filters.http.wasm.v3.Wasm | ||
config: | ||
name: "coraza-filter" | ||
root_id: "" | ||
configuration: | ||
"@type": "type.googleapis.com/google.protobuf.StringValue" | ||
# See https://github.com/corazawaf/coraza/blob/main/http/e2e/cmd/httpe2e/main.go#L22 for e2e Coraza directives | ||
value: | | ||
{ | ||
"directives_map": { | ||
"rs1": [ | ||
"SecRuleEngine On", | ||
"SecRequestBodyAccess On", | ||
"SecResponseBodyAccess On", | ||
"SecResponseBodyMimeType application/json", | ||
"SecRule &REQUEST_HEADERS:coraza-e2e \"@eq 0\" \"id:100,phase:1,deny,status:424,log,msg:'Coraza E2E - Missing header'\"", | ||
"SecRule REQUEST_URI \"@streq /admin\" \"id:101,phase:1,t:lowercase,log,deny,status:403\"", | ||
"SecRule REQUEST_BODY \"@rx maliciouspayload\" \"id:102,phase:2,t:lowercase,log,deny,status:403\"", | ||
"SecRule RESPONSE_HEADERS:pass \"@rx leak\" \"id:103,phase:3,t:lowercase,log,deny,status:403\"", | ||
"SecRule RESPONSE_BODY \"@contains responsebodycode\" \"id:104,phase:4,t:lowercase,log,deny,status:403\"", | ||
"SecRule ARGS_NAMES|ARGS \"@detectXSS\" \"id:9411,phase:2,t:none,t:utf8toUnicode,t:urlDecodeUni,t:htmlEntityDecode,t:jsDecode,t:cssDecode,t:removeNulls,log,deny,status:403\"", | ||
"SecRule ARGS_NAMES|ARGS \"@detectSQLi\" \"id:9421,phase:2,t:none,t:utf8toUnicode,t:urlDecodeUni,t:removeNulls,multiMatch,log,deny,status:403\"", | ||
"SecRule REQUEST_HEADERS:User-Agent \"@pm grabber masscan\" \"id:9131,phase:1,t:none,log,deny,status:403\"" | ||
] | ||
}, | ||
"default_directives": "rs1", | ||
"metric_labels": { | ||
"owner": "coraza", | ||
"identifier": "global" | ||
} | ||
} | ||
vm_config: | ||
runtime: "envoy.wasm.runtime.v8" | ||
vm_id: "my_vm_id" | ||
code: | ||
local: | ||
filename: "build/main.wasm" | ||
- name: envoy.filters.http.router | ||
typed_config: | ||
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router | ||
|
||
clusters: | ||
- name: local_server | ||
connect_timeout: 6000s | ||
type: STRICT_DNS | ||
lb_policy: ROUND_ROBIN | ||
load_assignment: | ||
cluster_name: local_server | ||
endpoints: | ||
- lb_endpoints: | ||
- endpoint: | ||
address: | ||
socket_address: | ||
address: httpbin | ||
port_value: 8081 | ||
|
||
admin: | ||
access_log_path: "/dev/null" | ||
address: | ||
socket_address: | ||
address: 0.0.0.0 | ||
port_value: 8082 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Source: https://github.com/actions/setup-go#v3