pii_safe_schema 1.3.1 → 1.3.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37742fbd9ebda37050c8e0b851cbfaba6a8a6eedc70283e46a393bcdc2baf1c0
4
- data.tar.gz: 285e70b4e2aabf1a089471044c6495f685fa9b187cbc5514a42e7d3eafbd8b4b
3
+ metadata.gz: 4f677294564a5231127e5e758c457cd3c531f1cfcd58068804ff8ea4a7f686b8
4
+ data.tar.gz: 7284fd0894a4faa5daf6e19c694e21d959c23facab595319fb82a451089d3007
5
5
  SHA512:
6
- metadata.gz: 1528541842d2b5af3a78d06ec7711eccb372f317b8f12fc9850435ce4d326dae796ebcbc43c8b2dd355dd24d737eb60c3d4a8d86a098a5d1a784bb06168e9dc6
7
- data.tar.gz: cb2af9ed4ac8019c201394ad2e3a4ec5263ce56ca2c1a631b980c8f4252eb4ce2928f003544bdbb1136cf92dfecf6a9b08e9109c3d1958db23e4aa9dd3f96e60
6
+ metadata.gz: 47451b3917dd536b31ef3048b8a86171df58bc02bbc58c9b7b3a4c790805f89bef5d178e876ebf6d577d17b4245e9ba47be28ca11cff82ea0486420399a3bfc9
7
+ data.tar.gz: d4bffc7c730d25604572a25b92c7b1ebc16f87db519ad16a62cc8d2c728c6950775dcc1fbfebe29dac6e6c82423483fbbe2ffe3280f0d101a307c4e369c5e9d3
@@ -0,0 +1,66 @@
1
+ name: Default
2
+
3
+ # This workflow runs on all pushes to the repo so we can test changes and provide
4
+ # fast feedback. It also gets run when a pull request is created so that we can
5
+ # run the Sonarqube quality gate (which needs information from the PR). Subsequent
6
+ # pushes to the branch will provide PR information of any open PRs.
7
+ on:
8
+ push:
9
+ pull_request:
10
+ types: [opened, reopened]
11
+
12
+ concurrency:
13
+ group: default-${{ github.ref }}
14
+ cancel-in-progress: true
15
+
16
+ jobs:
17
+ preflight_check:
18
+ name: Preflight Check
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ # Need to fetch all refs, so we can check if the version has been bumped
22
+ - uses: actions/checkout@v2
23
+ with:
24
+ fetch-depth: 0
25
+
26
+ - uses: ruby/setup-ruby@v1
27
+ with:
28
+ bundler-cache: true
29
+
30
+ - name: Lint
31
+ uses: wealthsimple/toolbox-script@v1
32
+ with:
33
+ script: toolbox.ruby.lint.run();
34
+
35
+ - name: Test
36
+ uses: wealthsimple/toolbox-script@v1
37
+ with:
38
+ script: toolbox.ruby.test.run();
39
+
40
+ publish:
41
+ name: Publish package
42
+ runs-on: ubuntu-latest
43
+ if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
44
+ needs:
45
+ - preflight_check
46
+ steps:
47
+ - uses: actions/checkout@v2
48
+
49
+ - uses: ruby/setup-ruby@v1
50
+ with:
51
+ bundler-cache: true
52
+
53
+ - name: Release the gem
54
+ run: |
55
+ mkdir -p ~/.gem
56
+ cat << EOF > ~/.gem/credentials
57
+ ---
58
+ :github: Bearer ${GITHUB_TOKEN}
59
+ :rubygems_api_key: ${RUBYGEMS_API_KEY}
60
+ EOF
61
+ chmod 0600 ~/.gem/credentials
62
+ git config user.email "noreply@wealthsimple.com"
63
+ git config user.name "Wolfbot"
64
+ bundle exec rake release
65
+ env:
66
+ RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
data/.rubocop.yml CHANGED
@@ -1,3 +1,7 @@
1
+ ---
1
2
  inherit_gem:
2
3
  ws-style:
3
4
  - default.yml
5
+
6
+ AllCops:
7
+ TargetRubyVersion: 2.6
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.5
1
+ 2.7.2
data/CHANGELOG.md CHANGED
@@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## 1.3.4 - 2021-10-21
8
+ ### Changed
9
+ - Switched to Github Actions
10
+
11
+ ## 1.3.4 - 2021-03-15
12
+ ### Changed
13
+ - Add support for Rails 7
14
+
15
+ ## 1.3.3 - 2021-03-15
16
+ ### Changed
17
+ - Pull CI images from ECR repository
18
+
19
+ ## 1.3.2 - 2021-03-15
20
+ ### Changed
21
+ - Update development to Ruby 2.7.2
22
+
7
23
  ## 1.3.1 - 2019-11-06
8
24
  ### Fixed
9
25
  - Passing arguments to `rake pii_safe_schema:generate_migrations` actually works
@@ -28,7 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
28
44
  - Added MIT License
29
45
 
30
46
  ## 1.0.4 - 2019-4-16
31
- ### Fixed
47
+ ### Fixed
32
48
  - converted any hyphens to underscores for consistency.
33
49
 
34
50
  ## 1.0.3
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
- # PII Safe Schema [![CircleCI](https://circleci.com/gh/wealthsimple/pii_safe_schema.svg?style=svg)](https://circleci.com/gh/wealthsimple/pii_safe_schema) [![Coverage Status](https://coveralls.io/repos/github/wealthsimple/pii_safe_schema/badge.svg?branch=master)](https://coveralls.io/github/wealthsimple/pii_safe_schema?branch=master)
1
+ # PII Safe Schema
2
+ ![CI](https://github.com/wealthsimple/pii_safe_schema/actions/workflows/default.yml/badge.svg)
2
3
 
3
4
  Schema migration tool for checking and adding comments on *Personally Identifiable Information* (PII) columns in Rails.
4
5
 
@@ -96,4 +97,4 @@ git clone https://github.com/wealthsimple/pii_safe_schema.git
96
97
  cd pii_safe_schema
97
98
  bundle install
98
99
  bundle exec rspec
99
- ```
100
+ ```
@@ -27,11 +27,10 @@ module PiiSafeSchema
27
27
  end
28
28
 
29
29
  def datadog_client
30
- @datadog_client ||= begin
31
- KNOWN_DD_CLIENTS.each do |client|
32
- return client.safe_constantize if defined?(client)
30
+ @datadog_client ||=
31
+ KNOWN_DD_CLIENTS.find do |client|
32
+ client.safe_constantize if defined?(client)
33
33
  end
34
- end
35
34
  end
36
35
 
37
36
  def ignore_tables
@@ -47,7 +46,7 @@ module PiiSafeSchema
47
46
  def validate_ignore(ignore_params)
48
47
  raise_config_error(:ignore) unless ignore_params.is_a?(Hash)
49
48
 
50
- ignore_params.values.each do |ip|
49
+ ignore_params.each_value do |ip|
51
50
  raise_config_error(:ignore) unless valid_column_list?(ip) || ip == :*
52
51
  end
53
52
  true
@@ -18,9 +18,7 @@ module PiiSafeSchema
18
18
  migration_file = generator.create_migration_file
19
19
  file_lines = File.open(migration_file, 'r').read.split("\n")
20
20
  change_line = file_lines.find_index { |i| /def change/.match(i) }
21
- new_contents = file_lines[0..change_line] +
22
- generated_lines +
23
- file_lines[change_line + 1..-1]
21
+ new_contents = file_lines[0..change_line] + generated_lines + file_lines[change_line + 1..]
24
22
 
25
23
  File.open(migration_file, 'w') do |f|
26
24
  f.write(new_contents.join("\n"))
@@ -33,8 +31,8 @@ module PiiSafeSchema
33
31
  def generate_migration_lines(table, columns)
34
32
  migration_lines = columns.map do |c|
35
33
  "#{' ' * (safety_assured? ? 6 : 4)}"\
36
- "change_column :#{table}, :#{c.column.name}, :#{c.column.type}, "\
37
- "comment: \'#{c.suggestion.to_json}\'"\
34
+ "change_column :#{table}, :#{c.column.name}, :#{c.column.type}, "\
35
+ "comment: \'#{c.suggestion.to_json}\'"\
38
36
  end
39
37
  wrap_in_safety_assured(migration_lines)
40
38
  end
@@ -1,3 +1,3 @@
1
1
  module PiiSafeSchema
2
- VERSION = '1.3.1'.freeze
2
+ VERSION = '1.3.5'.freeze
3
3
  end
@@ -55,7 +55,7 @@ module PiiSafeSchema
55
55
  end
56
56
  end
57
57
 
58
- def self.print_help!(do_exit: true) # rubocop:disable Metrics/MethodLength
58
+ def self.print_help!(do_exit: true)
59
59
  puts <<~HELPMSG # rubocop:disable Rails/Output
60
60
  Usage:
61
61
  rake pii_safe_schema:generate_migrations [table:column:annotation_type] ...
@@ -11,7 +11,7 @@ namespace :pii_safe_schema do
11
11
 
12
12
  exit(0) # forces rake to stop after this and not assume args are tasks
13
13
  rescue ActiveRecord::StatementInvalid, PiiSafeSchema::InvalidColumnError => e
14
- raise e if e.class == ActiveRecord::StatementInvalid && e.cause.class != PG::UndefinedTable
14
+ raise e if e.instance_of?(ActiveRecord::StatementInvalid) && e.cause.class != PG::UndefinedTable
15
15
 
16
16
  puts <<~HEREDOC
17
17
  Unable to generate PII annotation migration. Either the underlying table or column does not exist:
@@ -10,6 +10,8 @@ Gem::Specification.new do |s|
10
10
 
11
11
  s.summary = 'Schema migration tool for checking and adding comments on PII columns.'
12
12
  s.homepage = 'https://github.com/wealthsimple/pii_safe_schema'
13
+ s.license = "MIT"
14
+ s.required_ruby_version = Gem::Requirement.new(">= 2.6")
13
15
 
14
16
  s.files = `git ls-files -z`.split("\x0").reject do |f|
15
17
  f.match(%r{^(test|spec|features)/})
@@ -19,18 +21,16 @@ Gem::Specification.new do |s|
19
21
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
22
  s.require_paths = ['lib']
21
23
 
22
- s.add_dependency 'activesupport', '>= 5', '< 7'
23
24
  s.add_dependency 'colorize'
24
- s.add_dependency 'rails', '>= 5', '< 7'
25
+ s.add_dependency 'rails', '>= 5', '< 8'
25
26
 
26
27
  s.add_development_dependency 'bundler', '>= 1.16'
27
28
  s.add_development_dependency 'bundler-audit'
28
- s.add_development_dependency 'coveralls'
29
29
  s.add_development_dependency 'dogstatsd-ruby'
30
30
  s.add_development_dependency 'git'
31
31
  s.add_development_dependency 'guard-rspec'
32
32
  s.add_development_dependency 'pry'
33
- s.add_development_dependency 'rails', '>= 5.2.3', '< 7'
33
+ s.add_development_dependency 'rails', '>= 5', '< 8'
34
34
  s.add_development_dependency 'rake', '>= 10.0'
35
35
  s.add_development_dependency 'rspec', '< 4', '>= 3.0'
36
36
  s.add_development_dependency 'rspec-collection_matchers'
metadata CHANGED
@@ -1,35 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pii_safe_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexi Garrow
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-08 00:00:00.000000000 Z
11
+ date: 2022-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: activesupport
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '5'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '7'
23
- type: :runtime
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: '5'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '7'
33
13
  - !ruby/object:Gem::Dependency
34
14
  name: colorize
35
15
  requirement: !ruby/object:Gem::Requirement
@@ -53,7 +33,7 @@ dependencies:
53
33
  version: '5'
54
34
  - - "<"
55
35
  - !ruby/object:Gem::Version
56
- version: '7'
36
+ version: '8'
57
37
  type: :runtime
58
38
  prerelease: false
59
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -63,7 +43,7 @@ dependencies:
63
43
  version: '5'
64
44
  - - "<"
65
45
  - !ruby/object:Gem::Version
66
- version: '7'
46
+ version: '8'
67
47
  - !ruby/object:Gem::Dependency
68
48
  name: bundler
69
49
  requirement: !ruby/object:Gem::Requirement
@@ -92,20 +72,6 @@ dependencies:
92
72
  - - ">="
93
73
  - !ruby/object:Gem::Version
94
74
  version: '0'
95
- - !ruby/object:Gem::Dependency
96
- name: coveralls
97
- requirement: !ruby/object:Gem::Requirement
98
- requirements:
99
- - - ">="
100
- - !ruby/object:Gem::Version
101
- version: '0'
102
- type: :development
103
- prerelease: false
104
- version_requirements: !ruby/object:Gem::Requirement
105
- requirements:
106
- - - ">="
107
- - !ruby/object:Gem::Version
108
- version: '0'
109
75
  - !ruby/object:Gem::Dependency
110
76
  name: dogstatsd-ruby
111
77
  requirement: !ruby/object:Gem::Requirement
@@ -168,20 +134,20 @@ dependencies:
168
134
  requirements:
169
135
  - - ">="
170
136
  - !ruby/object:Gem::Version
171
- version: 5.2.3
137
+ version: '5'
172
138
  - - "<"
173
139
  - !ruby/object:Gem::Version
174
- version: '7'
140
+ version: '8'
175
141
  type: :development
176
142
  prerelease: false
177
143
  version_requirements: !ruby/object:Gem::Requirement
178
144
  requirements:
179
145
  - - ">="
180
146
  - !ruby/object:Gem::Version
181
- version: 5.2.3
147
+ version: '5'
182
148
  - - "<"
183
149
  - !ruby/object:Gem::Version
184
- version: '7'
150
+ version: '8'
185
151
  - !ruby/object:Gem::Dependency
186
152
  name: rake
187
153
  requirement: !ruby/object:Gem::Requirement
@@ -200,22 +166,22 @@ dependencies:
200
166
  name: rspec
201
167
  requirement: !ruby/object:Gem::Requirement
202
168
  requirements:
203
- - - ">="
204
- - !ruby/object:Gem::Version
205
- version: '3.0'
206
169
  - - "<"
207
170
  - !ruby/object:Gem::Version
208
171
  version: '4'
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '3.0'
209
175
  type: :development
210
176
  prerelease: false
211
177
  version_requirements: !ruby/object:Gem::Requirement
212
178
  requirements:
213
- - - ">="
214
- - !ruby/object:Gem::Version
215
- version: '3.0'
216
179
  - - "<"
217
180
  - !ruby/object:Gem::Version
218
181
  version: '4'
182
+ - - ">="
183
+ - !ruby/object:Gem::Version
184
+ version: '3.0'
219
185
  - !ruby/object:Gem::Dependency
220
186
  name: rspec-collection_matchers
221
187
  requirement: !ruby/object:Gem::Requirement
@@ -335,9 +301,9 @@ executables: []
335
301
  extensions: []
336
302
  extra_rdoc_files: []
337
303
  files:
338
- - ".circleci/config.yml"
339
304
  - ".github/CODEOWNERS"
340
305
  - ".github/PULL_REQUEST_TEMPLATE.md"
306
+ - ".github/workflows/default.yml"
341
307
  - ".gitignore"
342
308
  - ".rspec"
343
309
  - ".rubocop.yml"
@@ -363,7 +329,8 @@ files:
363
329
  - lib/tasks/pii_safe_schema.rake
364
330
  - pii_safe_schema.gemspec
365
331
  homepage: https://github.com/wealthsimple/pii_safe_schema
366
- licenses: []
332
+ licenses:
333
+ - MIT
367
334
  metadata: {}
368
335
  post_install_message:
369
336
  rdoc_options: []
@@ -373,14 +340,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
373
340
  requirements:
374
341
  - - ">="
375
342
  - !ruby/object:Gem::Version
376
- version: '0'
343
+ version: '2.6'
377
344
  required_rubygems_version: !ruby/object:Gem::Requirement
378
345
  requirements:
379
346
  - - ">="
380
347
  - !ruby/object:Gem::Version
381
348
  version: '0'
382
349
  requirements: []
383
- rubygems_version: 3.0.3
350
+ rubygems_version: 3.1.4
384
351
  signing_key:
385
352
  specification_version: 4
386
353
  summary: Schema migration tool for checking and adding comments on PII columns.
data/.circleci/config.yml DELETED
@@ -1,118 +0,0 @@
1
- version: 2
2
-
3
- defaults: &defaults
4
- working_directory: /home/circleci/wealthsimple
5
- docker:
6
- - image: circleci/ruby:2.6.5
7
- - image: circleci/postgres:9.5.9-alpine
8
- environment:
9
- POSTGRES_USER: circleci
10
- POSTGRES_DB: pii_safe_schema_test
11
-
12
- # These are common snippets that are referenced in multiple workflows.
13
- references:
14
- attach_code_workspace: &attach_code_workspace
15
- attach_workspace:
16
- at: /home/circleci/wealthsimple
17
-
18
- restore_bundle_dependencies: &restore_bundle_dependencies
19
- run:
20
- name: Restore bundle dependencies from workspace
21
- command: bundle --path vendor/bundle
22
-
23
- jobs:
24
- checkout_and_bundle:
25
- <<: *defaults
26
- steps:
27
- - checkout
28
- - run:
29
- command: bundle install --jobs=4 --retry=3 --path vendor/bundle
30
- - persist_to_workspace:
31
- root: .
32
- paths: .
33
-
34
- rspec:
35
- <<: *defaults
36
- steps:
37
- - *attach_code_workspace
38
- - *restore_bundle_dependencies
39
- - run:
40
- command: sudo apt install -y postgresql-client || true
41
- - run:
42
- command: bundle exec bundle-audit update && bundle exec bundle-audit check
43
- - run:
44
- command: bundle exec rspec
45
-
46
- lint_check:
47
- <<: *defaults
48
- steps:
49
- - *attach_code_workspace
50
- - *restore_bundle_dependencies
51
- - run:
52
- command: bundle exec rubocop
53
-
54
- vulnerability_check:
55
- <<: *defaults
56
- steps:
57
- - *attach_code_workspace
58
- - *restore_bundle_dependencies
59
- - run:
60
- command: bundle exec bundle-audit update && bundle exec bundle-audit check
61
-
62
- release:
63
- <<: *defaults
64
- steps:
65
- - add_ssh_keys:
66
- fingerprints:
67
- - "46:b5:cb:ee:57:dc:14:95:31:be:12:13:4f:11:94:a4"
68
- - *attach_code_workspace
69
- - *restore_bundle_dependencies
70
- - run:
71
- name: Release to rubygems.org
72
- command: |
73
- mkdir ~/.gem
74
- echo ":rubygems_api_key: ${RUBYGEMS_API_KEY}" >> ~/.gem/credentials
75
- chmod 600 ~/.gem/credentials
76
- mkdir -p ~/.ssh
77
- echo "github.com,192.30.253.112 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==" >> ~/.ssh/known_hosts
78
- bundle exec rake release
79
-
80
- workflows:
81
- version: 2
82
- build_and_test:
83
- jobs:
84
- - checkout_and_bundle:
85
- context: wealthsimple
86
- - rspec:
87
- requires:
88
- - checkout_and_bundle
89
- - lint_check:
90
- requires:
91
- - checkout_and_bundle
92
- - vulnerability_check:
93
- requires:
94
- - checkout_and_bundle
95
- - release:
96
- context: wealthsimple
97
- filters:
98
- branches:
99
- only: master
100
- requires:
101
- - rspec
102
- - lint_check
103
- - vulnerability_check
104
-
105
- security-audit:
106
- triggers:
107
- - schedule:
108
- # 11:45 am UTC: 6:45 am EST / 7:45 am EDT
109
- cron: "45 11 * * *"
110
- filters:
111
- branches:
112
- only: master
113
- jobs:
114
- - checkout_and_bundle:
115
- context: wealthsimple
116
- - vulnerability_check:
117
- requires:
118
- - checkout_and_bundle