secret_service 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b6ec250f9c0a9d8186cb89b14789c31e49b8e3b464f6601bb2ec65a11cd46c2b
4
+ data.tar.gz: 933c4953b6f9888b6edc9cb0d86bedf6a7a4492c6174771c3ebf84ebee2ccad3
5
+ SHA512:
6
+ metadata.gz: a844c8cab7737d318e3ddb49f28dd1cb96575a360085c2206fcc0f7580429d7782873f9c814ed333ce8434015070403635c9c5ab210f47c60951ebaa4964f957
7
+ data.tar.gz: bee933819cbf89e299a19407cbb9ccb21af4be6b1191ef78f014195176ee479aeb6c710579f9f0e1c8fa5a9f9b0f784db2578b551dfab36322448e96e017bccb
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in secret_service.gemspec
4
4
  gemspec
5
+
6
+ gem 'rake'
data/README.md CHANGED
@@ -1,21 +1,35 @@
1
1
  # SecretService
2
2
 
3
- SecretService allows you to store secrets (for example the session secret or other shared secrets) more securely.
3
+ SecretService allows you to store secrets in your Rails app (for example the
4
+ session secret or other shared secrets) more securely.
4
5
 
5
- It does this by distributing the actual secret between your code and your database. That is, the final secret can only be calculated if you know both the secret given in your code and a secret stored in your database.
6
+ It does this by distributing the actual secret between your code and your
7
+ database. That is, the final secret can only be calculated if you know both the
8
+ secret given in your code and a secret stored in your database.
6
9
 
7
- Secrets can either be generated randomly on first use, or set using the Raketask.
10
+ Secrets can either be generated randomly on first use, or set using the
11
+ Raketask.
8
12
 
9
- The Gem does its job by using the secret given in your code to encrypt/decrypt the secret in the database.
10
13
 
11
- As a useful sideeffect this means your different environments (staging / production) will automatically use different secrets.
14
+ ## How it works
12
15
 
16
+ SecretService uses the secret given in your code (the "source secret") to
17
+ encrypt/decrypt a corresponding secret stored in the database. The source
18
+ secrets is also used to identify the database secret to be used (but is hashed
19
+ for this purpose).
13
20
 
21
+ As a useful side effect, different environments (staging / production) will
22
+ automatically have different secrets. You also cannot accidentally copy secrets
23
+ from one project to another.
24
+
25
+ SecretService will create a database table called "secret_service_secrets".
26
+ This happens automatically on first use.
14
27
 
15
28
  ## Caveat
16
29
 
17
30
  This currently requires ActiveRecord.
18
31
 
32
+
19
33
  ## Installation
20
34
 
21
35
  Add this line to your application's Gemfile:
@@ -26,13 +40,15 @@ And then execute:
26
40
 
27
41
  $ bundle
28
42
 
43
+
29
44
  ## Usage
30
45
 
31
46
  To get a random secret, simply use
32
47
 
33
48
  SecretService.secret("dfa24decafdb058448ac1eadb94e2066381cb92ee301e5a43d556555b61c7ea599e06be870e1d90c655c1b56cea172622d2b04a5e986faed42cbae684c5523c9")
34
49
 
35
- You will probably want to use this in your `config/initializers/secret_token.rb` initializer.
50
+ You will probably want to use this in your
51
+ `config/initializers/secret_token.rb` initializer.
36
52
 
37
53
  The database entries (and indeed tables) are created on demand.
38
54
 
@@ -47,13 +63,17 @@ If you want to use a specific secret, you can put it into the database by callin
47
63
 
48
64
  rake secret_service:store
49
65
 
50
- The secret you'll put into your code as well as the final secret that will be returned are read from STDIN. You can leave the first one blank to have it generated automatically.
66
+ The source secret you'll put into your code as well as the actual secret are
67
+ read from STDIN. You can leave the first one blank to have it generated
68
+ automatically.
51
69
 
52
70
  To show a previously stored secret, use
53
71
 
54
72
  rake secret_service:show
55
73
 
56
- where `the_source_secret` is the secret used in the `SecretService.secret(...)` call
74
+ where `the_source_secret` is the secret used in the `SecretService.secret(...)`
75
+ call.
76
+
57
77
 
58
78
  ## Capistrano integration
59
79
 
@@ -66,10 +86,18 @@ You'll get the two rake tasks as corresponding capistrano tasks:
66
86
  cap secret_service:store
67
87
  cap secret_service:show
68
88
 
89
+
69
90
  ## Contributing
70
91
 
71
92
  1. Fork it
72
93
  2. Create your feature branch (`git checkout -b my-new-feature`)
73
- 3. Commit your changes (`git commit -am 'Added some feature'`)
74
- 4. Push to the branch (`git push origin my-new-feature`)
75
- 5. Create new Pull Request
94
+ 3. Run tests by calling `rake all:bundle` first, then just `rake`. Tests will
95
+ be run against Rails 2.3, 3.0 and 3.2.
96
+ 4. Commit your changes (`git commit -am 'Added some feature'`)
97
+ 5. Push to the branch (`git push origin my-new-feature`)
98
+ 6. Create new Pull Request
99
+
100
+
101
+ ## Credits
102
+
103
+ Tobias Kraze, [makandra](http://makandra.com)
data/Rakefile CHANGED
@@ -8,11 +8,16 @@ task :default => 'all:spec'
8
8
  namespace :travis_ci do
9
9
 
10
10
  desc 'Things to do before Travis CI begins'
11
- task :prepare do
11
+ task :prepare => :slimgems do
12
12
  Rake::Task['travis_ci:create_database'].invoke &&
13
13
  Rake::Task['travis_ci:create_database_yml'].invoke
14
14
  end
15
15
 
16
+ desc 'Install slimgems'
17
+ task :slimgems do
18
+ system('gem install slimgems')
19
+ end
20
+
16
21
  desc 'Creates a test database'
17
22
  task :create_database do
18
23
  system("mysql -e 'create database secret_service_test;'")
@@ -1,3 +1,3 @@
1
1
  module SecretService
2
- VERSION = "0.1.3" unless defined?(SecretService::VERSION)
2
+ VERSION = "0.1.4" unless defined?(SecretService::VERSION)
3
3
  end
@@ -6,6 +6,7 @@ gem 'rspec-rails', '~>1.3'
6
6
  gem 'mysql2', '<0.3'
7
7
  gem 'ruby-debug', :platforms => :mri_18
8
8
  gem 'test-unit', '~>1.2', :platforms => :ruby_19
9
+ gem 'hoe', '=2.8.0', :platforms => :ruby_19
9
10
  gem 'rdoc', :require => false
10
11
 
11
12
  gem 'secret_service', :path => '../..'
@@ -0,0 +1 @@
1
+ spec/rails-2.3/app_root/../../shared/app_root/app
@@ -0,0 +1 @@
1
+ spec/rails-2.3/app_root/config/../../../shared/app_root/config/database.yml
@@ -0,0 +1 @@
1
+ spec/rails-2.3/app_root/../../shared/app_root/db
@@ -0,0 +1 @@
1
+ spec/rails-2.3/spec/../../shared/support
@@ -0,0 +1 @@
1
+ spec/rails-3.0/app_root/../../shared/app_root/app
@@ -0,0 +1 @@
1
+ spec/rails-3.0/app_root/config/../../../shared/app_root/config/database.yml
@@ -0,0 +1 @@
1
+ spec/rails-3.0/app_root/../../shared/app_root/db
@@ -0,0 +1 @@
1
+ spec/rails-3.0/spec/../../shared/support
@@ -0,0 +1 @@
1
+ spec/rails-3.2/app_root/../../shared/app_root/app
@@ -0,0 +1 @@
1
+ spec/rails-3.2/app_root/config/../../../shared/app_root/config/database.yml
@@ -0,0 +1 @@
1
+ spec/rails-3.2/app_root/../../shared/app_root/db
@@ -0,0 +1 @@
1
+ spec/rails-3.2/spec/../../shared/support
metadata CHANGED
@@ -1,49 +1,39 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: secret_service
3
- version: !ruby/object:Gem::Version
4
- hash: 29
5
- prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 3
10
- version: 0.1.3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.4
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Tobias Kraze
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2013-03-13 00:00:00 +01:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
11
+ date: 2018-09-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
22
14
  name: gibberish
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
27
17
  - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
33
20
  type: :runtime
34
- version_requirements: *id001
35
- description: Secret service provides encryption of your application secrets with a server side master password
36
- email:
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: Secret service provides encryption of your application secrets with a
28
+ server side master password
29
+ email:
37
30
  - tobias@kraze.eu
38
31
  executables: []
39
-
40
32
  extensions: []
41
-
42
33
  extra_rdoc_files: []
43
-
44
- files:
45
- - .gitignore
46
- - .travis.yml
34
+ files:
35
+ - ".gitignore"
36
+ - ".travis.yml"
47
37
  - Gemfile
48
38
  - LICENSE
49
39
  - README.md
@@ -59,6 +49,7 @@ files:
59
49
  - spec/rails-2.3/Gemfile
60
50
  - spec/rails-2.3/Rakefile
61
51
  - spec/rails-2.3/app_root/Rakefile
52
+ - spec/rails-2.3/app_root/app
62
53
  - spec/rails-2.3/app_root/config/boot.rb
63
54
  - spec/rails-2.3/app_root/config/database.yml
64
55
  - spec/rails-2.3/app_root/config/environment.rb
@@ -66,15 +57,18 @@ files:
66
57
  - spec/rails-2.3/app_root/config/initializers/fix_missing_source_file.rb
67
58
  - spec/rails-2.3/app_root/config/preinitializer.rb
68
59
  - spec/rails-2.3/app_root/config/routes.rb
60
+ - spec/rails-2.3/app_root/db
69
61
  - spec/rails-2.3/app_root/log/.gitignore
70
62
  - spec/rails-2.3/rcov.opts
71
63
  - spec/rails-2.3/spec.opts
72
64
  - spec/rails-2.3/spec/spec_helper.rb
65
+ - spec/rails-2.3/spec/support
73
66
  - spec/rails-3.0/.rspec
74
67
  - spec/rails-3.0/Gemfile
75
68
  - spec/rails-3.0/Rakefile
76
69
  - spec/rails-3.0/app_root/.gitignore
77
70
  - spec/rails-3.0/app_root/Rakefile
71
+ - spec/rails-3.0/app_root/app
78
72
  - spec/rails-3.0/app_root/config/application.rb
79
73
  - spec/rails-3.0/app_root/config/boot.rb
80
74
  - spec/rails-3.0/app_root/config/database.yml
@@ -86,16 +80,19 @@ files:
86
80
  - spec/rails-3.0/app_root/config/initializers/secret_token.rb
87
81
  - spec/rails-3.0/app_root/config/initializers/session_store.rb
88
82
  - spec/rails-3.0/app_root/config/routes.rb
83
+ - spec/rails-3.0/app_root/db
89
84
  - spec/rails-3.0/app_root/lib/tasks/.gitkeep
90
85
  - spec/rails-3.0/app_root/log/.gitkeep
91
86
  - spec/rails-3.0/app_root/script/rails
92
87
  - spec/rails-3.0/rcov.opts
93
88
  - spec/rails-3.0/spec/spec_helper.rb
89
+ - spec/rails-3.0/spec/support
94
90
  - spec/rails-3.2/.rspec
95
91
  - spec/rails-3.2/Gemfile
96
92
  - spec/rails-3.2/Rakefile
97
93
  - spec/rails-3.2/app_root/.gitignore
98
94
  - spec/rails-3.2/app_root/Rakefile
95
+ - spec/rails-3.2/app_root/app
99
96
  - spec/rails-3.2/app_root/config/application.rb
100
97
  - spec/rails-3.2/app_root/config/boot.rb
101
98
  - spec/rails-3.2/app_root/config/database.yml
@@ -107,9 +104,11 @@ files:
107
104
  - spec/rails-3.2/app_root/config/initializers/secret_token.rb
108
105
  - spec/rails-3.2/app_root/config/initializers/session_store.rb
109
106
  - spec/rails-3.2/app_root/config/routes.rb
107
+ - spec/rails-3.2/app_root/db
110
108
  - spec/rails-3.2/app_root/log/.gitignore
111
109
  - spec/rails-3.2/rcov.opts
112
110
  - spec/rails-3.2/spec/spec_helper.rb
111
+ - spec/rails-3.2/spec/support
113
112
  - spec/shared/app_root/app/controllers/application_controller.rb
114
113
  - spec/shared/app_root/config/database.yml.sample
115
114
  - spec/shared/app_root/db/consul_test.db
@@ -118,44 +117,35 @@ files:
118
117
  - spec/shared/secret_service/store_spec.rb
119
118
  - spec/shared/support/reconnect_task.rake
120
119
  - spec/shared/support/wipe_store.rb
121
- has_rdoc: true
122
120
  homepage: https://github.com/makandra/secret_service
123
121
  licenses: []
124
-
122
+ metadata: {}
125
123
  post_install_message:
126
124
  rdoc_options: []
127
-
128
- require_paths:
125
+ require_paths:
129
126
  - lib
130
- required_ruby_version: !ruby/object:Gem::Requirement
131
- none: false
132
- requirements:
127
+ required_ruby_version: !ruby/object:Gem::Requirement
128
+ requirements:
133
129
  - - ">="
134
- - !ruby/object:Gem::Version
135
- hash: 3
136
- segments:
137
- - 0
138
- version: "0"
139
- required_rubygems_version: !ruby/object:Gem::Requirement
140
- none: false
141
- requirements:
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ required_rubygems_version: !ruby/object:Gem::Requirement
133
+ requirements:
142
134
  - - ">="
143
- - !ruby/object:Gem::Version
144
- hash: 3
145
- segments:
146
- - 0
147
- version: "0"
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
148
137
  requirements: []
149
-
150
138
  rubyforge_project:
151
- rubygems_version: 1.3.9.5
139
+ rubygems_version: 2.7.7
152
140
  signing_key:
153
- specification_version: 3
154
- summary: Secret service provides encryption of your application secrets with a server side master password
155
- test_files:
141
+ specification_version: 4
142
+ summary: Secret service provides encryption of your application secrets with a server
143
+ side master password
144
+ test_files:
156
145
  - spec/rails-2.3/Gemfile
157
146
  - spec/rails-2.3/Rakefile
158
147
  - spec/rails-2.3/app_root/Rakefile
148
+ - spec/rails-2.3/app_root/app
159
149
  - spec/rails-2.3/app_root/config/boot.rb
160
150
  - spec/rails-2.3/app_root/config/database.yml
161
151
  - spec/rails-2.3/app_root/config/environment.rb
@@ -163,15 +153,18 @@ test_files:
163
153
  - spec/rails-2.3/app_root/config/initializers/fix_missing_source_file.rb
164
154
  - spec/rails-2.3/app_root/config/preinitializer.rb
165
155
  - spec/rails-2.3/app_root/config/routes.rb
156
+ - spec/rails-2.3/app_root/db
166
157
  - spec/rails-2.3/app_root/log/.gitignore
167
158
  - spec/rails-2.3/rcov.opts
168
159
  - spec/rails-2.3/spec.opts
169
160
  - spec/rails-2.3/spec/spec_helper.rb
161
+ - spec/rails-2.3/spec/support
170
162
  - spec/rails-3.0/.rspec
171
163
  - spec/rails-3.0/Gemfile
172
164
  - spec/rails-3.0/Rakefile
173
165
  - spec/rails-3.0/app_root/.gitignore
174
166
  - spec/rails-3.0/app_root/Rakefile
167
+ - spec/rails-3.0/app_root/app
175
168
  - spec/rails-3.0/app_root/config/application.rb
176
169
  - spec/rails-3.0/app_root/config/boot.rb
177
170
  - spec/rails-3.0/app_root/config/database.yml
@@ -183,16 +176,19 @@ test_files:
183
176
  - spec/rails-3.0/app_root/config/initializers/secret_token.rb
184
177
  - spec/rails-3.0/app_root/config/initializers/session_store.rb
185
178
  - spec/rails-3.0/app_root/config/routes.rb
179
+ - spec/rails-3.0/app_root/db
186
180
  - spec/rails-3.0/app_root/lib/tasks/.gitkeep
187
181
  - spec/rails-3.0/app_root/log/.gitkeep
188
182
  - spec/rails-3.0/app_root/script/rails
189
183
  - spec/rails-3.0/rcov.opts
190
184
  - spec/rails-3.0/spec/spec_helper.rb
185
+ - spec/rails-3.0/spec/support
191
186
  - spec/rails-3.2/.rspec
192
187
  - spec/rails-3.2/Gemfile
193
188
  - spec/rails-3.2/Rakefile
194
189
  - spec/rails-3.2/app_root/.gitignore
195
190
  - spec/rails-3.2/app_root/Rakefile
191
+ - spec/rails-3.2/app_root/app
196
192
  - spec/rails-3.2/app_root/config/application.rb
197
193
  - spec/rails-3.2/app_root/config/boot.rb
198
194
  - spec/rails-3.2/app_root/config/database.yml
@@ -204,9 +200,11 @@ test_files:
204
200
  - spec/rails-3.2/app_root/config/initializers/secret_token.rb
205
201
  - spec/rails-3.2/app_root/config/initializers/session_store.rb
206
202
  - spec/rails-3.2/app_root/config/routes.rb
203
+ - spec/rails-3.2/app_root/db
207
204
  - spec/rails-3.2/app_root/log/.gitignore
208
205
  - spec/rails-3.2/rcov.opts
209
206
  - spec/rails-3.2/spec/spec_helper.rb
207
+ - spec/rails-3.2/spec/support
210
208
  - spec/shared/app_root/app/controllers/application_controller.rb
211
209
  - spec/shared/app_root/config/database.yml.sample
212
210
  - spec/shared/app_root/db/consul_test.db
@@ -1,6 +0,0 @@
1
- test:
2
- adapter: mysql2
3
- host: localhost
4
- username: root
5
- password: secret
6
- database: secret_service_test
@@ -1,6 +0,0 @@
1
- test:
2
- adapter: mysql2
3
- host: localhost
4
- username: root
5
- password: secret
6
- database: secret_service_test
@@ -1,6 +0,0 @@
1
- test:
2
- adapter: mysql2
3
- host: localhost
4
- username: root
5
- password: secret
6
- database: secret_service_test