blinkers 1.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 +7 -0
- data/MIT-LICENSE +21 -0
- data/README.md +47 -0
- data/Rakefile +19 -0
- data/config/initializers/00_filter_parameters.rb +1 -0
- data/config/initializers/02_bugsnag.rb +5 -0
- data/config/initializers/airbrake.rb +5 -0
- data/config/initializers/bugsnag.rb +5 -0
- data/lib/blinkers.rb +9 -0
- data/lib/blinkers/params.rb +19 -0
- data/lib/blinkers/version.rb +3 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: aeaf242f5cdd7507cc725d0be5f11b01bd5d70b4
|
4
|
+
data.tar.gz: 31084b83c3164759f49589c80c7eac8cce59b537
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 595cd3b2100c49d067a11b60b31a4bdf3b8664b1a0ba90c4f3cf01e35815843f058a25a12bf7fa6af0d46e88ad3333beb7fe902da46950e6f72c21bb2b2702b1
|
7
|
+
data.tar.gz: cb35c9835245b336bada2d30f2202db0959ffe5166075fc436a8e8582729745d240bd80effeb9f0614bc7bd7b08ae44a67bba650a31433a8dec8ae75fd110e54
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 freee K.K.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# Blinkers
|
2
|
+
|
3
|
+
A Rails plugin to handle sensitive data securely.
|
4
|
+
|
5
|
+
# Usage
|
6
|
+
|
7
|
+
Set in Gemfile and install with bundler.
|
8
|
+
|
9
|
+
```Gemfile
|
10
|
+
gem 'blinkers'
|
11
|
+
```
|
12
|
+
|
13
|
+
```
|
14
|
+
bundle install
|
15
|
+
```
|
16
|
+
|
17
|
+
# secure_params
|
18
|
+
|
19
|
+
`secure_params` is FILTERED params.
|
20
|
+
It filters all data specified in `Rails.application.config.filter_parameters` and converts to `[FILTERED]`.
|
21
|
+
|
22
|
+
So if you want to pass `params` to log file or other services, passing `secure_params` would be safer.
|
23
|
+
|
24
|
+
```rb
|
25
|
+
params['password']
|
26
|
+
=> 'password123'
|
27
|
+
|
28
|
+
secure_params['password']
|
29
|
+
=> '[FILTERED]'
|
30
|
+
```
|
31
|
+
|
32
|
+
## Adding sensitive keys
|
33
|
+
|
34
|
+
If you want to filter other data.
|
35
|
+
Just add to `filter_parameters`.
|
36
|
+
|
37
|
+
```rb
|
38
|
+
secure_params['secure_data']
|
39
|
+
=> 'THE SECRET DATA'
|
40
|
+
|
41
|
+
Rails.application.config.filter_parameters << [:secure_data]
|
42
|
+
|
43
|
+
secure_params['secure_data']
|
44
|
+
=> '[FILTERED]'
|
45
|
+
```
|
46
|
+
|
47
|
+
“Rails”, “Ruby on Rails”, and the Rails logo are registered trademarks of David Heinemeier Hansson. All rights reserved.
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Blinkers'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
Bundler::GemHelper.install_tasks
|
19
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
Rails.application.config.filter_parameters += Blinkers::SENSITIVE_KEYS
|
data/lib/blinkers.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Blinkers
|
2
|
+
module Params
|
3
|
+
def self.included(klass)
|
4
|
+
klass.include InstanceMethods
|
5
|
+
end
|
6
|
+
|
7
|
+
module InstanceMethods
|
8
|
+
def secure_params(*sensitive_keys)
|
9
|
+
query = params.clone
|
10
|
+
|
11
|
+
filter = ActionDispatch::Http::ParameterFilter.new(
|
12
|
+
Rails.application.config.filter_parameters + sensitive_keys
|
13
|
+
)
|
14
|
+
|
15
|
+
filter.filter(query)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: blinkers
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Junichi Kaku
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.1.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.1.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sqlite3
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Provides secure_params that converts sensitive data to [FILTERED]. And
|
56
|
+
send [FILTERED] data to error monitoring sevices.
|
57
|
+
email:
|
58
|
+
- kaku@freee.co.jp
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- MIT-LICENSE
|
64
|
+
- README.md
|
65
|
+
- Rakefile
|
66
|
+
- config/initializers/00_filter_parameters.rb
|
67
|
+
- config/initializers/02_bugsnag.rb
|
68
|
+
- config/initializers/airbrake.rb
|
69
|
+
- config/initializers/bugsnag.rb
|
70
|
+
- lib/blinkers.rb
|
71
|
+
- lib/blinkers/params.rb
|
72
|
+
- lib/blinkers/version.rb
|
73
|
+
homepage: https://github.com/freee/blinkers
|
74
|
+
licenses:
|
75
|
+
- MIT
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.4.5
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: A Rails plugin to handle sensitive data securely.
|
97
|
+
test_files: []
|