feat: add regexp.match to access request filter and where expressions#40568
Merged
feat: add regexp.match to access request filter and where expressions#40568
regexp.match to access request filter and where expressions#40568Conversation
…ssions This PR updates the parsers for the role `spec.allow.request.thresholds.filter` and `spec.allow.review.where` expression fields to support a new function `regexp.match(list, re)`. It follows the typical teleport style following from role templates, `where` expressions, login rules, and label expressions: - `list` can be a `[]string` or a `string` (a single string is treated as a list of length 1). - `re` can be a glob pattern like `example-*` or a proper regex like `^example-.*$` when surrounded by `^$`. Some examples are included in the docs and tests. I have switched from using `NewJSONBoolParser` to new dedicated parsers based on `typical`. These should have better performance in terms of speed and memory, be easier to extend in the future, and provide better error messages when users write invalid expressions. These were the only uses of `NewJSONBoolParser`, so it has been removed. Changelog: add `regexp.match` to access request `filter` and `where` expressions
Contributor
|
🤖 Vercel preview here: https://docs-fk7akoi32-goteleport.vercel.app/docs/ver/preview |
zmb3
approved these changes
Apr 16, 2024
|
@nklaassen See the table below for backport results.
|
|
Thankyou! |
Contributor
Author
|
@Mitsuwa you're welcome! This should go out in 15.2.3, you'll need to upgrade your auth service to that version and then it will be usable |
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
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.
Closes #39740
This PR updates the parsers for the role
spec.allow.request.thresholds.filterandspec.allow.review.whereexpression fields to support a new functionregexp.match(list, re).It follows the typical teleport style following from role templates,
whereexpressions, login rules, and label expressions:listcan be a[]stringor astring(a single string is treated as a list of length 1).recan be a glob pattern likeexample-*or a proper regex like^example-.*$when surrounded by^$.Some examples are included in the docs and tests.
I have switched from using
NewJSONBoolParserto new dedicated parsers based ontypical. These should have better performance in terms of speed and memory, be easier to extend in the future, and provide better error messages when users write invalid expressions.These were the only uses of
NewJSONBoolParser, so it has been removed.Changelog: add
regexp.matchto access requestfilterandwhereexpressions