From 7bde88f398b08b74c95e46afd682268feba36a83 Mon Sep 17 00:00:00 2001 From: Jonathan Hyman Date: Sun, 17 Nov 2013 10:20:28 -0500 Subject: [PATCH] Don't log Redis AUTH requirepass. --- lib/sidekiq/redis_connection.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/sidekiq/redis_connection.rb b/lib/sidekiq/redis_connection.rb index 35832bec..2d0aecef 100644 --- a/lib/sidekiq/redis_connection.rb +++ b/lib/sidekiq/redis_connection.rb @@ -1,5 +1,6 @@ require 'connection_pool' require 'redis' +require 'uri' module Sidekiq class RedisConnection @@ -53,10 +54,16 @@ module Sidekiq end def log_info(options) + # Don't log Redis AUTH password + scrubbed_options = options.dup + if scrubbed_options[:url] && (uri = URI.parse(scrubbed_options[:url])) && uri.password + uri.password = "REDACTED" + scrubbed_options[:url] = uri.to_s + end if Sidekiq.server? - Sidekiq.logger.info("Booting Sidekiq #{Sidekiq::VERSION} with redis options #{options}") + Sidekiq.logger.info("Booting Sidekiq #{Sidekiq::VERSION} with redis options #{scrubbed_options}") else - Sidekiq.logger.info("#{Sidekiq::NAME} client with redis options #{options}") + Sidekiq.logger.info("#{Sidekiq::NAME} client with redis options #{scrubbed_options}") end end