[maistra-1.1] MAISTRA-224: Support for authorisation regex matching on request headers #65
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.
This adds back the regex matching on request headers functionality we introduced in #3. I changed it to use the SafeRegex matchers introduced in newer Envoy versions to mitigate the Regex matching CVE.
Upstream, there's a feature flag
PILOT_ENABLE_UNSAFE_REGEX=false
that by default sets SafeRegex as the default but provides a fall-back for users who cannot change their regular expressions to be compatible with RE2. While this is a sensible migration strategy, I think we should not do the same, for multiple reasons:libstdc++::regex
, we however are stuck withstd::regex
.So there are two approaches here; I suggest we follow 1:
This is my preferred approach and is followed in this PR: no feature flag is read. A follow-up PR will be needed to remove the feature flag from Route generation.
This would need changes in this PR (adding an if-clause).