devise icon indicating copy to clipboard operation
devise copied to clipboard

impove rails logs for sensitive info in emails or delay jobs

Open reckerswartz opened this issue 8 years ago • 4 comments

can we work on this PR https://github.com/rails/rails/pull/33756 to improve the issue on devise to prevent password reset tokens leak? https://github.com/plataformatec/devise#password-reset-tokens-and-rails-logs

reckerswartz avatar Oct 03 '18 15:10 reckerswartz

Hey, @reckerswartz thanks for mentioning this, I didn't know about that PR.

I might be wrong, but I don't think it will prevent the leak mentioned in your readme because that patch was added to ActiveRecord, to prevent a model to be printed out with that parameters. However, the issue mentioned in the readme is when logging emails sent or jobs, so that would probably have to be added to ActiveMailer and ActiveJob, but I'm not sure how that could be done.

tegon avatar Oct 03 '18 16:10 tegon

@tegon Thanks for the reply, I am working rails community to get confirmation about the PR whether we can modify it for our need or need to generate fresh PR for the thing. if not I will close the issue soon.

reckerswartz avatar Oct 03 '18 16:10 reckerswartz

@tegon before I start work on new PR can you please confirm that whether we can use filter_parameters method or not

Configure sensitive parameters which will be filtered from the log file.

Rails.application.config.filter_parameters += [:reset_token]

reckerswartz avatar Oct 03 '18 18:10 reckerswartz

That config works for query and request parameter logs, but not for mailers and jobs. Either way, I'm going to close this because it's more related to the way Rails works than to Devise itself.

Thanks!

tegon avatar Oct 03 '18 18:10 tegon