Sha256: b5e6802d457ef2b5f553219b9dfa1832dc8b707ff9a4fb8a85f3e6f5df5a58bd
Contents?: true
Size: 770 Bytes
Versions: 6
Compression:
Stored size: 770 Bytes
Contents
require 'active_support/concern' require 'active_support/lazy_load_hooks' module CryptKeeper module LogSubscriber module PostgresPgp extend ActiveSupport::Concern included do alias_method_chain :sql, :postgres_pgp end # Public: Prevents sensitive data from being logged def sql_with_postgres_pgp(event) filter = /(\(*)pgp_(sym|pub)_(?<operation>decrypt|encrypt)(\(+.*\)+)/im event.payload[:sql] = event.payload[:sql].gsub(filter) do |_| "#{$~[:operation]}([FILTERED])" end sql_without_postgres_pgp(event) end end end end ActiveSupport.on_load :crypt_keeper_postgres_pgp_log do ActiveRecord::LogSubscriber.send :include, CryptKeeper::LogSubscriber::PostgresPgp end
Version data entries
6 entries across 6 versions & 1 rubygems