aboutsummaryrefslogtreecommitdiff
path: root/lib/lib_rss.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/lib_rss.php')
-rw-r--r--lib/lib_rss.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/lib_rss.php b/lib/lib_rss.php
index d0e819d98..cbdfff773 100644
--- a/lib/lib_rss.php
+++ b/lib/lib_rss.php
@@ -224,6 +224,31 @@ function html_only_entity_decode($text): string {
}
/**
+ * Remove passwords in FreshRSS logs.
+ * See also ../cli/sensitive-log.sh for Web server logs.
+ * @param array<string,mixed>|string $log
+ * @return array<string,mixed>|string
+ */
+function sensitive_log($log) {
+ if (is_array($log)) {
+ foreach ($log as $k => $v) {
+ if (in_array($k, ['api_key', 'Passwd', 'T'])) {
+ $log[$k] = '██';
+ } else {
+ $log[$k] = sensitive_log($v);
+ }
+ }
+ } elseif (is_string($log)) {
+ $log = preg_replace([
+ '/\b(auth=.*?\/)[^&]+/i',
+ '/\b(Passwd=)[^&]+/i',
+ '/\b(Authorization)[^&]+/i',
+ ], '$1█', $log);
+ }
+ return $log;
+}
+
+/**
* @param array<string,mixed> $attributes
*/
function customSimplePie($attributes = array()): SimplePie {