blouson 2.0.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +12 -21
- data/.gitignore +1 -0
- data/Appraisals +9 -16
- data/CHANGELOG.md +17 -0
- data/blouson.gemspec +2 -2
- data/gemfiles/rails_7.0.gemfile +1 -0
- data/gemfiles/{rails_5.0.gemfile → rails_7.1.gemfile} +1 -1
- data/gemfiles/{rails_5.1.gemfile → rails_7.2.gemfile} +1 -1
- data/gemfiles/{rails_5.2.gemfile → rails_8.0.gemfile} +1 -1
- data/lib/blouson/engine.rb +6 -1
- data/lib/blouson/sensitive_query_filter.rb +43 -14
- data/lib/blouson/sensitive_table_query_log_silencer.rb +5 -5
- data/lib/blouson/version.rb +1 -1
- data/lib/blouson.rb +1 -1
- metadata +11 -16
- data/gemfiles/rails_6.0.gemfile +0 -7
- data/gemfiles/rails_6.1.gemfile +0 -7
- /data/lib/blouson/{sensitive_params_silener.rb → sensitive_params_silencer.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: debaa94dc33912dc0432b49d4f73e3b3753ad5a335d14d7aff5be862790f5aec
|
4
|
+
data.tar.gz: 64ee1c8a595e0101e87c5316554a3b937188fd2d82cb9c5eb66aacf53b394496
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46fed87bbd604f81ec7e5c599efc89681db1d0a25fe7be3d3249d1b1ae6e08cf5cf81fb26429be086caf1221b4e776f7433fea4cc37853704d5a624085a44829
|
7
|
+
data.tar.gz: e87e60345dd41be9c51274f2ac718c77bc9a4b5e88300bad64daaa8fd70b5af6f5ddc21f7d910a9bbcad134834acbe672ed6bf2bca9e50d5cbda016d08fcd564
|
data/.github/workflows/ci.yml
CHANGED
@@ -11,38 +11,29 @@ jobs:
|
|
11
11
|
fail-fast: false
|
12
12
|
matrix:
|
13
13
|
ruby:
|
14
|
-
- '2.6'
|
15
|
-
- '2.7'
|
16
14
|
- '3.0'
|
17
15
|
- '3.1'
|
16
|
+
- '3.2'
|
17
|
+
- '3.3'
|
18
|
+
- '3.4'
|
18
19
|
gemfile:
|
19
|
-
- rails_5.0
|
20
|
-
- rails_5.1
|
21
|
-
- rails_5.2
|
22
|
-
- rails_6.0
|
23
|
-
- rails_6.1
|
24
20
|
- rails_7.0
|
21
|
+
- rails_7.1
|
22
|
+
- rails_7.2
|
23
|
+
- rails_8.0
|
25
24
|
exclude:
|
26
|
-
# Ruby >= 3.0 is supported since Rails 6.0
|
27
25
|
- ruby: '3.0'
|
28
|
-
gemfile:
|
26
|
+
gemfile: rails_7.2
|
29
27
|
- ruby: '3.0'
|
30
|
-
gemfile:
|
31
|
-
- ruby: '3.0'
|
32
|
-
gemfile: rails_5.2
|
33
|
-
- ruby: '3.1'
|
34
|
-
gemfile: rails_5.0
|
35
|
-
- ruby: '3.1'
|
36
|
-
gemfile: rails_5.1
|
28
|
+
gemfile: rails_8.0
|
37
29
|
- ruby: '3.1'
|
38
|
-
gemfile:
|
39
|
-
|
40
|
-
- ruby: '2.6'
|
30
|
+
gemfile: rails_8.0
|
31
|
+
- ruby: '3.4'
|
41
32
|
gemfile: rails_7.0
|
42
33
|
name: Run test with Ruby ${{ matrix.ruby }} and Gemfile ${{ matrix.gemfile }}
|
43
34
|
services:
|
44
35
|
mysql:
|
45
|
-
image: mysql:
|
36
|
+
image: mysql:8.4
|
46
37
|
env:
|
47
38
|
MYSQL_ALLOW_EMPTY_PASSWORD: '1'
|
48
39
|
MYSQL_DATABASE: blouson
|
@@ -56,7 +47,7 @@ jobs:
|
|
56
47
|
env:
|
57
48
|
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
|
58
49
|
steps:
|
59
|
-
- uses: actions/checkout@
|
50
|
+
- uses: actions/checkout@v4
|
60
51
|
- uses: ruby/setup-ruby@v1
|
61
52
|
with:
|
62
53
|
ruby-version: ${{ matrix.ruby }}
|
data/.gitignore
CHANGED
data/Appraisals
CHANGED
@@ -1,25 +1,18 @@
|
|
1
|
-
appraise 'rails-
|
2
|
-
gem 'rails', '~>
|
3
|
-
|
4
|
-
|
5
|
-
appraise 'rails-5.1' do
|
6
|
-
gem 'rails', '~> 5.1.0'
|
7
|
-
end
|
8
|
-
|
9
|
-
appraise 'rails-5.2' do
|
10
|
-
gem 'rails', '~> 5.2.0'
|
1
|
+
appraise 'rails-7.0' do
|
2
|
+
gem 'rails', '~> 7.0.0'
|
3
|
+
gem 'concurrent-ruby', '1.3.4'
|
11
4
|
end
|
12
5
|
|
13
|
-
appraise 'rails-
|
14
|
-
gem 'rails', '~>
|
6
|
+
appraise 'rails-7.1' do
|
7
|
+
gem 'rails', '~> 7.1.0'
|
15
8
|
end
|
16
9
|
|
17
|
-
appraise 'rails-
|
18
|
-
gem 'rails', '~>
|
10
|
+
appraise 'rails-7.2' do
|
11
|
+
gem 'rails', '~> 7.2.0'
|
19
12
|
end
|
20
13
|
|
21
|
-
appraise 'rails-
|
22
|
-
gem 'rails', '~>
|
14
|
+
appraise 'rails-8.0' do
|
15
|
+
gem 'rails', '~> 8.0.0'
|
23
16
|
end
|
24
17
|
|
25
18
|
# vim: set ft=ruby:
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,20 @@
|
|
1
|
+
# 4.0.0 (2025-02-04)
|
2
|
+
- [Breaking change] Drop support for arproxy v0. Please update >= v1
|
3
|
+
- [Breaking change] Drop support for Ruby 2.7
|
4
|
+
- [Breaking change] Drop support for Rails 6.0 & 6.1
|
5
|
+
- Support Ruby 3.4
|
6
|
+
- Support Rails 7.2 & 8.0
|
7
|
+
|
8
|
+
# 3.0.0 (2024-09-18)
|
9
|
+
- [Breaking change] Drop support for Ruby 2.6
|
10
|
+
- [Breaking change] Drop support for Rails 5.0, 5.1, and 5.2
|
11
|
+
- Support Ruby 3.2 and 3.3
|
12
|
+
- Support Rails 7.1
|
13
|
+
- [Breaking change] blouson/sensitive_params_silener is renamed to blouson/sensitive_params_silencer
|
14
|
+
- Use `Rails.logger.debug?` for loggers other than the default Logger class
|
15
|
+
- Run tests with MySQL 8.4 instead of 5.7
|
16
|
+
- Ignore lockfiles for Appraisal for the development
|
17
|
+
|
1
18
|
# 2.0.0 (2022-05-23)
|
2
19
|
- Support parameter filter for `sentry-ruby` gem
|
3
20
|
- [Breaking change] Drop dependency of `sentry-raven` gem
|
data/blouson.gemspec
CHANGED
@@ -21,9 +21,9 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
|
24
|
-
spec.add_dependency 'rails', '>=
|
24
|
+
spec.add_dependency 'rails', '>= 7.0.0'
|
25
25
|
|
26
|
-
spec.add_development_dependency 'arproxy'
|
26
|
+
spec.add_development_dependency 'arproxy', '>= 1.0.0'
|
27
27
|
spec.add_development_dependency 'mysql2'
|
28
28
|
spec.add_development_dependency 'pry'
|
29
29
|
spec.add_development_dependency 'sentry-raven'
|
data/gemfiles/rails_7.0.gemfile
CHANGED
data/lib/blouson/engine.rb
CHANGED
@@ -6,7 +6,7 @@ module Blouson
|
|
6
6
|
|
7
7
|
# We have to prevent logging sensitive data in SQL if production mode and logger level is debug
|
8
8
|
initializer 'blouson.load_helpers' do |app|
|
9
|
-
if !Rails.env.development? && Rails.logger.
|
9
|
+
if !Rails.env.development? && Rails.logger.debug?
|
10
10
|
ActiveSupport.on_load(:action_controller) do
|
11
11
|
around_action Blouson::SensitiveParamsSilencer
|
12
12
|
end
|
@@ -19,6 +19,11 @@ module Blouson
|
|
19
19
|
ActiveRecord::StatementInvalid.class_eval do
|
20
20
|
prepend Blouson::SensitiveQueryFilter::StatementInvalidErrorFilter
|
21
21
|
end
|
22
|
+
if Rails::VERSION::MAJOR >= 7 && Rails::VERSION::MINOR >= 1 && defined?(Mysql2::Error)
|
23
|
+
ActiveRecord::ConnectionAdapters::AbstractAdapter.class_eval do
|
24
|
+
prepend Blouson::SensitiveQueryFilter::AbstractAdapterFilter
|
25
|
+
end
|
26
|
+
end
|
22
27
|
end
|
23
28
|
end
|
24
29
|
end
|
@@ -15,33 +15,43 @@ module Blouson
|
|
15
15
|
end
|
16
16
|
|
17
17
|
module StatementInvalidErrorFilter
|
18
|
-
def initialize(message = nil,
|
19
|
-
if SensitiveQueryFilter.contain_sensitive_query?(message) ||
|
18
|
+
def initialize(message = nil, sql: nil, binds: nil, connection_pool: nil)
|
19
|
+
if SensitiveQueryFilter.contain_sensitive_query?(message) || SensitiveQueryFilter.contain_sensitive_query?(sql)
|
20
20
|
message = SensitiveQueryFilter.filter_sensitive_words(message) if message
|
21
21
|
sql = SensitiveQueryFilter.filter_sensitive_words(sql) if sql
|
22
22
|
if defined?(Mysql2::Error)
|
23
|
-
if
|
24
|
-
original_exception.extend(Mysql2Filter)
|
25
|
-
elsif $!.is_a?(Mysql2::Error)
|
23
|
+
if $!.is_a?(Mysql2::Error)
|
26
24
|
$!.extend(Mysql2Filter)
|
27
25
|
end
|
28
26
|
end
|
29
27
|
end
|
30
28
|
|
31
|
-
if
|
32
|
-
# Rails
|
33
|
-
|
34
|
-
|
29
|
+
if connection_pool
|
30
|
+
# Rails >= 7.1
|
31
|
+
#
|
32
|
+
# - https://github.com/rails/rails/pull/48295
|
33
|
+
super(message, sql: sql, binds: binds, connection_pool: connection_pool)
|
34
|
+
else
|
35
35
|
# Rails >= 6.0
|
36
36
|
#
|
37
37
|
# - https://github.com/rails/rails/pull/34468
|
38
38
|
super(message, sql: sql, binds: binds)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def set_query(sql, binds)
|
43
|
+
if SensitiveQueryFilter.contain_sensitive_query?(sql)
|
44
|
+
super(SensitiveQueryFilter.filter_sensitive_words(sql), binds)
|
39
45
|
else
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
46
|
+
super(sql, binds)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def to_s
|
51
|
+
if SensitiveQueryFilter.contain_sensitive_query?(sql)
|
52
|
+
SensitiveQueryFilter.filter_sensitive_words(super)
|
53
|
+
else
|
54
|
+
super
|
45
55
|
end
|
46
56
|
end
|
47
57
|
end
|
@@ -51,5 +61,24 @@ module Blouson
|
|
51
61
|
SensitiveQueryFilter.filter_sensitive_words(super)
|
52
62
|
end
|
53
63
|
end
|
64
|
+
|
65
|
+
module AbstractAdapterFilter
|
66
|
+
def log(sql, name = "SQL", binds = [], type_casted_binds = [], statement_name = nil, async: false, &block)
|
67
|
+
if Rails::VERSION::MAJOR >= 8
|
68
|
+
super(sql, name, binds, type_casted_binds, async: false, &block)
|
69
|
+
else
|
70
|
+
super(sql, name, binds, type_casted_binds, statement_name, async: false, &block)
|
71
|
+
end
|
72
|
+
rescue ActiveRecord::RecordNotUnique, Mysql2::Error => ex
|
73
|
+
if ex.cause.is_a?(Mysql2::Error)
|
74
|
+
ex.cause.extend(Mysql2Filter)
|
75
|
+
elsif $!.is_a?(Mysql2::Error)
|
76
|
+
$!.extend(Mysql2Filter)
|
77
|
+
end
|
78
|
+
raise ex
|
79
|
+
end
|
80
|
+
|
81
|
+
private :log
|
82
|
+
end
|
54
83
|
end
|
55
84
|
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
module Blouson
|
2
|
-
class SensitiveTableQueryLogSilencer < Arproxy::
|
3
|
-
def execute(sql,
|
4
|
-
if Rails.logger.
|
5
|
-
return super(sql,
|
2
|
+
class SensitiveTableQueryLogSilencer < Arproxy::Proxy
|
3
|
+
def execute(sql, context)
|
4
|
+
if !Rails.logger.debug? || !(Blouson::SENSITIVE_TABLE_REGEXP === sql)
|
5
|
+
return super(sql, context)
|
6
6
|
end
|
7
7
|
|
8
8
|
ActiveRecord::Base.logger.silence(Logger::INFO) do
|
9
9
|
Rails.logger.info " [Blouson::SensitiveTableQueryLogSilencer] SQL Log is skipped for sensitive table"
|
10
|
-
super(sql,
|
10
|
+
super(sql, context)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
data/lib/blouson/version.rb
CHANGED
data/lib/blouson.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blouson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cookpad Inc.
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-02-04 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: rails
|
@@ -16,28 +15,28 @@ dependencies:
|
|
16
15
|
requirements:
|
17
16
|
- - ">="
|
18
17
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
18
|
+
version: 7.0.0
|
20
19
|
type: :runtime
|
21
20
|
prerelease: false
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
23
22
|
requirements:
|
24
23
|
- - ">="
|
25
24
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
25
|
+
version: 7.0.0
|
27
26
|
- !ruby/object:Gem::Dependency
|
28
27
|
name: arproxy
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
30
29
|
requirements:
|
31
30
|
- - ">="
|
32
31
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
32
|
+
version: 1.0.0
|
34
33
|
type: :development
|
35
34
|
prerelease: false
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
37
36
|
requirements:
|
38
37
|
- - ">="
|
39
38
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
39
|
+
version: 1.0.0
|
41
40
|
- !ruby/object:Gem::Dependency
|
42
41
|
name: mysql2
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
@@ -169,17 +168,15 @@ files:
|
|
169
168
|
- bin/console
|
170
169
|
- bin/setup
|
171
170
|
- blouson.gemspec
|
172
|
-
- gemfiles/rails_5.0.gemfile
|
173
|
-
- gemfiles/rails_5.1.gemfile
|
174
|
-
- gemfiles/rails_5.2.gemfile
|
175
|
-
- gemfiles/rails_6.0.gemfile
|
176
|
-
- gemfiles/rails_6.1.gemfile
|
177
171
|
- gemfiles/rails_7.0.gemfile
|
172
|
+
- gemfiles/rails_7.1.gemfile
|
173
|
+
- gemfiles/rails_7.2.gemfile
|
174
|
+
- gemfiles/rails_8.0.gemfile
|
178
175
|
- lib/blouson.rb
|
179
176
|
- lib/blouson/engine.rb
|
180
177
|
- lib/blouson/raven_parameter_filter_processor.rb
|
181
178
|
- lib/blouson/sensitive_mail_log_filter.rb
|
182
|
-
- lib/blouson/
|
179
|
+
- lib/blouson/sensitive_params_silencer.rb
|
183
180
|
- lib/blouson/sensitive_query_filter.rb
|
184
181
|
- lib/blouson/sensitive_table_query_log_silencer.rb
|
185
182
|
- lib/blouson/sentry_parameter_filter.rb
|
@@ -189,7 +186,6 @@ homepage: https://github.com/cookpad/blouson
|
|
189
186
|
licenses:
|
190
187
|
- MIT
|
191
188
|
metadata: {}
|
192
|
-
post_install_message:
|
193
189
|
rdoc_options: []
|
194
190
|
require_paths:
|
195
191
|
- lib
|
@@ -204,8 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
200
|
- !ruby/object:Gem::Version
|
205
201
|
version: '0'
|
206
202
|
requirements: []
|
207
|
-
rubygems_version: 3.2
|
208
|
-
signing_key:
|
203
|
+
rubygems_version: 3.6.2
|
209
204
|
specification_version: 4
|
210
205
|
summary: Filter tools to mask sensitive data in various logs
|
211
206
|
test_files: []
|
data/gemfiles/rails_6.0.gemfile
DELETED
data/gemfiles/rails_6.1.gemfile
DELETED
File without changes
|