Specify table name in obfuscate calls
Closed this issue · 5 comments
As of today, we just blindly try to match a global list of fields we want to be obfuscated against all the attributes of every row Polo traverses:
Line 38 in b79e48e
To do so, we pass in a list of fields to Polo.configure
Polo.configure do
obfuscate :email
end
While this has been working well, it could be the case that someone wants to only obfuscate certain fields in certain tables.
What I'm suggesting is that we change the obfuscate
method to also accept something like this:
Polo.configure do
obfuscate "users.email"
end
So in this case we're only obfuscating email
fields in the users
table, and not obfuscating emails on some other tables such as invites
or some other table where emails are not sensitive.
What do you think, @danielvlopes?
How about
Polo.configure do
email_scrubber = ->(e) { # secret stuff }
pure_nonsense = -> (v) { # make nonsense }
obfuscate users: { email: email_scrubber },
credit_cards: { number: pure_nonsense}
end
or something like that
This looks even better. Though I think this would break the existing api.
I needed this feature so I made this #30
Solved by #30