Skip to content

Instantly share code, notes, and snippets.

@stympy
Last active July 26, 2019 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stympy/39aa691f90b97fb4e4912ecbeb8ddbe0 to your computer and use it in GitHub Desktop.
Save stympy/39aa691f90b97fb4e4912ecbeb8ddbe0 to your computer and use it in GitHub Desktop.
Hiding sensitive query info -- specifically, RSA keys from Postgres queries
# Drop this in config/initializers/active_record.rb
class ActiveRecord::ActiveRecordError
def initialize(message = nil)
if message.respond_to?(:gsub)
super(message.gsub(/dearmor\(.*\)/im, '[FILTERED]'))
else
super(message)
end
end
end
@stympy
Copy link
Author

stympy commented Jul 26, 2019

Take a look at https://github.com/honeybadger-io/honeybadger-ruby/blob/master/lib/honeybadger/util/sql.rb if you'd like a more nuanced way to clean up queries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment