README.md in masking-0.0.3 vs README.md in masking-1.0.0

- old
+ new

@@ -1,8 +1,11 @@ # MasKING🤴 -[![Build Status](https://travis-ci.org/kibitan/masking.svg?branch=master)](https://travis-ci.org/kibitan/masking) +[![CircleCI](https://circleci.com/gh/kibitan/masking/tree/master.svg?style=svg)](https://circleci.com/gh/kibitan/masking/tree/master) +[![Acceptance Test MySQL Status](https://github.com/kibitan/masking/workflows/Acceptance%20Test%20MySQL/badge.svg?branch=master)](https://github.com/kibitan/masking/actions?query=workflow%3A%22Acceptance+Test+MySQL%22+branch%3Amaster) +[![Acceptance Test MariaDB Status](https://github.com/kibitan/masking/workflows/Acceptance%20Test%20MariaDB/badge.svg?branch=master)](https://github.com/kibitan/masking/actions?query=workflow%3A%22Acceptance+Test+MariaDB%22+branch%3Amaster) + [![Coverage Status](https://coveralls.io/repos/github/kibitan/masking/badge.svg?branch=master)](https://coveralls.io/github/kibitan/masking?branch=master) [![Maintainability](https://api.codeclimate.com/v1/badges/290b3005ecc193a3d138/maintainability)](https://codeclimate.com/github/kibitan/masking/maintainability) [![Gem Version](https://badge.fury.io/rb/masking.svg)](https://badge.fury.io/rb/masking) The command line tool for anonymizing database records by parsing a SQL dump file and build new SQL dump file with masking sensitive/credential data. @@ -13,15 +16,16 @@ gem install masking ``` ## Requirement -* Ruby 2.5/2.6 +* Ruby 2.5/2.6/2.7(preview) ## Supported RDBMS -* MySQL 5.7...(TBC) +* MySQL: 5.5<sup>[1](#footnote1)</sup>, 5.6, 5.7, 8.0 +* MariaDB: 5.5, 10.0<sup>[2](#footnote2)</sup>, 10.1, 10.2, 10.3, 10.4 ## Usage 1. Setup configuration for anonymizing target tables/columns to `masking.yml` @@ -33,11 +37,11 @@ string: anonymized string email: anonymized+%{n}@example.com # %{n} will be replaced with sequential number integer: 12345 float: 123.45 boolean: true - null: null + null_column: null date: 2018-08-24 time: 2018-08-24 15:54:06 binary_or_blob: !binary | # Binary Data Language-Independent Type for YAML™ Version 1.1: http://yaml.org/type/binary.html R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5 OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+ @@ -79,10 +83,11 @@ ```bash $ masking -h Usage: masking [options] -c, --config=FILE_PATH specify config file. default: masking.yml + -v, --version version ``` ## Use case of annonymized (production) database * Simulate for database migration and find a problem before release @@ -116,35 +121,76 @@ You can also run `bin/console` for an interactive prompt that will allow you to experiment. To install this gem onto your local machine, run `bundle exec rake install`. +### boot + +```bash + bundle exec exe/masking +``` + ### Run test & rubocop & notes ```bash bundle exec rake ``` -#### Protip +#### acceptance test -It's useful that set `rake` on [Git hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks). +```bash +./acceptance/run_test.sh +``` +available option via environment variable: + +* `MYSQL_HOST`: database host(default: `localhost`) +* `MYSQL_USER`: mysql user name(default: `mysqluser`} +* `MYSQL_PASSWORD`: password for user(default: `password`) +* `MYSQL_DBNAME`: database name(default: `mydb`) + +##### with docker + ```bash -touch .git/hooks/pre-commit && chmod +x .git/hooks/pre-commit && cat << EOF > .git/hooks/pre-commit -#!/usr/bin/env bash -bundle exec rake -EOF +docker-compose -f docker-compose.yml -f docker-compose/mysql80.yml run -e MYSQL_HOST=mysql80 app acceptance/run_test.sh ``` +or + +```bash +docker-compose/acceptance_test.sh mysql80 +``` + +The docker-compose file names for other database versions, specify that file. + +* MySQL 8.0: [`docker-compose/mysql80.yml`](./docker-compose/mysql80.yml) +* MySQL 5.7: [`docker-compose/mysql57.yml`](./docker-compose/mysql57.yml) +* MySQL 5.6: [`docker-compose/mysql56.yml`](./docker-compose/mysql56.yml) +* MySQL 5.5<sup>[1](#footnote1)</sup>: [`docker-compose/mysql55.yml`](./docker-compose/mysql55.yml) +* MariaDB 10.4: [`docker-compose/mariadb104.yml`](./docker-compose/mariadb104.yml) +* MariaDB 10.3: [`docker-compose/mariadb103.yml`](./docker-compose/mariadb103.yml) +* MariaDB 10.2: [`docker-compose/mariadb102.yml`](./docker-compose/mariadb102.yml) +* MariaDB 10.1: [`docker-compose/mariadb101.yml`](./docker-compose/mariadb101.yml) +* MariaDB 10.0<sup>[2](#footnote2)</sup>: [`docker-compose/mariadb100.yml`](./docker-compose/mariadb100.yml) +* MariaDB 5.5: [`docker-compose/mariadb55.yml`](./docker-compose/mariadb55.yml) + #### [Markdown lint](https://github.com/markdownlint/markdownlint) ```bash bundle exec mdl *.md ``` -### Profiling +## Development with Docker +```bash +docker build . -t masking +echo "sample stdout" | docker run -i masking +docker run masking -v +``` + +## Profiling + use `bin/masking_profile` ```bash $ cat your_sample.sql | bin/masking_profile flat result is saved at /your/repo/profile/flat.txt @@ -179,11 +225,10 @@ ## Future Todo * Pluguable/customizable for a mask way e.g. integrate with [Faker](https://github.com/stympy/faker) * Compatible with other RDBMS e.g. PostgreSQL, Oracle, SQL Server * Parse the schema type information and validate target columns value -* Integration test with real database * Performance optimization * Write in streaming process * rewrite by another language? * Well-documentation @@ -197,5 +242,9 @@ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). ## Code of Conduct Everyone interacting in the Masking project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/kibitan/masking/blob/master/CODE_OF_CONDUCT.md). + +<a name="footnote1">1</a>: <small> MySQL 5.5 is already not supported by [official](https://www.mysql.com/support/supportedplatforms/database.html)</small> + +<a name="footnote2">2</a>: <small> MariaDB 10.0 is already not supported by [official](https://mariadb.org/about/maintenance-policy/)</small>