Sha256: 42994cf67b1458c5c5b153f900703c37edaea09fc7bdd23619efe668a5eafcbc
Contents?: true
Size: 839 Bytes
Versions: 4
Compression:
Stored size: 839 Bytes
Contents
require 'active_support/concern' require 'active_support/lazy_load_hooks' module CryptKeeper module LogSubscriber module MysqlAes # Public: Prevents sensitive data from being logged # # event - An ActiveSupport::Notifications::Event # # Returns a boolean. def sql(event) filter = /(aes_(encrypt|decrypt))\(.*\)/i payload = event.payload[:sql] .encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '') return if CryptKeeper.silence_logs? && payload =~ filter event.payload[:sql] = payload.gsub(filter) do |_| "#{$1}([FILTERED])" end super(event) end end end end ActiveSupport.on_load :crypt_keeper_mysql_aes_log do ActiveRecord::LogSubscriber.prepend CryptKeeper::LogSubscriber::MysqlAes end
Version data entries
4 entries across 4 versions & 1 rubygems