Patch #44816 » 0001-Filter-token-parameters-from-logs.patch
| config/application.rb | ||
|---|---|---|
|
config.encoding = "utf-8"
|
||
|
# Configure sensitive parameters which will be filtered from the log file.
|
||
|
config.filter_parameters += [:password, :salt, :twofa_totp_key, /\Akey\z/]
|
||
|
config.filter_parameters += [:password, :salt, :token, :twofa_totp_key, /\Akey\z/]
|
||
|
config.action_mailer.perform_deliveries = false
|
||
| test/unit/lib/parameter_filtering_test.rb | ||
|---|---|---|
|
assert_equal '[FILTERED]', filter('twofa_totp_key' => 'secret')['twofa_totp_key']
|
||
|
end
|
||
|
test "token should be filtered from logs" do
|
||
|
assert_equal '[FILTERED]', filter('token' => '1234567890abcdef1234567890abcdef12345678')['token']
|
||
|
end
|
||
|
test "parameters merely containing key should not be over-filtered" do
|
||
|
assert_equal 'fixes', filter('keywords' => 'fixes')['keywords']
|
||
|
end
|
||