-
Notifications
You must be signed in to change notification settings - Fork 690
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
internal/envoy: switch to safe regex for path match #1913
Merged
Merged
Conversation
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
Updates projectcontour#1351 Switch path regex matching to safe regex. Refactor matcher.RegexMatcher code to its own file and helper so it can be reused across internal/envoy and internal/contour. Also of note, internal/contour longestRouteFirst comparator has intimate knowledge of RouteMatch_SafeRegex which is probably not ideal. Signed-off-by: Dave Cheney <dave@cheney.net>
Also fixes: #1513 |
stevesloka
approved these changes
Nov 22, 2019
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.
/lgtm
davecheney
added a commit
to davecheney/contour
that referenced
this pull request
Nov 24, 2019
Updates projectcontour#1351 Prior to projectcontour#1882 the envoy package offered two ways to construct a Prefix/Regex match -- the first was a direct call to RoutePrefix/RouteRegex which took a string parameter, the second was via RouteMatch which took a dag.Route object. projectcontour#1882 refactored RouteMatch on top of RoutePrefix/RouteRegex which consolidated on one method of constructing a regex match, projectcontour#1913 later took advatage of this to update all uses of regex to safe regex. However there still existed two ways to construct a matcher, one via a direct call to RoutePrefix/RouteRegex the other via RouteMatch. It turns out that all the test code used the former, and all the production code used the latter, implying that RoutePrefix/RouteRegex were test helpers. This PR removes RouteRegex/RoutePrefix and replaces their calls in test code with helpers that construct the respective *dag.Route object and passes that to RouteMatch. Signed-off-by: Dave Cheney <dave@cheney.net>
davecheney
added a commit
that referenced
this pull request
Nov 25, 2019
Updates #1351 Prior to #1882 the envoy package offered two ways to construct a Prefix/Regex match -- the first was a direct call to RoutePrefix/RouteRegex which took a string parameter, the second was via RouteMatch which took a dag.Route object. #1882 refactored RouteMatch on top of RoutePrefix/RouteRegex which consolidated on one method of constructing a regex match, #1913 later took advatage of this to update all uses of regex to safe regex. However there still existed two ways to construct a matcher, one via a direct call to RoutePrefix/RouteRegex the other via RouteMatch. It turns out that all the test code used the former, and all the production code used the latter, implying that RoutePrefix/RouteRegex were test helpers. This PR removes RouteRegex/RoutePrefix and replaces their calls in test code with helpers that construct the respective *dag.Route object and passes that to RouteMatch. Signed-off-by: Dave Cheney <dave@cheney.net>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Updates #1351
Fixes #1513
Switch path regex matching to safe regex. Refactor matcher.RegexMatcher
code to its own file and helper so it can be reused across
internal/envoy and internal/contour.
Also of note, internal/contour longestRouteFirst comparator has intimate
knowledge of RouteMatch_SafeRegex which is probably not ideal.
Signed-off-by: Dave Cheney dave@cheney.net