Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify table name in obfuscate calls #29

Closed
nettofarah opened this issue Dec 15, 2015 · 5 comments
Closed

Specify table name in obfuscate calls #29

nettofarah opened this issue Dec 15, 2015 · 5 comments

Comments

@nettofarah
Copy link
Contributor

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:

next if intersection(instance.attributes.keys, fields).empty?

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.

@nettofarah
Copy link
Contributor Author

What do you think, @danielvlopes?

@craigmcnamara
Copy link
Contributor

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

@nettofarah
Copy link
Contributor Author

This looks even better. Though I think this would break the existing api.

@craigmcnamara
Copy link
Contributor

I needed this feature so I made this #30

@nettofarah
Copy link
Contributor Author

Solved by #30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants