Ruby on rails 正在日志文件中返回密码摘要

Ruby on rails 正在日志文件中返回密码摘要,ruby-on-rails,bcrypt,Ruby On Rails,Bcrypt,我正在为我的rails api应用程序使用bcrypt和knock gem进行身份验证,并注意到每次我返回用户详细信息时,日志文件中也会以明文形式返回密码摘要 以下是日志文件输出: ↳ app/controllers/v1/registrations_controller.rb:4:in `create' User Create (0.3ms) INSERT INTO "users" ("email", "first_name", "password_digest", "created

我正在为我的rails api应用程序使用bcrypt和knock gem进行身份验证,并注意到每次我返回用户详细信息时,日志文件中也会以明文形式返回密码摘要

以下是日志文件输出:

  ↳ app/controllers/v1/registrations_controller.rb:4:in `create'
  User Create (0.3ms)  INSERT INTO "users" ("email", "first_name", "password_digest", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5) RETURNING "id"  [["email", "nsantiago@example.cosm"], ["first_name", "Norman"], ["password_digest", "$2a$12$am0rzVPRzgRe5eMmQd/USuOrtiM.JMbpwVd.WsD6ep7KbbIdFaVzS"], ["created_at", "2020-02-23 12:29:43.030356"], ["updated_at", "2020-02-23 12:29:43.030356"]]
  ↳ app/controllers/v1/registrations_controller.rb:4:in `create'
   (38.1ms)  COMMIT
  ↳ app/controllers/v1/registrations_controller.rb:4:in `create'
Completed 201 Created in 405ms (Views: 0.2ms | ActiveRecord: 46.1ms | Allocations: 9537)
这是我的控制器:

  def create
    @user = User.new(data)
    if @user.save
      render json: serialize(@user), status: 201
    else
      render json: @user.errors, status: 422
    end
  end
和序列化程序:

class UserSerializer
  include FastJsonapi::ObjectSerializer
  attributes :id, :email, :full_name
end

有没有办法过滤日志中的密码摘要输出?

您是否尝试过使用?我不确定它是否适用于查询参数。是的,密码摘要是我的筛选器参数的一部分,但它不起作用。