Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-2172

Respecting `filter_parameters` when logging

    • Type: Icon: Task Task
    • Resolution: Done
    • 12_01_17
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      It would be neat if the Mongoid logger would filter passwords etc. from its output. Although many may not have logging enabled in production, we find it very useful and still do. However, passwords may then be shown in plain-text in those logs, unless other precautions are taken.

      This snippet could be helpful:

      filters = Rails.application.config.filter_parameters
      f = ActionDispatch::Http::ParameterFilter.new filters
      f.filter :password => 'haha' # => {:password=>"[FILTERED]"}

            Assignee:
            Unassigned Unassigned
            Reporter:
            sandstrom sandstrom
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: