DekodeInteraktiv / anonymize-mysqldump

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

Panic: index out of range[8] with length 2 #23

Open Pazekal90 opened 10 months ago

Pazekal90 commented 10 months ago

Hi together,

we want to use your little tool for anonymizing a production database with 60GB and we ran into those issues. Maybe here is somebody that can tell me what this error is about.

`panic: runtime error: index out of range [8] with length 2

goroutine 367 [running]: github.com/DekodeInteraktiv/anonymize-mysqldump/internal/anonymize.modifyValues({0xb066000, 0xfdb9, 0x13555}, {{0xa1da060, 0x12}, {0x0, 0x0}, 0x0, {0xa130680, 0x1, ...}}) /home/runner/work/anonymize-mysqldump/anonymize-mysqldump/internal/anonymize/anonymize.go:271 +0x32a github.com/DekodeInteraktiv/anonymize-mysqldump/internal/anonymize.applyConfigToInserts(0xa12e540, {{0x81fbb27, 0x13}, {0xffef76c0, 0x13}, {0x8237b1c, 0x5}, {0x82390e0, 0x28}, {0x8238520, ...}, ...}) /home/runner/work/anonymize-mysqldump/anonymize-mysqldump/internal/anonymize/anonymize.go:249 +0x22b github.com/DekodeInteraktiv/anonymize-mysqldump/internal/anonymize.applyConfigToParsedLine({0x8238968, 0xa12e540}, {{0x81fbb27, 0x13}, {0xffef76c0, 0x13}, {0x8237b1c, 0x5}, {0x82390e0, 0x28}, ...}) /home/runner/work/anonymize-mysqldump/anonymize-mysqldump/internal/anonymize/anonymize.go:208 +0x44 github.com/DekodeInteraktiv/anonymize-mysqldump/internal/anonymize.processLine({0xabd8000, 0xdab31}, {{0x81fbb27, 0x13}, {0xffef76c0, 0x13}, {0x8237b1c, 0x5}, {0x82390e0, 0x28}, ...}) /home/runner/work/anonymize-mysqldump/anonymize-mysqldump/internal/anonymize/anonymize.go:170 +0x132 github.com/DekodeInteraktiv/anonymize-mysqldump/internal/anonymize.processInput.func1({0xabd8000, 0xdab31}) /home/runner/work/anonymize-mysqldump/anonymize-mysqldump/internal/anonymize/anonymize.go:149 +0x7c created by github.com/DekodeInteraktiv/anonymize-mysqldump/internal/anonymize.processInput /home/runner/work/anonymize-mysqldump/anonymize-mysqldump/internal/anonymize/anonymize.go:147 +0x489`

This is the config we used for testing this:

{ "patterns": [ { "tableName": "erp_business_party", "fields": [ { "field": "mail_address", "position": 9, "type": "email", "constraints": null } ] } ] }

PeterBooker commented 10 months ago

Hi @Pazekal90

It is difficult to be certain without having the database structure myself, but it looks like it is expecting there to be at least 8 fields in the erp_business_party table, but only two are found. This means that 9 is out of bounds and throws the fatal error.

If you could make an example SQL with just the structure and no real data, I could help you with the config.

PeterBooker commented 9 months ago

Hi @Pazekal90 this issue should be resolved now in the latest release. If you still have problems, or run into other problems, please let us know.