Skip to content

feat: add regexp.match to access request filter and where expressions#40568

Merged
nklaassen merged 1 commit intomasterfrom
nklaassen/request-threshold-parser
Apr 18, 2024
Merged

feat: add regexp.match to access request filter and where expressions#40568
nklaassen merged 1 commit intomasterfrom
nklaassen/request-threshold-parser

Conversation

@nklaassen
Copy link
Copy Markdown
Contributor

Closes #39740

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

…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
@github-actions
Copy link
Copy Markdown
Contributor

🤖 Vercel preview here: https://docs-fk7akoi32-goteleport.vercel.app/docs/ver/preview

Copy link
Copy Markdown
Contributor

@ptgott ptgott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving for docs

@nklaassen nklaassen added this pull request to the merge queue Apr 18, 2024
Merged via the queue into master with commit ec046e1 Apr 18, 2024
@nklaassen nklaassen deleted the nklaassen/request-threshold-parser branch April 18, 2024 00:35
@public-teleport-github-review-bot
Copy link
Copy Markdown

@nklaassen See the table below for backport results.

Branch Result
branch/v15 Create PR

@Mitsuwa
Copy link
Copy Markdown

Mitsuwa commented Apr 18, 2024

Thankyou!

@nklaassen
Copy link
Copy Markdown
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support substring matching in Review Thresholds

4 participants