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

Anonymise customer first and last names #12862

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dacook
Copy link
Member

@dacook dacook commented Sep 16, 2024

These were added a couple of years ago in #8763 But I guess we never noticed the names weren't getting anonymised.

The old 'name' field is still in the DB. It was kept for compatibility during migraiton but never cleaned up. I've added the tech debt task to the welcome new devs board now: #8835

What should we test?

Run the script and check that customer names can not be viewed in the system.

This must be executed on uk_staging because it was recently refreshed from prod and the customer names will still be present. IE:

ssh [email protected]
cd apps/openfoodnetwork/current
RAILS_ENV=staging bundle exec rake ofn:data:anonymize

These were added a couple of years ago in openfoodfoundation#8763
But I guess we never noticed the names weren't getting anonymised.

The old 'name' field is still in the DB. It was kept for compatibility during migraiton but never cleaned up. I've added the tech debt task to the welcome new devs board now: openfoodfoundation#8835
@dacook dacook added the technical changes only These pull requests do not contain user facing changes and are grouped in release notes label Sep 16, 2024
@dacook
Copy link
Member Author

dacook commented Sep 16, 2024

Testing on fr_staging

Before: real customer names appeared in Admin > Customers (not shown here for privacy reasons of course).

I ran the updated queries directly and it worked:
Screenshot 2024-09-16 at 11 35 57 AM

irb(main):020:0>       Customer.where(user_id: nil)
irb(main):021:1"         .update_all("email = concat(id, '[email protected]'),
irb(main):022:1"                      name = concat('Customer Number ', id, ' (without connected User)'),
irb(main):023:1"                      first_name = concat('Customer Number ', id),
irb(main):024:1"                      last_name = '(without connected User)'")
=> 12744
irb(main):025:0>       Customer.where.not(user_id: nil)
irb(main):026:1"         .update_all("email = concat(user_id, '[email protected]'),
irb(main):027:1"                      name = concat('Customer Number ', id, ' - User ', user_id),
irb(main):028:1"                      first_name = concat('Customer Number ', id),
irb(main):029:1"                      last_name = concat('User ', user_id)")
=> 36829

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
technical changes only These pull requests do not contain user facing changes and are grouped in release notes
Projects
Status: Test Ready 🧪
Development

Successfully merging this pull request may close these issues.

2 participants