forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Syncing anuraaga's main before donation (envoyproxy#8)
* Allow building filter in mode that prints timing of each lifecycle me… (envoyproxy#33) …thod * Add variables for running FTW in cloud mode with envoy wasm disabled (envoyproxy#34) * Switch FTW backend to faster server (envoyproxy#35) * Try adding -crt-static to rust build (envoyproxy#36) * Build wasi-libc for TinyGo instead of using wasi SDK (envoyproxy#37) * Fix aho-corasick wasm lib and use it for pm (envoyproxy#38) * Update to latest coraza (envoyproxy#39) * Move cgo declaration to tinygo build tag to prevent warning when runn… (envoyproxy#40) …ing tests * Remove year from copyright header Co-authored-by: Anuraag Agrawal <[email protected]>
- Loading branch information
Showing
34 changed files
with
391 additions
and
123 deletions.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
static_resources: | ||
listeners: | ||
- address: | ||
socket_address: | ||
address: 0.0.0.0 | ||
port_value: 80 | ||
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 | ||
http_protocol_options: | ||
accept_http_10: true | ||
route_config: | ||
virtual_hosts: | ||
- name: local_route | ||
domains: | ||
- "*" | ||
routes: | ||
- match: | ||
prefix: "/" | ||
route: | ||
cluster: local_server | ||
http_filters: | ||
- 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: 80 |
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
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,9 @@ | ||
// Copyright The OWASP Coraza contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//go:build tinygo | ||
|
||
package main | ||
|
||
// #cgo LDFLAGS: lib/libinjection.a lib/libre2.a lib/libcre2.a lib/libc++.a lib/libc++abi.a lib/libclang_rt.builtins-wasm32.a lib/libaho_corasick.a | ||
import "C" |
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
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright The OWASP Coraza contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//go:build tinygo | ||
|
||
package operators | ||
|
||
import ( | ||
"errors" | ||
"io/fs" | ||
"os" | ||
"path" | ||
) | ||
|
||
var errEmptyPaths = errors.New("empty paths") | ||
|
||
func loadFromFile(filepath string, paths []string, root fs.FS) ([]byte, error) { | ||
if path.IsAbs(filepath) { | ||
return fs.ReadFile(root, filepath) | ||
} | ||
|
||
if len(paths) == 0 { | ||
return nil, errEmptyPaths | ||
} | ||
|
||
// handling files by operators is hard because we must know the paths where we can | ||
// search, for example, the policy path or the binary path... | ||
// CRS stores the .data files in the same directory as the directives | ||
var ( | ||
content []byte | ||
err error | ||
) | ||
|
||
for _, p := range paths { | ||
absFilepath := path.Join(p, filepath) | ||
content, err = fs.ReadFile(root, absFilepath) | ||
if err != nil { | ||
if os.IsNotExist(err) { | ||
continue | ||
} else { | ||
return nil, err | ||
} | ||
} | ||
|
||
return content, nil | ||
} | ||
|
||
return nil, err | ||
} |
Oops, something went wrong.