masquerade icon indicating copy to clipboard operation
masquerade copied to clipboard

Shopware 6 anonymization does not anonymize completely

Open peterjaap opened this issue 3 years ago • 4 comments

But for some reason it duplicates the to-be-anonimized record and anonimizes that one. Maybe because of the binary UUID's?

But not all tables. customer, customer_address, newsletter_recipient, user, etc seem to be unaffected. order_customer and order_address contain the duplicate records.

peterjaap avatar Nov 28 '21 13:11 peterjaap

order_customer and order_address table seems to contain multiple records with the same id ?

image

peterjaap avatar Nov 28 '21 13:11 peterjaap

I guess the problem stems from here, where MySQL doesn't recognize it as an existing row and inserts a new one; https://github.com/elgentos/masquerade/blob/master/src/Elgentos/Masquerade/DataProcessor/TableService.php#L378

peterjaap avatar Nov 28 '21 13:11 peterjaap

Probably because the table has two primary keys and Masquerade identifies the wrong one;

mysql> describe order_customer;
+------------------+--------------+------+-----+---------+-------+
| Field            | Type         | Null | Key | Default | Extra |
+------------------+--------------+------+-----+---------+-------+
| id               | binary(16)   | NO   | PRI | NULL    |       |
| version_id       | binary(16)   | NO   | PRI | NULL    |       |
| customer_id      | binary(16)   | YES  | MUL | NULL    |       |
| order_id         | binary(16)   | NO   | MUL | NULL    |       |
| order_version_id | binary(16)   | NO   |     | NULL    |       |
| email            | varchar(254) | NO   |     | NULL    |       |
| salutation_id    | binary(16)   | NO   | MUL | NULL    |       |
| first_name       | varchar(255) | NO   |     | NULL    |       |
| last_name        | varchar(255) | NO   |     | NULL    |       |
| title            | varchar(100) | YES  |     | NULL    |       |
| company          | varchar(255) | YES  |     | NULL    |       |
| customer_number  | varchar(255) | YES  |     | NULL    |       |
| custom_fields    | json         | YES  |     | NULL    |       |
| created_at       | datetime(3)  | NO   |     | NULL    |       |
| updated_at       | datetime(3)  | YES  |     | NULL    |       |
| remote_address   | varchar(255) | YES  |     | NULL    |       |
+------------------+--------------+------+-----+---------+-------+

peterjaap avatar Nov 28 '21 13:11 peterjaap

This problem occurs because Masquerade at this point assumes a table only has one primary key. @IvanChepurnyi any idea how to allow for multiple PK's?

peterjaap avatar Nov 28 '21 14:11 peterjaap