Go to file
Simon Vieille 840b3cfa3f
Some checks failed
ci/woodpecker/push/test Pipeline failed
ci/woodpecker/push/build unknown status
add changelog
2024-04-01 18:27:17 +02:00
.woodpecker ci: add publish step 2024-04-01 18:25:53 +02:00
app add progress bar 2024-04-01 18:22:03 +02:00
config fix dsn when when th database is postgresql 2024-03-31 22:18:28 +02:00
data remove tests 2024-04-01 12:31:03 +02:00
database add postgres column type check 2024-04-01 12:30:45 +02:00
faker remove boolean_boolint faker 2024-04-01 12:29:21 +02:00
logger add logger 2024-03-16 15:23:34 +01:00
tests tests: add mysql/postgres datas 2024-04-01 12:29:51 +02:00
.gitignore add gitignore config 2024-03-16 15:24:00 +01:00
CHANGELOG.md add changelog 2024-04-01 18:27:17 +02:00
example.yml add/update readme 2024-04-01 15:31:20 +02:00
go.mod add progress bar 2024-04-01 18:22:03 +02:00
go.sum add progress bar 2024-04-01 18:22:03 +02:00
main.go add/update readme 2024-04-01 15:44:01 +02:00
Makefile add makefile 2024-03-19 06:50:22 +01:00
README.fr.md add/update readme 2024-04-01 18:22:19 +02:00
README.md add/update readme 2024-04-01 16:31:32 +02:00

Database Anonimizer

Database Anonymizer is a tool written in GO that allows anonymizing or deleting data from a MySQL or PostgreSQL database.

It caters to various use cases such as providing developers with an anonymized copy of a database or fulfilling the need to anonymize or delete data in compliance with GDPR (General Data Protection Regulation) requirements, based on retention periods defined in the treatment register.

The project includes a vast array of fakers. It also enables data generation via Twig-written templates. You can specify precise rules for each table or global rules applied to all tables in your configuration.

Usage

Configuration

The configuration is written in YAML. Here's a complete example:

rules:
  columns:
    phone: phone_e164number
  generators:
    person_name: [display_name]
  actions:
    - table: user
      virtual_columns:
        domain: internet_domain
      columns:
        firstname: person_firstname
        lastname: person_lastname
        email: "{{ (firstname ~ '.' ~ lastname ~ '@' ~ domain)|lower }}"
    - table: company
      columns:
        name: company_name
    - table: access_log
      query: 'select * from access_log where date < (NOW() - INTERVAL 6 MONTH)'
      delete: true
    - table: user_ip
      primary_key: [user_id, ip_id]
      delete: true

Exécution

To display help, use -h:

database-anonymizer -h

Here are examples for MySQL and PostgreSQL:

database-anonymizer --dsn "mysql://username:password@tcp(db_host)/db_name" --schema ./schema.yaml
database-anonymizer --dsn "postgres://postgres:postgres@localhost:5432/test" --schema ./schema.yaml