Last active
July 26, 2019 17:07
-
-
Save stympy/39aa691f90b97fb4e4912ecbeb8ddbe0 to your computer and use it in GitHub Desktop.
Hiding sensitive query info -- specifically, RSA keys from Postgres queries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.