Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Napoli <matthieu@mnapoli.fr>2015-03-02 00:11:33 +0300
committerMatthieu Napoli <matthieu@mnapoli.fr>2015-03-02 00:11:50 +0300
commit10bc3c86e959b6b3f11bf39e8367a2ff230b917e (patch)
treea1dea6878b6fc249cd6e41750519cef7681aed60 /plugins/Monolog/Processor
parent063f8c321fa4e76d156afc637cd0d8640dcffa62 (diff)
#7301 Removes any token_auth that might be logged.
Diffstat (limited to 'plugins/Monolog/Processor')
-rw-r--r--plugins/Monolog/Processor/TokenProcessor.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/plugins/Monolog/Processor/TokenProcessor.php b/plugins/Monolog/Processor/TokenProcessor.php
new file mode 100644
index 0000000000..0fd54892fc
--- /dev/null
+++ b/plugins/Monolog/Processor/TokenProcessor.php
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link http://piwik.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+namespace Piwik\Plugins\Monolog\Processor;
+
+/**
+ * Removes any token_auth that might appear in the logs.
+ *
+ * Ideally the token_auth should never be logged, but...
+ */
+class TokenProcessor
+{
+ public function __invoke(array $record)
+ {
+ $record['message'] = preg_replace('/token_auth=[0-9a-h]+/', 'token_auth=removed', $record['message']);
+
+ return $record;
+ }
+}