| 1 |
syntax = "proto3"; |
| 2 |
|
| 3 |
package xds.type.matcher.v3; |
| 4 |
|
| 5 |
import "validate/validate.proto"; |
| 6 |
|
| 7 |
option java_package = "com.github.xds.type.matcher.v3"; |
| 8 |
option java_outer_classname = "RegexProto"; |
| 9 |
option java_multiple_files = true; |
| 10 |
option go_package = "github.com/cncf/xds/go/xds/type/matcher/v3"; |
| 11 |
|
| 12 |
// [#protodoc-title: Regex matcher] |
| 13 |
|
| 14 |
// A regex matcher designed for safety when used with untrusted input. |
| 15 |
message RegexMatcher { |
| 16 |
// Google's `RE2 <https://github.com/google/re2>`_ regex engine. The regex |
| 17 |
// string must adhere to the documented `syntax |
| 18 |
// <https://github.com/google/re2/wiki/Syntax>`_. The engine is designed to |
| 19 |
// complete execution in linear time as well as limit the amount of memory |
| 20 |
// used. |
| 21 |
// |
| 22 |
// Envoy supports program size checking via runtime. The runtime keys |
| 23 |
// `re2.max_program_size.error_level` and `re2.max_program_size.warn_level` |
| 24 |
// can be set to integers as the maximum program size or complexity that a |
| 25 |
// compiled regex can have before an exception is thrown or a warning is |
| 26 |
// logged, respectively. `re2.max_program_size.error_level` defaults to 100, |
| 27 |
// and `re2.max_program_size.warn_level` has no default if unset (will not |
| 28 |
// check/log a warning). |
| 29 |
// |
| 30 |
// Envoy emits two stats for tracking the program size of regexes: the |
| 31 |
// histogram `re2.program_size`, which records the program size, and the |
| 32 |
// counter `re2.exceeded_warn_level`, which is incremented each time the |
| 33 |
// program size exceeds the warn level threshold. |
| 34 |
message GoogleRE2 {} |
| 35 |
|
| 36 |
oneof engine_type { |
| 37 |
option (validate.required) = true; |
| 38 |
|
| 39 |
// Google's RE2 regex engine. |
| 40 |
GoogleRE2 google_re2 = 1 [ (validate.rules).message = {required : true} ]; |
| 41 |
} |
| 42 |
|
| 43 |
// The regex match string. The string must be supported by the configured |
| 44 |
// engine. |
| 45 |
string regex = 2 [ (validate.rules).string = {min_len : 1} ]; |
| 46 |
} |