diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2018-11-25 16:33:08 +0300 |
---|---|---|
committer | Stefan Giehl <stefan@piwik.org> | 2018-11-25 16:33:08 +0300 |
commit | 2862316a05301755681305fbe060591c08d8c265 (patch) | |
tree | 84c2cf594a139f743f2dfee58ebd8175522e64d3 /plugins/UserCountry | |
parent | 762b6fa5ffba9f8d6f769f2bb8715b35be10cc4b (diff) |
Always fail during tracking when authentication is required but invalid token is used (#13675)
* Always fail during tracking when authentication is required but invalid token used
* fix tests
Diffstat (limited to 'plugins/UserCountry')
-rw-r--r-- | plugins/UserCountry/Columns/Base.php | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/plugins/UserCountry/Columns/Base.php b/plugins/UserCountry/Columns/Base.php index d599043aba..aef08320fe 100644 --- a/plugins/UserCountry/Columns/Base.php +++ b/plugins/UserCountry/Columns/Base.php @@ -9,6 +9,7 @@ namespace Piwik\Plugins\UserCountry\Columns; use Piwik\Common; +use Piwik\Exception\InvalidRequestParameterException; use Piwik\Network\IPUtils; use Piwik\Plugin\Dimension\VisitDimension; use Piwik\Plugins\UserCountry\VisitorGeolocator; @@ -27,12 +28,14 @@ abstract class Base extends VisitDimension protected function getUrlOverrideValueIfAllowed($urlParamToOverride, Request $request) { - if (!$request->isAuthenticated()) { - return false; - } - $value = Common::getRequestVar($urlParamToOverride, false, 'string', $request->getParams()); + if (!empty($value)) { + if (!$request->isAuthenticated()) { + Common::printDebug("WARN: Tracker API '$urlParamToOverride' was used with invalid token_auth"); + throw new InvalidRequestParameterException("Tracker API '$urlParamToOverride' was used, requires valid token_auth"); + } + return $value; } |