ejson-rails 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2926d2b8f957d1091ec63c1474c4f9d0a525716c
4
+ data.tar.gz: 88a8441743beba0961104845c4d94f0418595553
5
+ SHA512:
6
+ metadata.gz: d9746ef5d51b8b5b6fb7de8e318bd4c2762bda7adb36b64808097a2eabbdea561acc69dc14abb1f469a3ce32f6b6a09e679dd33ac55ab69784b366a62610aea7
7
+ data.tar.gz: 373f82c7add6fb984fac3ea4c02c05a7e90fae5e8da0c0175ceb79af8b1e9d191c2dd67e300a1835bec2fcee7629b6713167e3f8b23ffdead318613e9e9f7d20
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ # rubocop config
14
+ .rubocop-http-*
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,5 @@
1
+ inherit_from:
2
+ - http://shopify.github.io/ruby-style-guide/rubocop.yml
3
+
4
+ AllCops:
5
+ TargetRubyVersion: 2.5.1
@@ -0,0 +1 @@
1
+ 2.5.1
@@ -0,0 +1,57 @@
1
+ sudo: false
2
+ cache: bundler
3
+ language: ruby
4
+ rvm:
5
+ - 2.0.0
6
+ - 2.1.10
7
+ - 2.2.7
8
+ - 2.3.4
9
+ - 2.4.1
10
+ - 2.5.0
11
+ - ruby-head
12
+ - jruby-9.1.14.0
13
+ gemfile:
14
+ - gemfiles/Gemfile.rails-5-0-stable
15
+ - gemfiles/Gemfile.rails-5-1-stable
16
+ - gemfiles/Gemfile.rails-5-2-stable
17
+ - Gemfile
18
+ matrix:
19
+ allow_failures:
20
+ - rvm: ruby-head
21
+ exclude:
22
+ - rvm: 2.0.0
23
+ gemfile: Gemfile
24
+ - rvm: 2.1.10
25
+ gemfile: Gemfile
26
+ - rvm: jruby-9.1.14.0
27
+ gemfile: Gemfile
28
+ - rvm: 1.9.3
29
+ gemfile: gemfiles/Gemfile.rails-5-0-stable
30
+ - rvm: 2.0.0
31
+ gemfile: gemfiles/Gemfile.rails-5-0-stable
32
+ - rvm: 2.1.10
33
+ gemfile: gemfiles/Gemfile.rails-5-0-stable
34
+ - rvm: jruby-9.1.14.0
35
+ gemfile: gemfiles/Gemfile.rails-5-0-stable
36
+ - rvm: jruby-9.1.14.0
37
+ gemfile: gemfiles/Gemfile.rails-5-1-stable
38
+ - rvm: 1.9.3
39
+ gemfile: gemfiles/Gemfile.rails-5-1-stable
40
+ - rvm: 2.0.0
41
+ gemfile: gemfiles/Gemfile.rails-5-1-stable
42
+ - rvm: 2.1.10
43
+ gemfile: gemfiles/Gemfile.rails-5-1-stable
44
+ - rvm: jruby-9.1.14.0
45
+ gemfile: gemfiles/Gemfile.rails-5-2-stable
46
+ - rvm: 1.9.3
47
+ gemfile: gemfiles/Gemfile.rails-5-2-stable
48
+ - rvm: 2.0.0
49
+ gemfile: gemfiles/Gemfile.rails-5-2-stable
50
+ - rvm: 2.1.10
51
+ gemfile: gemfiles/Gemfile.rails-5-2-stable
52
+
53
+ before_install:
54
+ - gem update --system
55
+
56
+ notifications:
57
+ email: false
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in ejson-rails.gemspec
8
+ gemspec
@@ -0,0 +1,104 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ejson-rails (0.1.0)
5
+ ejson
6
+ railties (>= 4.1)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionpack (5.2.0)
12
+ actionview (= 5.2.0)
13
+ activesupport (= 5.2.0)
14
+ rack (~> 2.0)
15
+ rack-test (>= 0.6.3)
16
+ rails-dom-testing (~> 2.0)
17
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
18
+ actionview (5.2.0)
19
+ activesupport (= 5.2.0)
20
+ builder (~> 3.1)
21
+ erubi (~> 1.4)
22
+ rails-dom-testing (~> 2.0)
23
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
24
+ activesupport (5.2.0)
25
+ concurrent-ruby (~> 1.0, >= 1.0.2)
26
+ i18n (>= 0.7, < 2)
27
+ minitest (~> 5.1)
28
+ tzinfo (~> 1.1)
29
+ ast (2.4.0)
30
+ builder (3.2.3)
31
+ concurrent-ruby (1.0.5)
32
+ crass (1.0.4)
33
+ diff-lcs (1.3)
34
+ ejson (1.1.0)
35
+ erubi (1.7.1)
36
+ i18n (1.0.1)
37
+ concurrent-ruby (~> 1.0)
38
+ loofah (2.2.2)
39
+ crass (~> 1.0.2)
40
+ nokogiri (>= 1.5.9)
41
+ method_source (0.9.0)
42
+ mini_portile2 (2.3.0)
43
+ minitest (5.11.3)
44
+ nokogiri (1.8.2)
45
+ mini_portile2 (~> 2.3.0)
46
+ parallel (1.12.1)
47
+ parser (2.5.1.0)
48
+ ast (~> 2.4.0)
49
+ powerpack (0.1.1)
50
+ rack (2.0.5)
51
+ rack-test (1.0.0)
52
+ rack (>= 1.0, < 3)
53
+ rails-dom-testing (2.0.3)
54
+ activesupport (>= 4.2.0)
55
+ nokogiri (>= 1.6)
56
+ rails-html-sanitizer (1.0.4)
57
+ loofah (~> 2.2, >= 2.2.2)
58
+ railties (5.2.0)
59
+ actionpack (= 5.2.0)
60
+ activesupport (= 5.2.0)
61
+ method_source
62
+ rake (>= 0.8.7)
63
+ thor (>= 0.18.1, < 2.0)
64
+ rainbow (3.0.0)
65
+ rake (10.5.0)
66
+ rspec (3.7.0)
67
+ rspec-core (~> 3.7.0)
68
+ rspec-expectations (~> 3.7.0)
69
+ rspec-mocks (~> 3.7.0)
70
+ rspec-core (3.7.1)
71
+ rspec-support (~> 3.7.0)
72
+ rspec-expectations (3.7.0)
73
+ diff-lcs (>= 1.2.0, < 2.0)
74
+ rspec-support (~> 3.7.0)
75
+ rspec-mocks (3.7.0)
76
+ diff-lcs (>= 1.2.0, < 2.0)
77
+ rspec-support (~> 3.7.0)
78
+ rspec-support (3.7.1)
79
+ rubocop (0.56.0)
80
+ parallel (~> 1.10)
81
+ parser (>= 2.5)
82
+ powerpack (~> 0.1)
83
+ rainbow (>= 2.2.2, < 4.0)
84
+ ruby-progressbar (~> 1.7)
85
+ unicode-display_width (~> 1.0, >= 1.0.1)
86
+ ruby-progressbar (1.9.0)
87
+ thor (0.20.0)
88
+ thread_safe (0.3.6)
89
+ tzinfo (1.2.5)
90
+ thread_safe (~> 0.1)
91
+ unicode-display_width (1.3.2)
92
+
93
+ PLATFORMS
94
+ ruby
95
+
96
+ DEPENDENCIES
97
+ bundler (~> 1.16)
98
+ ejson-rails!
99
+ rake (~> 10.0)
100
+ rspec (~> 3.0)
101
+ rubocop (~> 0.56)
102
+
103
+ BUNDLED WITH
104
+ 1.16.1
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Shopify
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
13
+ all 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
21
+ THE SOFTWARE.
@@ -0,0 +1,46 @@
1
+ # EJSON::Rails
2
+
3
+ [![Build Status](https://travis-ci.com/Shopify/ejson-rails.svg?token=ShuwwQhmf65yNstgcUSy&branch=master)](https://travis-ci.com/Shopify/ejson-rails)
4
+
5
+ Automatically injects `ejson` decrypted secrets into your `Rails.application.secrets`.
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'ejson-rails'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install ejson-rails
22
+
23
+ ## Usage
24
+
25
+ Decrypted secrets from `project/config/secrets.json` (or `project/config/secrets.{current_rails_environment}.json` if that doesn't exist) will be accessible via `Rails.application.secrets`. For example:
26
+
27
+ ```json
28
+ // project/config/secrets.json
29
+ { "some_secret": "key" }
30
+ ```
31
+
32
+ will be accessible via `Rails.application.secrets.some_secret` or `Rails.application.secrets[:some_secret]` on boot. JSON files are loaded once and contents are `deep_merge`'d into your app's existing rails secrets.
33
+
34
+ ## Development
35
+
36
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
37
+
38
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
39
+
40
+ ## Contributing
41
+
42
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Shopify/ejson-rails.
43
+
44
+ ## License
45
+
46
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "ejson/rails"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env bash
2
+ # frozen_string_literal: true
3
+
4
+ set -euo pipefail
5
+ IFS=$'\n\t'
6
+ set -vx
7
+
8
+ bundle install
9
+
10
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path("../lib", __FILE__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require "ejson/rails/version"
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "ejson-rails"
9
+ spec.version = EJSON::Rails::VERSION
10
+ spec.authors = ["Gannon McGibbon"]
11
+ spec.email = ["gannon.mcgibbon@shopify.com"]
12
+
13
+ spec.summary = "Asymmetric keywise encryption for JSON on Rails"
14
+ spec.description = "Rails secret management by encrypting values in a JSON hash with a public/private keypair"
15
+ spec.homepage = "https://github.com/Shopify/ejson-rails"
16
+ spec.license = "MIT"
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_dependency "ejson"
25
+ spec.add_dependency "railties", ">= 4.1"
26
+
27
+ spec.add_development_dependency "bundler", "~> 1.16"
28
+ spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "rspec", "~> 3.0"
30
+ spec.add_development_dependency "rubocop", "~> 0.56"
31
+ end
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec path: '..'
4
+
5
+ platforms :rbx do
6
+ gem 'rubysl', '~> 2.0'
7
+ gem 'rubinius-developer_tools'
8
+ end
9
+
10
+ gem 'railties', github: 'rails/rails', branch: '5-0-stable'
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec path: '..'
4
+
5
+ platforms :rbx do
6
+ gem 'rubysl', '~> 2.0'
7
+ gem 'rubinius-developer_tools'
8
+ end
9
+
10
+ gem 'railties', github: 'rails/rails', branch: '5-1-stable'
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec path: '..'
4
+
5
+ platforms :rbx do
6
+ gem 'rubysl', '~> 2.0'
7
+ gem 'rubinius-developer_tools'
8
+ end
9
+
10
+ gem 'railties', github: 'rails/rails', branch: '5-2-stable'
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails'
4
+ require 'ejson/rails/railtie'
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EJSON
4
+ module Rails
5
+ Rails = ::Rails
6
+ private_constant :Rails
7
+
8
+ class Railtie < Rails::Railtie
9
+ initializer "ejson-rails.merge_secrets" do
10
+ json_files.each do |file|
11
+ next unless valid?(file)
12
+ secrets = JSON.parse(file.read, symbolize_names: true)
13
+ break Rails.application.secrets.deep_merge!(secrets)
14
+ end
15
+ end
16
+
17
+ private
18
+
19
+ def valid?(pathname)
20
+ pathname.exist?
21
+ end
22
+
23
+ def json_files
24
+ [
25
+ Rails.root.join("config", "secrets.json"),
26
+ Rails.root.join("config", "secrets.#{Rails.env}.json"),
27
+ ]
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EJSON
4
+ module Rails
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ dependencies:
2
+ bundler:
3
+ without:
4
+ - test
metadata ADDED
@@ -0,0 +1,149 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ejson-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Gannon McGibbon
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-05-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ejson
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: railties
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '4.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '4.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.16'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.16'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.56'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.56'
97
+ description: Rails secret management by encrypting values in a JSON hash with a public/private
98
+ keypair
99
+ email:
100
+ - gannon.mcgibbon@shopify.com
101
+ executables: []
102
+ extensions: []
103
+ extra_rdoc_files: []
104
+ files:
105
+ - ".gitignore"
106
+ - ".rspec"
107
+ - ".rubocop.yml"
108
+ - ".ruby-version"
109
+ - ".travis.yml"
110
+ - Gemfile
111
+ - Gemfile.lock
112
+ - LICENSE.txt
113
+ - README.md
114
+ - Rakefile
115
+ - bin/console
116
+ - bin/setup
117
+ - ejson-rails.gemspec
118
+ - gemfiles/Gemfile.rails-5-0-stable
119
+ - gemfiles/Gemfile.rails-5-1-stable
120
+ - gemfiles/Gemfile.rails-5-2-stable
121
+ - lib/ejson/rails.rb
122
+ - lib/ejson/rails/railtie.rb
123
+ - lib/ejson/rails/version.rb
124
+ - shipit.rubygems.yml
125
+ homepage: https://github.com/Shopify/ejson-rails
126
+ licenses:
127
+ - MIT
128
+ metadata: {}
129
+ post_install_message:
130
+ rdoc_options: []
131
+ require_paths:
132
+ - lib
133
+ required_ruby_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ required_rubygems_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ requirements: []
144
+ rubyforge_project:
145
+ rubygems_version: 2.6.14
146
+ signing_key:
147
+ specification_version: 4
148
+ summary: Asymmetric keywise encryption for JSON on Rails
149
+ test_files: []