DekodeInteraktiv / anonymize-mysqldump

Allows you to pipe data from mysqldump or an SQL file and anonymize it.
GNU General Public License v3.0
17 stars 9 forks source link

Plugin Rules: WooCommerce #10

Open PeterBooker opened 2 years ago

PeterBooker commented 2 years ago

WooCommerce creates the following tables:

+-------------------------------------------------+
| wp_actionscheduler_actions                      |
| wp_actionscheduler_claims                       |
| wp_actionscheduler_groups                       |
| wp_actionscheduler_logs                         |
| wp_wc_admin_note_actions                        |
| wp_wc_admin_notes                               |
| wp_wc_category_lookup                           |
| wp_wc_customer_lookup                           |
| wp_wc_download_log                              |
| wp_wc_order_coupon_lookup                       |
| wp_wc_order_product_lookup                      |
| wp_wc_order_stats                               |
| wp_wc_order_tax_lookup                          |
| wp_wc_product_meta_lookup                       |
| wp_wc_rate_limits                               |
| wp_wc_reserved_stock                            |
| wp_wc_tax_rate_classes                          |
| wp_wc_webhooks                                  |
| wp_woocommerce_api_keys                         |
| wp_woocommerce_attribute_taxonomies             |
| wp_woocommerce_downloadable_product_permissions |
| wp_woocommerce_log                              |
| wp_woocommerce_order_itemmeta                   |
| wp_woocommerce_order_items                      |
| wp_woocommerce_payment_tokenmeta                |
| wp_woocommerce_payment_tokens                   |
| wp_woocommerce_sessions                         |
| wp_woocommerce_shipping_zone_locations          |
| wp_woocommerce_shipping_zone_methods            |
| wp_woocommerce_shipping_zones                   |
| wp_woocommerce_tax_rate_locations               |
| wp_woocommerce_tax_rates                        |
+-------------------------------------------------+

Below are the tables which we probably want to anonymize.

MariaDB [wordpress]> SHOW COLUMNS FROM wordpress.wp_wc_admin_notes;
+---------------+---------------------+------+-----+---------------------+----------------+
| Field         | Type                | Null | Key | Default             | Extra          |
+---------------+---------------------+------+-----+---------------------+----------------+
| note_id       | bigint(20) unsigned | NO   | PRI | NULL                | auto_increment |
| name          | varchar(255)        | NO   |     | NULL                |                |
| type          | varchar(20)         | NO   |     | NULL                |                |
| locale        | varchar(20)         | NO   |     | NULL                |                |
| title         | longtext            | NO   |     | NULL                |                |
| content       | longtext            | NO   |     | NULL                |                |
| content_data  | longtext            | YES  |     | NULL                |                |
| status        | varchar(200)        | NO   |     | NULL                |                |
| source        | varchar(200)        | NO   |     | NULL                |                |
| date_created  | datetime            | NO   |     | 0000-00-00 00:00:00 |                |
| date_reminder | datetime            | YES  |     | NULL                |                |
| is_snoozable  | tinyint(1)          | NO   |     | 0                   |                |
| layout        | varchar(20)         | NO   |     |                     |                |
| image         | varchar(200)        | YES  |     | NULL                |                |
| is_deleted    | tinyint(1)          | NO   |     | 0                   |                |
| is_read       | tinyint(1)          | NO   |     | 0                   |                |
| icon          | varchar(200)        | NO   |     | info                |                |
+---------------+---------------------+------+-----+---------------------+----------------+

We should probably anonymize title, content and perhaps content_data?

MariaDB [wordpress]> SHOW COLUMNS FROM wordpress.wp_woocommerce_log;
+-----------+---------------------+------+-----+---------+----------------+
| Field     | Type                | Null | Key | Default | Extra          |
+-----------+---------------------+------+-----+---------+----------------+
| log_id    | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| timestamp | datetime            | NO   |     | NULL    |                |
| level     | smallint(4)         | NO   | MUL | NULL    |                |
| source    | varchar(200)        | NO   |     | NULL    |                |
| message   | longtext            | NO   |     | NULL    |                |
| context   | longtext            | YES  |     | NULL    |                |
+-----------+---------------------+------+-----+---------+----------------+

Developers might put personal data into logs, do we need to anonymize message?

The plugin also adds the following post types: product, product_variation, shop_order, shop_order_refund and shop_coupon. We would likely need to anonymize the post meta for shop_order and shop_order_refund?

PeterBooker commented 2 years ago

[#14] contains a draft for a WooCommerce config.