【问题标题】:rails5 `filter_parameters` doesn't workrails5 `filter_parameters` 不起作用
【发布时间】:2017-04-29 20:17:27
【问题描述】:

我的config/initializers/filter_parameter_logging.rb中有以下内容

# Be sure to restart your server when you modify this file.

# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password, :reset_password_token, :confirmation_token, :unlock_token, :two_step_auth_token]

但是当我为two_step_auth_token 列执行和更新时,即使我重新启动了服务器,日志也不会被过滤:

UPDATE `users` SET `two_step_auth_token` = 'tb0437', `two_step_auth_token_sent_at` = '2017-04-29 20:12:49', `two_step_auth_token_confirmed_at` = NULL, `updated_at` = '2017-04-29 20:12:49' WHERE `users`.`id` = 1

出了什么问题,我该如何解决?

【问题讨论】:

    标签: ruby-on-rails logging ruby-on-rails-5


    【解决方案1】:

    您可以从日志文件中过滤掉敏感的请求参数,而不是 sql 查询。

    ref

    【讨论】:

    • 糟糕!那么如何从日志中过滤掉 sql 查询呢?
    • config.log_level = :info in config/environments/development.rb
    猜你喜欢
    • 2018-04-09
    • 1970-01-01
    • 2017-09-22
    • 2016-05-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多