yattr_encrypted 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.mdown CHANGED
@@ -1,6 +1,6 @@
1
1
  # YattrEncrypted #
2
2
 
3
- Version: 0.1.6 (but you should check lib/yattr_encrypted/version.rb to be sure)
3
+ Version: 0.1.7 (but you should check lib/yattr_encrypted/version.rb to be sure)
4
4
 
5
5
  ## Applicability ##
6
6
 
@@ -58,7 +58,11 @@ encrypting complex types - such as hashes and arrays. This is implemented by add
58
58
  read and write accessors for plaintext versions of the encrypted fields.
59
59
  a `before_save` calleback to the private method *yattr_update_encrypted_values*
60
60
  * Rails 3.1 & Rails 3.2 - doesn't pretend to support anything lower (but it might work)
61
-
61
+ * adds encrypted fields to both attributes_protected (to avoid mass assignment) and
62
+ Rails.application.config.filter_parameters
63
+ * adds plaintext fields to Rails.application.config.filter_parameters - which is not
64
+ needed inasmuch as they are not db fields, so they don't show up in the log anyway.
65
+ (but it can't hurt - just in case)
62
66
 
63
67
  ## Installation ##
64
68
 
@@ -1,3 +1,3 @@
1
1
  module YattrEncrypted
2
- VERSION = '0.1.6'
2
+ VERSION = '0.1.7'
3
3
  end
@@ -135,6 +135,17 @@ module YattrEncrypted
135
135
 
136
136
  self.yate_encrypted_attributes[attribute.to_sym] = \
137
137
  options.merge(:attribute => encrypted_attribute_name)
138
+
139
+ # this conditioning is a hack to allow stand alone tests to work
140
+ # one of these days 'real soon now' I'll figure out how to
141
+ # stub out Rails::Railtie, but until then. . .
142
+ if defined?(Rails)
143
+ # add to filter_parameters keep out of log
144
+ Rails.application.config.filter_parameters += [attribute, encrypted_attribute_name]
145
+
146
+ # protect encrypted field from mass assignment
147
+ attr_protected encrypted_attribute_name.to_sym
148
+ end
138
149
  end
139
150
  end
140
151
  end
data/test/test_helper.rb CHANGED
@@ -3,6 +3,7 @@ require 'minitest/autorun'
3
3
  require 'digest/sha2'
4
4
  require 'rubygems'
5
5
 
6
+
6
7
  $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
7
8
  $:.unshift(File.dirname(__FILE__))
8
9
  require 'yattr_encrypted'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yattr_encrypted
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-20 00:00:00.000000000Z
12
+ date: 2012-03-29 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pry
16
- requirement: &2157537060 !ruby/object:Gem::Requirement
16
+ requirement: &2156297060 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2157537060
24
+ version_requirements: *2156297060
25
25
  description: Generates yattr_accessors that encrypt and decrypt attributes transparently.
26
26
  Based on attr_encrypted by Sean Huber [https://github.com/shuber]
27
27
  email: mike@clove.com
@@ -56,7 +56,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
56
56
  version: '0'
57
57
  segments:
58
58
  - 0
59
- hash: -1485568723198089794
59
+ hash: -1079738885441519666
60
60
  required_rubygems_version: !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements: