Closed fabiokr closed 7 years ago
:+1: overall, but I agree we should move to prepared statements or some better way to scrub this stuff. It feels like we're starting to fight Rails a little too much there.
@fabiokr this looks good. Has it run in production yet? :trollface:
This updates the postgres provider to filter ActiveRecord::StatementInvalid messages to remove the keys.
This was the simplest fix I could come up with for
encrypt
anddecrypt
. Thesearch
method is harder, because that returns anActiveRecord::Relation
, and the query is only triggered at a later point, so we can't easily rescue.I think a better fix for this would be to move them all to use sql prepared statements instead of raw sql, that way the exception would only get the prepared statement query without any actual keys. I started looking into that, but this path would need more changes on crypt keeper, so I changed to this simpler fix for now instead (https://github.com/fabiokr/crypt_keeper/pull/1 log messages would be different, would have to reworks the log subscriber, etc).