Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added single helper to preview arguments. #402

Closed
wants to merge 3 commits into from
Closed

Conversation

serek
Copy link
Contributor

@serek serek commented May 13, 2014

With that kind of helper it's easy to override it in any rails application to maintain potential security issue on production environments where many of arguments might be considered harmful when seen.

Example in Rails:

FILE: config/initializers/resque_web.rb

module Resque
  class Server
    helpers do
      def show_job_arguments(args)
        Array(args).map do |a|
          if a.is_a?(Hash)
            ActionDispatch::Http::ParameterFilter.new(Rails.application.config.filter_parameters).filter(a)
          else
            a
          end
        end.inspect
      end
    end
  end
end

This way someone can filter confidential data just from his application.rb configuration for the same params that are filtered across the app and logs.

@yaauie
Copy link
Member

yaauie commented May 13, 2014

A monkey patch is not the right API for this; perhaps a method on the job payload's class that—if present—filters the args for display? This would keep the filtering close to that which is getting filtered. It would be nice to support the same API in resque itself, too.

@serek
Copy link
Contributor Author

serek commented May 13, 2014

Agree - but it's better than overriding the templates itself.

I'm not sure about latest Resque, but we needed this for 1-x-stable branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants