Skip to content
This repository was archived by the owner on Aug 23, 2023. It is now read-only.

aliasSub does not support perl-style regex #1776

Closed
Dieterbe opened this issue Apr 16, 2020 · 3 comments
Closed

aliasSub does not support perl-style regex #1776

Dieterbe opened this issue Apr 16, 2020 · 3 comments

Comments

@Dieterbe
Copy link
Contributor

Apparently Graphite supports a query like:

aliasSub(metrictank.stats.docker-env.default.api.request.*.latency.median.gauge32,'(?!-[0-9]*-)-[0-9]','')

But metrictank does not.

It returns an error error parsing regexp: invalid or unsupported Perl syntax: '(?!'...

@woodsaj
Copy link
Member

woodsaj commented Apr 16, 2020

PCRE cant be used safely with untrusted users. Regex queries can be used to cause denial of service attacks (basically consume all the resources on the node handling the regex).

Golang uses RE2.
https://github.com/google/re2/wiki/WhyRE2

RE2 is safe, and significantly more performant than other regex implementations.

@Dieterbe
Copy link
Contributor Author

Note that as of #1778 this error is correctly classified as "bad request", and as such invokes the proxy to graphite (if enabled), and graphite handles it seamlessly, so the user doesn't have to notice anything.

@Dieterbe Dieterbe added feature and removed bug labels Apr 16, 2020
@stale
Copy link

stale bot commented Jul 15, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants