Griesbacher / histou

Adds templates to Grafana in combination with nagflux
GNU General Public License v2.0
35 stars 16 forks source link

urldecode host and service #28

Closed jacobbaungard closed 5 years ago

jacobbaungard commented 5 years ago

In some scenarios I experienced the query which was sent to Influx, to include urlencoded strings. As a result data would not be fetched from the database correctly.

This commit ensures that the constants for HOST and SERVICE are urldecoded in order to avoid the above.

Signed-off-by: Jacob Hansen jhansen@op5.com

sni commented 5 years ago

wouldn't this lead to double decoded strings in most scenarios?

jacobbaungard commented 5 years ago

Where else are strings decoded?

As far as I know, if you feed an already decoded string to urldecode no transformations are done.

sni commented 5 years ago

according to http://php.net/manual/en/function.urldecode.php

Warning: The superglobals $_GET and $_REQUEST are already decoded. Using urldecode() on an element in $_GET or $_REQUEST could have unexpected and dangerous results.

using urldecode multiple times breaks existing setups and leads to unexpected values. Here is a simple example:

<?php
$test = "a%2Bz\n";
print urldecode($test);
print urldecode(urldecode($test));
?>

returns:

a+z
a z
jacobbaungard commented 5 years ago

Strange. In my quick setup I didn't get the values in a urldecoded format, I guess there are problems elsewere then.