masking 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +9 -4
  3. data/.github/workflows/acceptance_test_mariadb.yml +57 -1
  4. data/.github/workflows/acceptance_test_mysql.yml +1 -1
  5. data/.rubocop.yml +7 -1
  6. data/.rubocop_todo.yml +105 -0
  7. data/.ruby-version +1 -1
  8. data/CHANGELOG.md +10 -0
  9. data/Dockerfile +3 -1
  10. data/Gemfile +20 -0
  11. data/Gemfile.lock +67 -51
  12. data/README.md +18 -8
  13. data/acceptance/expected_query_result.txt +36 -30
  14. data/acceptance/import_dumpfile.sql +3 -1
  15. data/acceptance/masking.yml +2 -0
  16. data/acceptance/run_test.sh +1 -1
  17. data/docker-compose/mariadb1010.yml +17 -0
  18. data/docker-compose/mariadb1011.yml +17 -0
  19. data/docker-compose/mariadb105.yml +17 -0
  20. data/docker-compose/mariadb106.yml +17 -0
  21. data/docker-compose/mariadb107.yml +17 -0
  22. data/docker-compose/mariadb108.yml +17 -0
  23. data/docker-compose/mariadb109.yml +17 -0
  24. data/lib/masking/cli/error_message.rb +1 -1
  25. data/lib/masking/config/target_columns/column.rb +19 -5
  26. data/lib/masking/config/target_columns/method/string_binary_distinctor.rb +3 -3
  27. data/lib/masking/config/target_columns/method/type/base.rb +25 -0
  28. data/lib/masking/config/target_columns/method/type/binary.rb +19 -0
  29. data/lib/masking/config/target_columns/method/type/boolean.rb +27 -0
  30. data/lib/masking/config/target_columns/method/type/date.rb +28 -0
  31. data/lib/masking/config/target_columns/method/type/extension/ignore_null.rb +24 -0
  32. data/lib/masking/config/target_columns/method/type/float.rb +19 -0
  33. data/lib/masking/config/target_columns/method/type/integer.rb +19 -0
  34. data/lib/masking/config/target_columns/method/{null.rb → type/null.rb} +5 -5
  35. data/lib/masking/config/target_columns/method/type/string.rb +37 -0
  36. data/lib/masking/config/target_columns/method/type/time.rb +26 -0
  37. data/lib/masking/config/target_columns/method.rb +14 -10
  38. data/lib/masking/insert_statement/sql_builder.rb +2 -2
  39. data/lib/masking/insert_statement.rb +1 -1
  40. data/lib/masking/sql_dump_line.rb +1 -0
  41. data/lib/masking/version.rb +1 -1
  42. data/masking.gemspec +1 -18
  43. metadata +24 -181
  44. data/lib/masking/config/target_columns/method/binary.rb +0 -23
  45. data/lib/masking/config/target_columns/method/boolean.rb +0 -29
  46. data/lib/masking/config/target_columns/method/date.rb +0 -30
  47. data/lib/masking/config/target_columns/method/float.rb +0 -23
  48. data/lib/masking/config/target_columns/method/integer.rb +0 -23
  49. data/lib/masking/config/target_columns/method/string.rb +0 -33
  50. data/lib/masking/config/target_columns/method/time.rb +0 -28
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4d34aeecc48c47e5ad4f96b35f3f8c6afb36a870402e44839a9a4d13af065f1
4
- data.tar.gz: 1089fad50f9aaab3afcf32a553c0cba62754ddf05a630f35f6e928e5a205d090
3
+ metadata.gz: 8229ba5463b487ff90ed68d770ce32e07d5d02859c12836eae99dc465ebe1378
4
+ data.tar.gz: 3b046df36bc1576e02412df76de34fa03c31583e4d8cc89c0c417dcbe86f09fd
5
5
  SHA512:
6
- metadata.gz: f37b50a385f56ab9e7359d245dada16a3f619341e41089bbaafd97a42d2f73d471ea12c014cec410adc1575fdc764c1b88065850decaa992fa0bbd95926919fa
7
- data.tar.gz: d071b2b682a2f20a5cb9e5a04ce91901ba4066520ea740058730d19205376e90f23f5e26721bd17fe75657332551bd145a09870fcfb077a5cecfadc06bb5b76b
6
+ metadata.gz: 3cd6d9271cbcdadc50281189db5e4ed73111996544d47ddb553b33e4d82a838d7dcc95b649ca6462cf9f1742256602feb22f973cba98adf5ebebb7b3fbb3ff79
7
+ data.tar.gz: f0dd87ee111bd69ef6586ce3aa18baf9b7734b8843c8d00b2480308244db7e98cb87f04f196ccd530d1690b0697f039dd7683ae60f147a8b66971ff762c0459e
data/.circleci/config.yml CHANGED
@@ -14,10 +14,14 @@ test_attributes: &test_attributes
14
14
  name: output Ruby version (debug)
15
15
  command: docker run --entrypoint sh masking-$RUBY_VERSION-$CIRCLE_SHA1 -c "ruby -v" # debug
16
16
  - run:
17
- name: run test
18
- command: docker run --entrypoint sh -e CI -e CODECOV_TOKEN masking-$RUBY_VERSION-$CIRCLE_SHA1 -c "bundle exec rspec"
17
+ name: run test & rubocop & notes
18
+ command: docker run --entrypoint sh -e CI -e CODECOV_TOKEN masking-$RUBY_VERSION-$CIRCLE_SHA1 -c "bundle exec rake"
19
19
 
20
20
  jobs:
21
+ test-ruby32:
22
+ <<: *test_attributes
23
+ environment:
24
+ RUBY_VERSION: '3.2'
21
25
  test-ruby31:
22
26
  <<: *test_attributes
23
27
  environment:
@@ -38,7 +42,8 @@ jobs:
38
42
  workflows:
39
43
  'CircleCI: build':
40
44
  jobs:
45
+ - test-ruby32
46
+ - test-ruby31
47
+ - test-ruby30
41
48
  - test-ruby26
42
49
  - test-ruby27
43
- - test-ruby30
44
- - test-ruby31
@@ -2,10 +2,66 @@ name: Acceptance Test MariaDB
2
2
  on:
3
3
  push:
4
4
  branches:
5
- - master
5
+ - main
6
6
  pull_request:
7
7
 
8
8
  jobs:
9
+ mariadb1011:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v1
13
+ with:
14
+ fetch-depth: 1 # shallow clone
15
+ - name: run test
16
+ run: docker-compose/acceptance_test.sh mariadb1011 docker-compose-ci.yml
17
+ mariadb1010:
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - uses: actions/checkout@v1
21
+ with:
22
+ fetch-depth: 1 # shallow clone
23
+ - name: run test
24
+ run: docker-compose/acceptance_test.sh mariadb1010 docker-compose-ci.yml
25
+ mariadb109:
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - uses: actions/checkout@v1
29
+ with:
30
+ fetch-depth: 1 # shallow clone
31
+ - name: run test
32
+ run: docker-compose/acceptance_test.sh mariadb109 docker-compose-ci.yml
33
+ mariadb108:
34
+ runs-on: ubuntu-latest
35
+ steps:
36
+ - uses: actions/checkout@v1
37
+ with:
38
+ fetch-depth: 1 # shallow clone
39
+ - name: run test
40
+ run: docker-compose/acceptance_test.sh mariadb108 docker-compose-ci.yml
41
+ mariadb107:
42
+ runs-on: ubuntu-latest
43
+ steps:
44
+ - uses: actions/checkout@v1
45
+ with:
46
+ fetch-depth: 1 # shallow clone
47
+ - name: run test
48
+ run: docker-compose/acceptance_test.sh mariadb107 docker-compose-ci.yml
49
+ mariadb106:
50
+ runs-on: ubuntu-latest
51
+ steps:
52
+ - uses: actions/checkout@v1
53
+ with:
54
+ fetch-depth: 1 # shallow clone
55
+ - name: run test
56
+ run: docker-compose/acceptance_test.sh mariadb106 docker-compose-ci.yml
57
+ mariadb105:
58
+ runs-on: ubuntu-latest
59
+ steps:
60
+ - uses: actions/checkout@v1
61
+ with:
62
+ fetch-depth: 1 # shallow clone
63
+ - name: run test
64
+ run: docker-compose/acceptance_test.sh mariadb105 docker-compose-ci.yml
9
65
  mariadb104:
10
66
  runs-on: ubuntu-latest
11
67
  steps:
@@ -2,7 +2,7 @@ name: Acceptance Test MySQL
2
2
  on:
3
3
  push:
4
4
  branches:
5
- - master
5
+ - main
6
6
  pull_request:
7
7
 
8
8
  jobs:
data/.rubocop.yml CHANGED
@@ -1,11 +1,17 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ require:
4
+ - rubocop-rspec
5
+
1
6
  AllCops:
7
+ NewCops: enable
2
8
  Exclude:
3
9
  - 'vendor/**/*'
4
10
  - 'spec/fixtures/**/*'
5
11
  - 'tmp/**/*'
6
12
  TargetRubyVersion: 2.6
7
13
 
8
- Metrics/LineLength:
14
+ Layout/LineLength:
9
15
  Max: 120
10
16
 
11
17
  Metrics/BlockLength:
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,105 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2023-02-26 19:42:34 UTC using RuboCop version 1.46.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ RSpec/AnyInstance:
11
+ Exclude:
12
+ - 'spec/masking/config_spec.rb'
13
+
14
+ # Offense count: 39
15
+ # Configuration parameters: Prefixes, AllowedPatterns.
16
+ # Prefixes: when, with, without
17
+ RSpec/ContextWording:
18
+ Exclude:
19
+ - 'spec/integration/commandline_spec.rb'
20
+ - 'spec/masking/cli_spec.rb'
21
+ - 'spec/masking/config/target_columns/column_spec.rb'
22
+ - 'spec/masking/config/target_columns/method/binary_spec.rb'
23
+ - 'spec/masking/config/target_columns/method/string_binary_distinctor_spec.rb'
24
+ - 'spec/masking/config/target_columns/method_spec.rb'
25
+ - 'spec/masking/config/target_columns_spec.rb'
26
+ - 'spec/masking/config_spec.rb'
27
+ - 'spec/masking/data_mask_processor/cache_spec.rb'
28
+ - 'spec/masking/insert_statement_spec.rb'
29
+ - 'spec/masking/sql_dump_line_spec.rb'
30
+
31
+ # Offense count: 1
32
+ # Configuration parameters: IgnoredMetadata.
33
+ RSpec/DescribeClass:
34
+ Exclude:
35
+ - '**/spec/features/**/*'
36
+ - '**/spec/requests/**/*'
37
+ - '**/spec/routing/**/*'
38
+ - '**/spec/system/**/*'
39
+ - '**/spec/views/**/*'
40
+ - 'spec/integration/commandline_spec.rb'
41
+
42
+ # Offense count: 6
43
+ # Configuration parameters: CountAsOne.
44
+ RSpec/ExampleLength:
45
+ Max: 7
46
+
47
+ # Offense count: 1
48
+ RSpec/ExpectInHook:
49
+ Exclude:
50
+ - 'spec/masking/insert_statement_spec.rb'
51
+
52
+ # Offense count: 4
53
+ RSpec/ExpectOutput:
54
+ Exclude:
55
+ - 'spec/masking/cli_spec.rb'
56
+
57
+ # Offense count: 1
58
+ RSpec/MessageChain:
59
+ Exclude:
60
+ - 'spec/masking_spec.rb'
61
+
62
+ # Offense count: 16
63
+ # Configuration parameters: .
64
+ # SupportedStyles: have_received, receive
65
+ RSpec/MessageSpies:
66
+ EnforcedStyle: receive
67
+
68
+ # Offense count: 5
69
+ RSpec/MultipleExpectations:
70
+ Max: 3
71
+
72
+ # Offense count: 44
73
+ # Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
74
+ # SupportedStyles: always, named_only
75
+ RSpec/NamedSubject:
76
+ Exclude:
77
+ - 'spec/masking/cli/error_message_spec.rb'
78
+ - 'spec/masking/config/target_columns/column_spec.rb'
79
+ - 'spec/masking/config/target_columns/method/binary_spec.rb'
80
+ - 'spec/masking/config/target_columns/method/string_spec.rb'
81
+ - 'spec/masking/config/target_columns/method_spec.rb'
82
+ - 'spec/masking/config/target_columns/table_spec.rb'
83
+ - 'spec/masking/config/target_columns_spec.rb'
84
+ - 'spec/masking/config_spec.rb'
85
+ - 'spec/masking/insert_statement/sql_builder_spec.rb'
86
+ - 'spec/masking/insert_statement_spec.rb'
87
+ - 'spec/masking_spec.rb'
88
+
89
+ # Offense count: 19
90
+ # Configuration parameters: AllowedGroups.
91
+ RSpec/NestedGroups:
92
+ Max: 5
93
+
94
+ # Offense count: 4
95
+ RSpec/RepeatedExampleGroupDescription:
96
+ Exclude:
97
+ - 'spec/integration/commandline_spec.rb'
98
+ - 'spec/masking/cli_spec.rb'
99
+
100
+ # Offense count: 3
101
+ RSpec/StubbedMock:
102
+ Exclude:
103
+ - 'spec/masking/cli_spec.rb'
104
+ - 'spec/masking/config/target_columns/method_spec.rb'
105
+ - 'spec/masking/sql_dump_line_spec.rb'
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.1.3
1
+ 3.2.1
data/CHANGELOG.md CHANGED
@@ -7,12 +7,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [v1.1.1] - 2023-04-03
11
+
12
+ ### Added
13
+
14
+ - add ignore NULL option [#66](https://github.com/kibitan/masking/pull/66) requested feature by [#59](https://github.com/kibitan/masking/pull/59) from @spyro2000
15
+ - add MariaDB 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11 support [#65](https://github.com/kibitan/masking/pull/65)
16
+ - add Ruby 3.2 support [#64](https://github.com/kibitan/masking/pull/64)
17
+ - update development libraries [#61](https://github.com/kibitan/masking/pull/61)
18
+
10
19
  ## [v1.1.0] - 2023-02-25 Happy #ruby30th Birthday🎉
11
20
 
12
21
  ### Added
13
22
 
14
23
  - add Ruby 3.0 support [#55](https://github.com/kibitan/masking/pull/55)
15
24
  - add Ruby 3.1 support [#60](https://github.com/kibitan/masking/pull/60)
25
+ - drop Ruby 2.5 support [#60](https://github.com/kibitan/masking/pull/60)
16
26
 
17
27
  ### Security
18
28
 
data/Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- ARG ruby_version=2.6
1
+ ARG ruby_version=3.2
2
2
 
3
3
  FROM ruby:$ruby_version-alpine AS builder
4
4
  RUN apk add --no-cache build-base git
@@ -23,4 +23,6 @@ RUN chown app /app
23
23
  USER app
24
24
  COPY --from=builder /usr/local/bundle/ /usr/local/bundle/
25
25
  COPY --chown=app . ./
26
+ # workaround: at some reason, ruby-prof is not recognized in Ruby 2.6 image https://app.circleci.com/pipelines/github/kibitan/masking/197/workflows/8cbdb843-a42f-413a-ab2f-9c5f74397d43/jobs/512
27
+ RUN bundle
26
28
  ENTRYPOINT ["bundle", "exec", "exe/masking"]
data/Gemfile CHANGED
@@ -4,5 +4,25 @@ source 'https://rubygems.org'
4
4
 
5
5
  git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
6
 
7
+ gem 'bundler'
8
+ gem 'rake'
9
+ gem 'rake-notes'
10
+ gem 'ruby-prof'
11
+
12
+ # linter/static analyzer
13
+ gem 'mdl'
14
+ gem 'rubocop'
15
+ gem 'rubocop-rspec'
16
+
17
+ # test
18
+ gem 'codecov'
19
+ gem 'rspec'
20
+ gem 'simplecov'
21
+
22
+ # debug
23
+ gem 'pry'
24
+ gem 'pry-byebug'
25
+ gem 'tapp'
26
+
7
27
  # Specify your gem's dependencies in masking.gemspec
8
28
  gemspec
data/Gemfile.lock CHANGED
@@ -1,83 +1,98 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- masking (1.1.0)
4
+ masking (1.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- ast (2.4.0)
10
- byebug (11.0.1)
11
- codecov (0.2.12)
12
- json
13
- simplecov
14
- coderay (1.1.2)
9
+ ast (2.4.2)
10
+ byebug (11.1.3)
11
+ chef-utils (18.1.0)
12
+ concurrent-ruby
13
+ codecov (0.6.0)
14
+ simplecov (>= 0.15, < 0.22)
15
+ coderay (1.1.3)
15
16
  colored (1.2)
16
- diff-lcs (1.3)
17
- docile (1.3.2)
18
- jaro_winkler (1.5.4)
19
- json (2.3.1)
20
- kramdown (2.3.0)
17
+ concurrent-ruby (1.2.2)
18
+ diff-lcs (1.5.0)
19
+ docile (1.4.0)
20
+ json (2.6.3)
21
+ kramdown (2.4.0)
21
22
  rexml
22
23
  kramdown-parser-gfm (1.1.0)
23
24
  kramdown (~> 2.0)
24
- mdl (0.8.0)
25
- kramdown (~> 2.0)
26
- kramdown-parser-gfm (~> 1.0)
25
+ mdl (0.12.0)
26
+ kramdown (~> 2.3)
27
+ kramdown-parser-gfm (~> 1.1)
27
28
  mixlib-cli (~> 2.1, >= 2.1.1)
28
29
  mixlib-config (>= 2.2.1, < 4)
29
- method_source (0.9.2)
30
- mixlib-cli (2.1.5)
31
- mixlib-config (3.0.5)
30
+ mixlib-shellout
31
+ method_source (1.0.0)
32
+ mixlib-cli (2.1.8)
33
+ mixlib-config (3.0.27)
32
34
  tomlrb
33
- parallel (1.19.1)
34
- parser (2.6.5.0)
35
- ast (~> 2.4.0)
36
- pry (0.12.2)
37
- coderay (~> 1.1.0)
38
- method_source (~> 0.9.0)
39
- pry-byebug (3.7.0)
35
+ mixlib-shellout (3.2.7)
36
+ chef-utils
37
+ parallel (1.22.1)
38
+ parser (3.2.1.0)
39
+ ast (~> 2.4.1)
40
+ pry (0.14.2)
41
+ coderay (~> 1.1)
42
+ method_source (~> 1.0)
43
+ pry-byebug (3.10.1)
40
44
  byebug (~> 11.0)
41
- pry (~> 0.10)
42
- rainbow (3.0.0)
43
- rake (13.0.1)
45
+ pry (>= 0.13, < 0.15)
46
+ rainbow (3.1.1)
47
+ rake (13.0.6)
44
48
  rake-notes (0.2.2)
45
49
  colored
46
50
  rake
47
- rexml (3.2.4)
48
- rspec (3.9.0)
49
- rspec-core (~> 3.9.0)
50
- rspec-expectations (~> 3.9.0)
51
- rspec-mocks (~> 3.9.0)
52
- rspec-core (3.9.0)
53
- rspec-support (~> 3.9.0)
54
- rspec-expectations (3.9.0)
51
+ regexp_parser (2.7.0)
52
+ rexml (3.2.5)
53
+ rspec (3.12.0)
54
+ rspec-core (~> 3.12.0)
55
+ rspec-expectations (~> 3.12.0)
56
+ rspec-mocks (~> 3.12.0)
57
+ rspec-core (3.12.1)
58
+ rspec-support (~> 3.12.0)
59
+ rspec-expectations (3.12.2)
55
60
  diff-lcs (>= 1.2.0, < 2.0)
56
- rspec-support (~> 3.9.0)
57
- rspec-mocks (3.9.0)
61
+ rspec-support (~> 3.12.0)
62
+ rspec-mocks (3.12.3)
58
63
  diff-lcs (>= 1.2.0, < 2.0)
59
- rspec-support (~> 3.9.0)
60
- rspec-support (3.9.0)
61
- rubocop (0.78.0)
62
- jaro_winkler (~> 1.5.1)
64
+ rspec-support (~> 3.12.0)
65
+ rspec-support (3.12.0)
66
+ rubocop (1.46.0)
67
+ json (~> 2.3)
63
68
  parallel (~> 1.10)
64
- parser (>= 2.6)
69
+ parser (>= 3.2.0.0)
65
70
  rainbow (>= 2.2.2, < 4.0)
71
+ regexp_parser (>= 1.8, < 3.0)
72
+ rexml (>= 3.2.5, < 4.0)
73
+ rubocop-ast (>= 1.26.0, < 2.0)
66
74
  ruby-progressbar (~> 1.7)
67
- unicode-display_width (>= 1.4.0, < 1.7)
68
- ruby-prof (1.1.0)
69
- ruby-progressbar (1.10.1)
70
- simplecov (0.20.0)
75
+ unicode-display_width (>= 2.4.0, < 3.0)
76
+ rubocop-ast (1.26.0)
77
+ parser (>= 3.2.1.0)
78
+ rubocop-capybara (2.17.1)
79
+ rubocop (~> 1.41)
80
+ rubocop-rspec (2.18.1)
81
+ rubocop (~> 1.33)
82
+ rubocop-capybara (~> 2.17)
83
+ ruby-prof (1.6.1)
84
+ ruby-progressbar (1.11.0)
85
+ simplecov (0.21.2)
71
86
  docile (~> 1.1)
72
87
  simplecov-html (~> 0.11)
73
88
  simplecov_json_formatter (~> 0.1)
74
89
  simplecov-html (0.12.3)
75
- simplecov_json_formatter (0.1.2)
90
+ simplecov_json_formatter (0.1.4)
76
91
  tapp (1.5.1)
77
92
  thor
78
- thor (1.0.1)
79
- tomlrb (1.2.9)
80
- unicode-display_width (1.6.0)
93
+ thor (1.2.1)
94
+ tomlrb (2.0.3)
95
+ unicode-display_width (2.4.2)
81
96
 
82
97
  PLATFORMS
83
98
  ruby
@@ -93,6 +108,7 @@ DEPENDENCIES
93
108
  rake-notes
94
109
  rspec
95
110
  rubocop
111
+ rubocop-rspec
96
112
  ruby-prof
97
113
  simplecov
98
114
  tapp
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # MasKING🤴
2
2
 
3
- [![CircleCI](https://circleci.com/gh/kibitan/masking/tree/master.svg?style=svg)](https://circleci.com/gh/kibitan/masking/tree/master)
4
- [![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)
5
- [![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)
3
+ [![CircleCI](https://circleci.com/gh/kibitan/masking/tree/main.svg?style=svg)](https://circleci.com/gh/kibitan/masking/tree/main)
4
+ [![Acceptance Test MySQL Status](https://github.com/kibitan/masking/workflows/Acceptance%20Test%20MySQL/badge.svg?branch=main)](https://github.com/kibitan/masking/actions?query=workflow%3A%22Acceptance+Test+MySQL%22+branch%3Amain)
5
+ [![Acceptance Test MariaDB Status](https://github.com/kibitan/masking/workflows/Acceptance%20Test%20MariaDB/badge.svg?branch=main)](https://github.com/kibitan/masking/actions?query=workflow%3A%22Acceptance+Test+MariaDB%22+branch%3Amain)
6
6
 
7
- [![codecov](https://codecov.io/gh/kibitan/masking/branch/master/graph/badge.svg)](https://codecov.io/gh/kibitan/masking)
7
+ [![codecov](https://codecov.io/gh/kibitan/masking/branch/main/graph/badge.svg)](https://codecov.io/gh/kibitan/masking)
8
8
  [![Maintainability](https://api.codeclimate.com/v1/badges/290b3005ecc193a3d138/maintainability)](https://codeclimate.com/github/kibitan/masking/maintainability)
9
9
  [![Gem Version](https://badge.fury.io/rb/masking.svg)](https://badge.fury.io/rb/masking)
10
10
 
@@ -18,12 +18,12 @@ gem install masking
18
18
 
19
19
  ## Requirement
20
20
 
21
- * Ruby 2.6/2.7/3.0/3.1
21
+ * Ruby 2.6/2.7/3.0/3.1/3.2
22
22
 
23
- ## Supported RDBMS
23
+ ## Supporting RDBMS
24
24
 
25
25
  * MySQL: 5.5<sup>[1](#footnote1)</sup>, 5.6, 5.7, 8.0
26
- * MariaDB: 5.5, 10.0<sup>[2](#footnote2)</sup>, 10.1, 10.2, 10.3, 10.4
26
+ * MariaDB: 5.5, 10.0<sup>[2](#footnote2)</sup>, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11
27
27
 
28
28
  ## Usage
29
29
 
@@ -47,6 +47,9 @@ gem install masking
47
47
  OTk6enp56enmlpaWNjY6Ojo4SEhP/++f/++f/++f/++f/++f/++f/++f/++f/+
48
48
  +f/++f/++f/++f/++f/++SH+Dk1hZGUgd2l0aCBHSU1QACwAAAAADAAMAAAFLC
49
49
  AgjoEwnuNAFOhpEMTRiggcz4BNJHrv/zCFcLiwMWYNG84BwwEeECcgggoBADs=
50
+ # When a column name is suffixed with `?`, the original NULL value will not be anonymized.
51
+ # This option can be beneficial for simulating SQL execution that closely resembles the original data.
52
+ nullable_string?: anonymized nullable %{n} string
50
53
  ```
51
54
 
52
55
  A value will be implicitly converted to a compatible type. If you prefer to explicitly convert, you could use a tag as defined in [YAML Version 1.1](http://yaml.org/spec/current.html#id2503753)
@@ -160,6 +163,13 @@ The docker-compose file names for other database versions, specify that file.
160
163
  * MySQL 5.7: [`docker-compose/mysql57.yml`](./docker-compose/mysql57.yml)
161
164
  * MySQL 5.6: [`docker-compose/mysql56.yml`](./docker-compose/mysql56.yml)
162
165
  * MySQL 5.5<sup>[1](#footnote1)</sup>: [`docker-compose/mysql55.yml`](./docker-compose/mysql55.yml)
166
+ * MariaDB 10.11: [`docker-compose/mariadb1011.yml`](./docker-compose/mariadb1011.yml)
167
+ * MariaDB 10.10: [`docker-compose/mariadb1010.yml`](./docker-compose/mariadb1010.yml)
168
+ * MariaDB 10.9: [`docker-compose/mariadb109.yml`](./docker-compose/mariadb109.yml)
169
+ * MariaDB 10.8: [`docker-compose/mariadb108.yml`](./docker-compose/mariadb108.yml)
170
+ * MariaDB 10.7: [`docker-compose/mariadb107.yml`](./docker-compose/mariadb107.yml)
171
+ * MariaDB 10.6: [`docker-compose/mariadb106.yml`](./docker-compose/mariadb106.yml)
172
+ * MariaDB 10.5: [`docker-compose/mariadb105.yml`](./docker-compose/mariadb105.yml)
163
173
  * MariaDB 10.4: [`docker-compose/mariadb104.yml`](./docker-compose/mariadb104.yml)
164
174
  * MariaDB 10.3: [`docker-compose/mariadb103.yml`](./docker-compose/mariadb103.yml)
165
175
  * MariaDB 10.2: [`docker-compose/mariadb102.yml`](./docker-compose/mariadb102.yml)
@@ -238,7 +248,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
238
248
 
239
249
  ## Code of Conduct
240
250
 
241
- 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).
251
+ 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/main/CODE_OF_CONDUCT.md).
242
252
 
243
253
  <a name="footnote1">1</a>: <small> MySQL 5.5 is already not supported by [official](https://www.mysql.com/support/supportedplatforms/database.html)</small>
244
254
 
@@ -1,33 +1,39 @@
1
1
  *************************** 1. row ***************************
2
- id: 1
3
- string: anonymized string
4
- email: anonymized+1@example.com
5
- integer: 12345
6
- float: 123.45
7
- boolean: 1
8
- null: NULL
9
- date: 2018-08-24
10
- time: 2018-08-24 15:54:06
11
- binary_or_blob: \x92
2
+ id: 1
3
+ string: anonymized string
4
+ email: anonymized+1@example.com
5
+ integer: 12345
6
+ float: 123.45
7
+ boolean: 1
8
+ null: NULL
9
+ date: 2018-08-24
10
+ time: 2018-08-24 15:54:06
11
+ binary_or_blob: \x92
12
+ nullable_string: string1
13
+ nullable_integer: NULL
12
14
  *************************** 2. row ***************************
13
- id: 2
14
- string: anonymized string
15
- email: anonymized+2@example.com
16
- integer: 12345
17
- float: 123.45
18
- boolean: 1
19
- null: NULL
20
- date: 2018-08-24
21
- time: 2018-08-24 15:54:06
22
- binary_or_blob: \x92\x92
15
+ id: 2
16
+ string: anonymized string
17
+ email: anonymized+2@example.com
18
+ integer: 12345
19
+ float: 123.45
20
+ boolean: 1
21
+ null: NULL
22
+ date: 2018-08-24
23
+ time: 2018-08-24 15:54:06
24
+ binary_or_blob: \x92\x92
25
+ nullable_string: NULL
26
+ nullable_integer: 33333
23
27
  *************************** 3. row ***************************
24
- id: 3
25
- string: anonymized string
26
- email: anonymized+3@example.com
27
- integer: 12345
28
- float: 123.45
29
- boolean: 1
30
- null: NULL
31
- date: 2018-08-24
32
- time: 2018-08-24 15:54:06
33
- binary_or_blob: NULL
28
+ id: 3
29
+ string: anonymized string
30
+ email: anonymized+3@example.com
31
+ integer: 12345
32
+ float: 123.45
33
+ boolean: 1
34
+ null: NULL
35
+ date: 2018-08-24
36
+ time: 2018-08-24 15:54:06
37
+ binary_or_blob: NULL
38
+ nullable_string: string3
39
+ nullable_integer: 33333
@@ -33,6 +33,8 @@ CREATE TABLE `users` (
33
33
  `date` date DEFAULT NULL,
34
34
  `time` timestamp NULL DEFAULT NULL,
35
35
  `binary_or_blob` binary(11) DEFAULT NULL,
36
+ `nullable_string` varchar(20) DEFAULT '',
37
+ `nullable_integer` int(11) DEFAULT NULL,
36
38
  PRIMARY KEY (`id`)
37
39
  ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
38
40
  /*!40101 SET character_set_client = @saved_cs_client */;
@@ -43,7 +45,7 @@ CREATE TABLE `users` (
43
45
 
44
46
  LOCK TABLES `users` WRITE;
45
47
  /*!40000 ALTER TABLE `users` DISABLE KEYS */;
46
- INSERT INTO `users` (`id`, `string`, `email`, `integer`, `float`, `boolean`, `null`, `date`, `time`, `binary_or_blob`) VALUES (1,'example@exa','test@example.com',1245,2.1,1,-321,NULL,NULL,_binary '\\x92\0\0\0\0\0\0\0'),(2,'あいうえお','invalid@email',0,-23.4422,0,321,NULL,NULL,_binary '\\x92\\x92\0\0\0'),(3,'+-l;a*&^%$','chikahiro@test.com',-1,21.2321,NULL,-231321,'2019-10-31','2019-10-31 16:27:21',NULL);
48
+ INSERT INTO `users` (`id`, `string`, `email`, `integer`, `float`, `boolean`, `null`, `date`, `time`, `binary_or_blob`, `nullable_string`, `nullable_integer`) VALUES (1,'example@exa','test@example.com',1245,2.1,1,-321,NULL,NULL,_binary '\\x92\0\0\0\0\0\0\0','abcde',NULL),(2,'あいうえお','invalid@email',0,-23.4422,0,321,NULL,NULL,_binary '\\x92\\x92\0\0\0',NULL,12),(3,'+-l;a*&^%$','chikahiro@test.com',-1,21.2321,NULL,-231321,'2019-10-31','2019-10-31 16:27:21',NULL,'abc123',-123);
47
49
  /*!40000 ALTER TABLE `users` ENABLE KEYS */;
48
50
  UNLOCK TABLES;
49
51
  /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@@ -7,6 +7,8 @@ users:
7
7
  'null': NULL
8
8
  date: 2018-08-24
9
9
  time: 2018-08-24 15:54:06
10
+ nullable_string?: string%{n}
11
+ nullable_integer?: 33333
10
12
  ## TODO: something not working well with binary...
11
13
  # binary_or_blob: !binary |
12
14
  # R0lGODlhDAAMAIQAAP//9/X17unp5WZmZgAAAOfn515eXvPz7Y6OjuDg4J+fn5
@@ -22,4 +22,4 @@ mysql -h "$MYSQL_HOST" -u "$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DBNAME" < "$
22
22
 
23
23
  ## compare
24
24
  mysql -h "$MYSQL_HOST" -u "$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DBNAME" -e 'SELECT * FROM users ORDER BY id;' --vertical > "$FILEDIR/tmp/query_result.txt"
25
- diff "$FILEDIR/tmp/query_result.txt" "$FILEDIR/expected_query_result.txt" && echo 'test passed!'
25
+ diff "$FILEDIR/expected_query_result.txt" "$FILEDIR/tmp/query_result.txt" && echo 'test passed!'
@@ -0,0 +1,17 @@
1
+ version: '3.7'
2
+
3
+ services:
4
+ app:
5
+ build:
6
+ target: with-mysql-client
7
+ depends_on:
8
+ - mariadb1010
9
+ entrypoint: docker-compose/wait-for-mysql.sh mariadb1010
10
+
11
+ mariadb1010:
12
+ image: mariadb:10.10
13
+ environment:
14
+ MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
15
+ MYSQL_USER: mysqluser
16
+ MYSQL_PASSWORD: password
17
+ MYSQL_DATABASE: mydb