Skip to content

Latest commit

 

History

History
69 lines (59 loc) · 1.93 KB

README.md

File metadata and controls

69 lines (59 loc) · 1.93 KB

Mysql Anonymous

Build Status Coverage Status

Contributors can benefit from having real data when they are developing. This script can do a few things (see sample1.yml or sample2.yml):

  • Truncate any tables (logs, and other cruft which may have sensitive data)

  • Nullify fields (emails, passwords, etc)

  • Fill in random/arbitrary data:

    • Random integers
    • Random IP addresses
    • Random Cell Phone
    • Random Phone
    • Random CPF
    • Random CNPJ
    • Email addresses
    • Usernames
    • Text Loren Ipsum
  • Delete rows based on simple rules: e.g. DELETE FROM mytable WHERE private = "Yes":

     database:
         tables:
             mytable:
                 nullify:
                     private: Yes
  • Apply rules exception in some cases: e.g. UPDATE mytable SET cellphone=NULL WHERE id NOT IN(556, 889):

    database:
        tables:
            mytable:
                exception:
                 - 556
                 - 889
                nullify:
                 - cellphone
  • Define an other name for primary key of table: e.g. UPDATE mytable SET `email` = CONCAT(user_id, '@example.com'):

    database:
        tables:
            primary_key: user_id
            mytable:
                random_email: email

Installation

pip install https://github.com/riquellopes/mysql-anonymous/tarball/master

CookBook

    anonymize --sample-one
    anonymize --sample-two
    anonymize -y database.yml