-
Notifications
You must be signed in to change notification settings - Fork 5.3k
introduce safe regex matcher based on re2 engine #7878
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
Merged
Merged
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
ec6e30a
introduce safe regex matcher based on re2 engine
mattklein123 52fe33b
fix
mattklein123 e2ce809
fix
mattklein123 876c6e6
fix
mattklein123 2da7fc2
more fix
mattklein123 b5100cb
Merge remote-tracking branch 'origin/master' into safe_regex
mattklein123 9a5df74
fix
mattklein123 a191481
Merge remote-tracking branch 'origin/master' into safe_regex
mattklein123 7646e3e
Merge branch 'master' into safe_regex
mattklein123 0a7ad69
fix
mattklein123 befef2b
Merge remote-tracking branch 'origin/master' into safe_regex
mattklein123 f2a25ea
more
mattklein123 85d6b06
format
mattklein123 c8f60b2
fix
mattklein123 be16355
fix
mattklein123 c7abb14
fix
mattklein123 25aa583
fix and merge
mattklein123 c6a4775
Merge remote-tracking branch 'origin/master' into safe_regex
mattklein123 1107252
more
mattklein123 0956d5a
Merge remote-tracking branch 'origin/master' into safe_regex
mattklein123 718c4f2
checkpoint
mattklein123 1cec838
Merge remote-tracking branch 'origin/master' into safe_regex
mattklein123 9237720
more
mattklein123 c98c32f
more
mattklein123 f3543b5
more
mattklein123 8381588
comment
mattklein123 ed82996
fix
mattklein123 a038234
Merge remote-tracking branch 'origin/master' into safe_regex
mattklein123 03544f7
Merge branch 'master' into safe_regex
mattklein123 462454e
comments
mattklein123 65102e4
Merge remote-tracking branch 'origin/master' into safe_regex
mattklein123 17f9579
comments
mattklein123 24f0fcf
fix
mattklein123 866d1d5
Merge remote-tracking branch 'origin/master' into safe_regex
mattklein123 a717ecf
fix
mattklein123 f2657e5
Merge remote-tracking branch 'origin/master' into safe_regex
mattklein123 b825b9a
comment
mattklein123 138f596
Merge remote-tracking branch 'origin/master' into safe_regex
mattklein123 b82ca63
fix
mattklein123 83f53ae
Merge remote-tracking branch 'origin/master' into safe_regex
mattklein123 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,37 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package envoy.type.matcher; | ||
|
|
||
| option java_outer_classname = "StringProto"; | ||
| option java_multiple_files = true; | ||
| option java_package = "io.envoyproxy.envoy.type.matcher"; | ||
| option go_package = "matcher"; | ||
|
|
||
| import "google/protobuf/wrappers.proto"; | ||
| import "validate/validate.proto"; | ||
|
|
||
| // [#protodoc-title: RegexMatcher] | ||
|
|
||
| // A regex matcher designed for safety when used with untrusted input. | ||
| message RegexMatcher { | ||
| // Google's `RE2 <https://github.com/google/re2>`_ regex engine. The regex string must adhere to | ||
| // the documented `syntax <https://github.com/google/re2/wiki/Syntax>`_. The engine is designed | ||
| // to complete execution in linear time as well as limit the amount of memory used. | ||
| message GoogleRE2 { | ||
| // This field controls the RE2 "program size" which is a rough estimate of how complex a | ||
| // compiled regex is to evaluate. A regex that has a program size greater than the configured | ||
| // value will fail to compile. In this case, the configured max program size can be increased | ||
| // or the regex can be simplified. If not specified, the default is 100. | ||
| google.protobuf.UInt32Value max_program_size = 1; | ||
| } | ||
|
|
||
| oneof engine_type { | ||
| option (validate.required) = true; | ||
|
|
||
| // Google's RE2 regex engine. | ||
| GoogleRE2 google_re2 = 1 [(validate.rules).message.required = true]; | ||
| } | ||
|
|
||
| // The regex match string. The string must be supported by the configured engine. | ||
htuch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| string regex = 2 [(validate.rules).string.min_bytes = 1]; | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.