blouson 1.0.3 → 1.1.0

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: 8f9575654a89180550fb446183db9d6935efd25cc77c2548c92365d73f69619f
4
- data.tar.gz: '087596650cb1589c8d3f9e0c9f1b305f7946f4f15bde401c5a192a42b9844fdc'
3
+ metadata.gz: 6ad669af9102968f46d5359d6d286e7abe8a67f377c66dc59c42ea58e25082c1
4
+ data.tar.gz: dd62f6ea3a7bc021dbe9ea22aef53ad1208f954f5a9dcfbe795126eb4fd31d73
5
5
  SHA512:
6
- metadata.gz: 1c01fe6b8d64ed50928b3f2863eef629f169559d2c2e0b180dc2721b21421dccf0cae2ee017e8b929e7c538375f0f2ae0ec2118096f716027a082d69f9705a39
7
- data.tar.gz: 03d663ac04d65ba878620d0e9f555f6c3e5fa6280666e807089c9a48cad7fe684379ee9bd18b7dba29875a168206178555738aab54f3e310456e03aa60810d83
6
+ metadata.gz: f43a624ded7239bd0651503a2893f9a7a8e7a10aa178cf06fd6520dda27b534374d35fcbd539d8c6d6bd0113ddcc2132c87d87fcefe83d8a0e3b2ce2cfdaa627
7
+ data.tar.gz: b645e860e18ddf99e36bc758a3982cf40796fc73c10eabb2229bed0d0a964b7ed3b9046841ad1ac8e6d7063225d9913d8aced500913fdfb71ddd7249f133db0c
@@ -1,20 +1,17 @@
1
1
  sudo: false
2
2
  language: ruby
3
+ services:
4
+ - mysql
3
5
  gemfile:
4
- - gemfiles/rails_4.0.gemfile
5
- - gemfiles/rails_4.1.gemfile
6
6
  - gemfiles/rails_4.2.gemfile
7
7
  - gemfiles/rails_5.0.gemfile
8
8
  - gemfiles/rails_5.1.gemfile
9
+ - gemfiles/rails_5.2.gemfile
9
10
  rvm:
10
- - 2.2.7
11
- - 2.3.4
12
- - 2.4.1
13
- matrix:
14
- exclude:
15
- # Rails 4.0 and 4.1 doesn't support Ruby 2.4 (because of integer unification)
16
- - rvm: 2.4.1
17
- gemfile: gemfiles/rails_4.0.gemfile
18
- - rvm: 2.4.1
19
- gemfile: gemfiles/rails_4.1.gemfile
20
- before_install: gem install --no-document bundler
11
+ - 2.3.8
12
+ - 2.4.6
13
+ - 2.5.5
14
+ - 2.6.3
15
+ before_install:
16
+ - "[[ $BUNDLE_GEMFILE =~ rails_4\\.2 ]] && gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true"
17
+ - "[[ $BUNDLE_GEMFILE =~ rails_4\\.2 ]] && gem install bundler -v '< 2' || true"
@@ -1,3 +1,6 @@
1
+ # 1.1.0 (2019-08-09)
2
+ - Add feature to filter sensitive mail logs.
3
+
1
4
  # 1.0.3 (2018-12-18)
2
5
  - Fix Blouson::SensitiveQueryFilter::StatementInvalidErrorFilter for exceptions created with no arguments (like ActiveRecord::NoDatabaseError)
3
6
 
data/README.md CHANGED
@@ -8,6 +8,7 @@ Blouson is a filter tool for Rails to conceal sensitive data from various logs.
8
8
  - SQL query in Rails log
9
9
  - Exception messages in `ActiveRecord::StatementInvalid`
10
10
  - Sentry Raven parameters
11
+ - Mail parameters in Rails log
11
12
 
12
13
  ## Installation
13
14
 
@@ -80,6 +81,34 @@ Raven.configure do |config|
80
81
  end
81
82
  ```
82
83
 
84
+ ### SensitiveMailLogFilter
85
+ ActionMailer outputs email address, all headers, and body text to the log when sending email.
86
+
87
+ ```
88
+ D, [2019-08-08T08:40:15.939251 #67674] DEBUG -- : UserMailer#hello: processed outbound mail in 43.0ms
89
+ I, [2019-08-08T08:40:15.946281 #67674] INFO -- : Sent mail to xxx@example.com (6.3ms)
90
+ D, [2019-08-08T08:40:15.946432 #67674] DEBUG -- : Date: Thu, 08 Aug 2019 08:40:15 +0900
91
+ From: from@example.com
92
+ To: xxx@example.com
93
+ Message-ID: <xxx>
94
+ Subject: Hello
95
+ Mime-Version: 1.0
96
+ Content-Type: text/plain; charset=UTF-8
97
+ Content-Transfer-Encoding: 7bit
98
+
99
+ Example mail.
100
+ ```
101
+
102
+ Blouson filters such logs.
103
+
104
+ Example:
105
+
106
+ ```
107
+ D, [2019-08-08T08:47:06.524182 #67886] DEBUG -- : UserMailer#hello: processed outbound mail in 23.2ms
108
+ I, [2019-08-08T08:47:06.530849 #67886] INFO -- : Sent mail to [FILTERED] (6.4ms)
109
+ D, [2019-08-08T08:47:06.530953 #67886] DEBUG -- : [Blouson::SensitiveMailLogFilter] Mail data is filtered for sensitive data
110
+ ```
111
+
83
112
  ## Contributing
84
113
 
85
114
  Bug reports and pull requests are welcome on GitHub at https://github.com/cookpad/blouson.
@@ -2,7 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "rails", "~> 4.0.0"
6
- gem "mysql2", "~> 0.3.10"
5
+ gem "rails", "~> 5.2.0"
7
6
 
8
7
  gemspec path: "../"
@@ -2,6 +2,7 @@ require "blouson/version"
2
2
 
3
3
  require 'blouson/sensitive_params_silener'
4
4
  require 'blouson/sensitive_query_filter'
5
+ require 'blouson/sensitive_mail_log_filter'
5
6
  require 'blouson/engine'
6
7
  require 'blouson/tolerant_regexp'
7
8
 
@@ -22,5 +22,13 @@ module Blouson
22
22
  end
23
23
  end
24
24
  end
25
+
26
+ initializer 'blouson.set_sensitive_mail_log_filter' do |app|
27
+ if Rails.env.production? || ENV['ENABLE_SENSITIVE_MAIL_LOG_FILTER'] == '1'
28
+ ActiveSupport.on_load(:action_mailer) do
29
+ ActionMailer::LogSubscriber.prepend Blouson::SensitiveMailLogFilter
30
+ end
31
+ end
32
+ end
25
33
  end
26
34
  end
@@ -0,0 +1,17 @@
1
+ module Blouson
2
+ module SensitiveMailLogFilter
3
+ def deliver(event)
4
+ e = ActiveSupport::Notifications::Event.new(
5
+ event.name,
6
+ event.time,
7
+ event.end,
8
+ event.transaction_id,
9
+ event.payload.merge(
10
+ to: Blouson::FILTERED,
11
+ mail: "[Blouson::SensitiveMailLogFilter] Mail data is filtered for sensitive data"
12
+ )
13
+ )
14
+ super(e)
15
+ end
16
+ end
17
+ end
@@ -1,3 +1,3 @@
1
1
  module Blouson
2
- VERSION = "1.0.3"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blouson
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cookpad Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-18 00:00:00.000000000 Z
11
+ date: 2019-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -155,14 +155,14 @@ files:
155
155
  - bin/console
156
156
  - bin/setup
157
157
  - blouson.gemspec
158
- - gemfiles/rails_4.0.gemfile
159
- - gemfiles/rails_4.1.gemfile
160
158
  - gemfiles/rails_4.2.gemfile
161
159
  - gemfiles/rails_5.0.gemfile
162
160
  - gemfiles/rails_5.1.gemfile
161
+ - gemfiles/rails_5.2.gemfile
163
162
  - lib/blouson.rb
164
163
  - lib/blouson/engine.rb
165
164
  - lib/blouson/raven_parameter_filter_processor.rb
165
+ - lib/blouson/sensitive_mail_log_filter.rb
166
166
  - lib/blouson/sensitive_params_silener.rb
167
167
  - lib/blouson/sensitive_query_filter.rb
168
168
  - lib/blouson/sensitive_table_query_log_silencer.rb
@@ -187,8 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  - !ruby/object:Gem::Version
188
188
  version: '0'
189
189
  requirements: []
190
- rubyforge_project:
191
- rubygems_version: 2.7.6
190
+ rubygems_version: 3.0.3
192
191
  signing_key:
193
192
  specification_version: 4
194
193
  summary: Filter tools to mask sensitive data in various logs
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "~> 4.1.0"
6
- gem "mysql2", "~> 0.3.13"
7
-
8
- gemspec path: "../"