jcnnghm-acts_as_secure 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/.idea/.name +1 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/acts_as_secure.iml +9 -0
- data/.idea/dictionaries/jcnnghm.xml +3 -0
- data/.idea/encodings.xml +5 -0
- data/.idea/inspectionProfiles/Project_Default.xml +16 -0
- data/.idea/inspectionProfiles/profiles_settings.xml +7 -0
- data/.idea/misc.xml +8 -0
- data/.idea/modules.xml +9 -0
- data/.idea/projectCodeStyle.xml +90 -0
- data/.idea/vcs.xml +7 -0
- data/.idea/workspace.xml +410 -0
- data/CHANGELOG +39 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +42 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +152 -0
- data/Rakefile +2 -0
- data/acts_as_secure.gemspec +27 -0
- data/lib/acts_as_secure.rb +1 -0
- data/lib/acts_as_secure/acts_as_secure.rb +120 -0
- data/lib/acts_as_secure/version.rb +3 -0
- data/lib/jcnnghm-acts_as_secure.rb +1 -0
- data/spec/.gitignore +1 -0
- data/spec/acts_as_secure_spec.rb +55 -0
- data/spec/spec.opts +4 -0
- data/spec/test_in_memory.rb +61 -0
- metadata +161 -0
data/spec/spec.opts
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'active_record'
|
2
|
+
require 'active_support/core_ext/logger' rescue nil # rails3
|
3
|
+
|
4
|
+
require 'acts_as_secure'
|
5
|
+
|
6
|
+
ActiveRecord::Base.establish_connection({'adapter' => 'sqlite3', 'database' => ':memory:'})
|
7
|
+
ActiveRecord::Base.logger = Logger.new("#{File.dirname(__FILE__)}/active_record.log")
|
8
|
+
|
9
|
+
connection = ActiveRecord::Base.connection
|
10
|
+
|
11
|
+
connection.create_table :fruits do |t|
|
12
|
+
t.string :name
|
13
|
+
end
|
14
|
+
|
15
|
+
connection.create_table :secret_fruits do |t|
|
16
|
+
t.column :name, :binary
|
17
|
+
t.column :fruit_id, :integer
|
18
|
+
end
|
19
|
+
|
20
|
+
connection.create_table :uber_secret_fruits do |t|
|
21
|
+
t.column :name, :binary
|
22
|
+
t.column :fruit_id, :integer
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
class Rot13CryptoProvider
|
27
|
+
class << self
|
28
|
+
def encrypt(arg)
|
29
|
+
arg.tr("A-Za-z", "N-ZA-Mn-za-m")
|
30
|
+
end
|
31
|
+
alias_method :decrypt, :encrypt
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class SaltedRot13CryptoProvider
|
36
|
+
def initialize(salt)
|
37
|
+
@salt = salt
|
38
|
+
end
|
39
|
+
def encrypt(arg)
|
40
|
+
@salt + arg.tr("A-Za-z", "N-ZA-Mn-za-m")
|
41
|
+
end
|
42
|
+
def decrypt(arg)
|
43
|
+
arg[@salt.size .. -1].tr("A-Za-z", "N-ZA-Mn-za-m")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
class Fruit < ActiveRecord::Base
|
49
|
+
has_one :secret_fruit
|
50
|
+
has_one :uber_secret_fruit
|
51
|
+
end
|
52
|
+
|
53
|
+
class SecretFruit < ActiveRecord::Base
|
54
|
+
acts_as_secure :crypto_provider => Rot13CryptoProvider
|
55
|
+
belongs_to :fruit
|
56
|
+
end
|
57
|
+
|
58
|
+
class UberSecretFruit < ActiveRecord::Base
|
59
|
+
acts_as_secure
|
60
|
+
belongs_to :fruit
|
61
|
+
end
|
metadata
ADDED
@@ -0,0 +1,161 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jcnnghm-acts_as_secure
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 6
|
10
|
+
version: 1.0.6
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Justin Cunningham
|
14
|
+
- 2007 Revolution Health Group LLC.
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2011-02-20 00:00:00 -05:00
|
20
|
+
default_executable:
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
name: bundler
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 23
|
31
|
+
segments:
|
32
|
+
- 1
|
33
|
+
- 0
|
34
|
+
- 0
|
35
|
+
version: 1.0.0
|
36
|
+
type: :development
|
37
|
+
version_requirements: *id001
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: rspec
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
hash: 11
|
47
|
+
segments:
|
48
|
+
- 2
|
49
|
+
- 4
|
50
|
+
version: "2.4"
|
51
|
+
type: :development
|
52
|
+
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: activerecord
|
55
|
+
prerelease: false
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 15
|
62
|
+
segments:
|
63
|
+
- 3
|
64
|
+
- 0
|
65
|
+
- 4
|
66
|
+
version: 3.0.4
|
67
|
+
type: :development
|
68
|
+
version_requirements: *id003
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sqlite3
|
71
|
+
prerelease: false
|
72
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
hash: 3
|
78
|
+
segments:
|
79
|
+
- 0
|
80
|
+
version: "0"
|
81
|
+
type: :development
|
82
|
+
version_requirements: *id004
|
83
|
+
description: |-
|
84
|
+
When a model is marked with acts_as_secure, the :binary type fields are recognized as needed to be stored encrypted.
|
85
|
+
The plugin does before_save/after_save/after_find encryption/decryption thus making it transparent for a
|
86
|
+
code using the secure models.
|
87
|
+
email:
|
88
|
+
- justin@compucatedsolutions.com
|
89
|
+
executables: []
|
90
|
+
|
91
|
+
extensions: []
|
92
|
+
|
93
|
+
extra_rdoc_files: []
|
94
|
+
|
95
|
+
files:
|
96
|
+
- .gitignore
|
97
|
+
- .idea/.name
|
98
|
+
- .idea/.rakeTasks
|
99
|
+
- .idea/acts_as_secure.iml
|
100
|
+
- .idea/dictionaries/jcnnghm.xml
|
101
|
+
- .idea/encodings.xml
|
102
|
+
- .idea/inspectionProfiles/Project_Default.xml
|
103
|
+
- .idea/inspectionProfiles/profiles_settings.xml
|
104
|
+
- .idea/misc.xml
|
105
|
+
- .idea/modules.xml
|
106
|
+
- .idea/projectCodeStyle.xml
|
107
|
+
- .idea/vcs.xml
|
108
|
+
- .idea/workspace.xml
|
109
|
+
- CHANGELOG
|
110
|
+
- Gemfile
|
111
|
+
- Gemfile.lock
|
112
|
+
- MIT-LICENSE
|
113
|
+
- README.rdoc
|
114
|
+
- Rakefile
|
115
|
+
- acts_as_secure.gemspec
|
116
|
+
- lib/acts_as_secure.rb
|
117
|
+
- lib/acts_as_secure/acts_as_secure.rb
|
118
|
+
- lib/acts_as_secure/version.rb
|
119
|
+
- lib/jcnnghm-acts_as_secure.rb
|
120
|
+
- spec/.gitignore
|
121
|
+
- spec/acts_as_secure_spec.rb
|
122
|
+
- spec/spec.opts
|
123
|
+
- spec/test_in_memory.rb
|
124
|
+
has_rdoc: true
|
125
|
+
homepage: http://rubygems.org/gems/jcnnghm-acts_as_secure
|
126
|
+
licenses: []
|
127
|
+
|
128
|
+
post_install_message:
|
129
|
+
rdoc_options: []
|
130
|
+
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
none: false
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
hash: 3
|
139
|
+
segments:
|
140
|
+
- 0
|
141
|
+
version: "0"
|
142
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
143
|
+
none: false
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
hash: 23
|
148
|
+
segments:
|
149
|
+
- 1
|
150
|
+
- 3
|
151
|
+
- 6
|
152
|
+
version: 1.3.6
|
153
|
+
requirements: []
|
154
|
+
|
155
|
+
rubyforge_project: jcnnghm-acts_as_secure
|
156
|
+
rubygems_version: 1.3.7
|
157
|
+
signing_key:
|
158
|
+
specification_version: 3
|
159
|
+
summary: ActsAsSecure adds an ability to store ActiveRecord model's fields encrypted in a DB.
|
160
|
+
test_files: []
|
161
|
+
|