oetiker / SmokePing

The Active Monitoring System
http://www.smokeping.org
GNU General Public License v2.0
1.38k stars 184 forks source link

Allow all characters in filter menu queries #407

Closed jlu5 closed 3 months ago

jlu5 commented 4 months ago

Context: on my instance, I label most locations as [CC] ISP Name, where CC is the country code of the target.

It's not clear to me why the filter menu only accepts some characters. Removing this restriction allows me to search for locations such as \[US, as well as ISPs with symbols in their name like "AT&T". (Currently, backslashes in a query seem to be ignored, so a query like \[US throws an error about the unmatched brace)

Alternatively, if the goal is to only support a subset of regex (performance reasons?), it would be nice to have an option to make all filter queries literal searches.

oetiker commented 4 months ago

even the way it is currently might actually be a security risk ... perl regular expressions are incredibly powerful, so allowing to specify a regular expression remotely is quite risky. so how about this

switch to offer a config switch to simply switch to string matching ? the magic is here.

https://github.com/oetiker/SmokePing/blob/98d1bd281098a9f391f97e759b83929c85727b4a/lib/Smokeping.pm#L768