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

Rule Matches Multiple Tables #18

Closed PeterBooker closed 10 months ago

PeterBooker commented 1 year ago

Came across a project where the rule: "tableName": ".*_woocommerce_gc_cards", matches both:

wp_woocommerce_gc_cards
wp_woocommerce_gc_cardsmeta

This is because we currently only check if the given regex has a match inside the table name. This can be resolved by adding a $ to the end of the tableName regex, e.g. .*_woocommerce_gc_cards$. I think we can update to check whether the tableName value ends in $ and add it if not. This will ensure that all rules only ever match one table.

(props @JorgenStenshaugen)

PeterBooker commented 1 year ago

@Clorith has pointed out that we should probably add ^ to the front and $ to the back if they do not already exist, which would define the start and end of string in the regex, ensuring that there are no unintended matches.

PeterBooker commented 10 months ago

Fixed by #24