Skip to content

Commit

Permalink
fix(metrics): adjust regex to avoid exponential backtracking (#34881)
Browse files Browse the repository at this point in the history
* fix(redos): adjust regex to avoid exponential backtracking

* remove 3rd capture group

Co-authored-by: Ahmed Etefy <ahmed.etefy12@gmail.com>
  • Loading branch information
mdtro and ahmedetefy committed May 24, 2022
1 parent ae49d44 commit 5aa0283
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sentry/snuba/metrics/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@

#: Max number of data points per time series:
# ToDo modify this regex to only support the operations provided
FIELD_REGEX = re.compile(r"^(\w+)\(((\w|\.|_|\:|\/|\@)+)\)$")
TAG_REGEX = re.compile(r"^(\w|\.|_)+$")
FIELD_REGEX = re.compile(r"^(\w+)\(([\w.:/@]+)\)$")
TAG_REGEX = re.compile(r"^([\w.]+)$")

#: A function that can be applied to a metric
MetricOperationType = Literal[
Expand Down

0 comments on commit 5aa0283

Please sign in to comment.