mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
parent
48cd79b886
commit
28df157cce
2 changed files with 27 additions and 0 deletions
|
@ -103,6 +103,11 @@ module Sidekiq
|
||||||
if scrubbed_options[:password]
|
if scrubbed_options[:password]
|
||||||
scrubbed_options[:password] = redacted
|
scrubbed_options[:password] = redacted
|
||||||
end
|
end
|
||||||
|
if scrubbed_options[:sentinels]
|
||||||
|
scrubbed_options[:sentinels].each do |sentinel|
|
||||||
|
sentinel[:password] = redacted if scrubbed_options[:password]
|
||||||
|
end
|
||||||
|
end
|
||||||
if Sidekiq.server?
|
if Sidekiq.server?
|
||||||
Sidekiq.logger.info("Booting Sidekiq #{Sidekiq::VERSION} with redis options #{scrubbed_options}")
|
Sidekiq.logger.info("Booting Sidekiq #{Sidekiq::VERSION} with redis options #{scrubbed_options}")
|
||||||
else
|
else
|
||||||
|
|
|
@ -188,6 +188,28 @@ describe Sidekiq::RedisConnection do
|
||||||
assert_equal redis_driver, redis.instance_variable_get(:@client).driver
|
assert_equal redis_driver, redis.instance_variable_get(:@client).driver
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'logging redis options' do
|
||||||
|
it 'redacts credentials' do
|
||||||
|
output = capture_logging do
|
||||||
|
Sidekiq::RedisConnection.create(
|
||||||
|
role: 'master',
|
||||||
|
master_name: 'mymaster',
|
||||||
|
sentinels: [
|
||||||
|
{ host: 'host1', port: 26379, password: 'secret'},
|
||||||
|
{ host: 'host2', port: 26379, password: 'secret'},
|
||||||
|
{ host: 'host3', port: 26379, password: 'secret'},
|
||||||
|
],
|
||||||
|
password: 'secret'
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
assert_includes(output, ':host=>"host1", :port=>26379, :password=>"REDACTED"')
|
||||||
|
assert_includes(output, ':host=>"host2", :port=>26379, :password=>"REDACTED"')
|
||||||
|
assert_includes(output, ':host=>"host3", :port=>26379, :password=>"REDACTED"')
|
||||||
|
assert_includes(output, ':password=>"REDACTED", :id=>')
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe ".determine_redis_provider" do
|
describe ".determine_redis_provider" do
|
||||||
|
|
Loading…
Add table
Reference in a new issue