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

fix: use strict regex to validate table name #24

Closed mark-hofmeijer closed 10 months ago

mark-hofmeijer commented 11 months ago

Short introduction

This change will fix the problem as described in #23.

Description

This change will fix the problem as described in #23. I had the exact same issue and with some debugging, I found out that when the pattern table name does match the statement table name, although it is not an exact match. For example, pattern table name "y" does match a statement table name like "x_y". Therefore the regex MatchString should be more strict and match only when the table names does exactly match.

Steps to test / reproduce

Create a mysql dump with both tables, "x_y" and "y". Add a config object with "y" as tableName. Anonymize the mysql dump.

PeterBooker commented 10 months ago

Thank you @mark-hofmeijer , this is great and also fixed https://github.com/DekodeInteraktiv/anonymize-mysqldump/issues/18.