safer_rails_console 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +6 -9
- data/Appraisals +4 -4
- data/CHANGELOG.md +7 -0
- data/gemfiles/{4.1.gemfile → 5.2.gemfile} +1 -1
- data/lib/safer_rails_console/patches/boot/sandbox_flag.rb +3 -3
- data/lib/safer_rails_console/patches/railtie/sandbox.rb +1 -1
- data/lib/safer_rails_console/patches/sandbox/auto_rollback.rb +1 -17
- data/lib/safer_rails_console/rails_version.rb +6 -6
- data/lib/safer_rails_console/version.rb +1 -1
- data/safer_rails_console.gemspec +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e9f52ef5501b4906fd7f43c3a5dc3a8157dacba7da2d5cd996d1028f8d97f5fe
|
4
|
+
data.tar.gz: 5d0e92eef385a29a45fb2f24eeb994bc9b5539d7ba2c01ab067bc2a35777f08f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7ce0f981844828f22da23738147ca9bd35355feb5ab20971381ae0407bde0b7da3c57c2630f88aa8a382afc6a70f90fcfb818e604671a124255e921c45478ec
|
7
|
+
data.tar.gz: 6ad946fb0b38d899890ef70aa5d83f15078f07782eeb56221549d5f40962f88b4db8f5e2e0dee2782c40a29922a1d273de8c722a8f75ba81282608ad275a02d9
|
data/.travis.yml
CHANGED
@@ -9,29 +9,26 @@ before_install:
|
|
9
9
|
- gem install bundler
|
10
10
|
|
11
11
|
before_script:
|
12
|
-
- cp spec/internal/database.yml.travis spec/internal/rails_4_1/config/database.yml
|
13
12
|
- cp spec/internal/database.yml.travis spec/internal/rails_4_2/config/database.yml
|
14
13
|
- cp spec/internal/database.yml.travis spec/internal/rails_5_0/config/database.yml
|
15
14
|
- cp spec/internal/database.yml.travis spec/internal/rails_5_1/config/database.yml
|
15
|
+
- cp spec/internal/database.yml.travis spec/internal/rails_5_2/config/database.yml
|
16
16
|
|
17
17
|
script:
|
18
18
|
- bundle exec rubocop
|
19
19
|
- bundle exec rspec
|
20
20
|
|
21
21
|
rvm:
|
22
|
-
- 2.2.
|
23
|
-
- 2.3.
|
24
|
-
- 2.4.
|
22
|
+
- 2.2.10
|
23
|
+
- 2.3.7
|
24
|
+
- 2.4.4
|
25
|
+
- 2.5.1
|
25
26
|
|
26
27
|
gemfile:
|
27
|
-
- gemfiles/4.1.gemfile
|
28
28
|
- gemfiles/4.2.gemfile
|
29
29
|
- gemfiles/5.0.gemfile
|
30
30
|
- gemfiles/5.1.gemfile
|
31
|
+
- gemfiles/5.2.gemfile
|
31
32
|
|
32
33
|
matrix:
|
33
|
-
allow_failures:
|
34
|
-
- gemfile: gemfiles/4.1.gemfile
|
35
|
-
rvm: 2.4.1
|
36
|
-
|
37
34
|
fast_finish: true
|
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [v0.3.0](https://github.com/salsify/safer_rails_console/tree/v0.3.0) (2018-04-16)
|
4
|
+
[Full Changelog](https://github.com/salsify/safer_rails_console/compare/v0.2.0...v0.3.0)
|
5
|
+
|
6
|
+
**Merged pull requests:**
|
7
|
+
|
8
|
+
- Add support for Rails 5.2; remove support for Rails 4.1 [\#24](https://github.com/salsify/safer_rails_console/pull/24) ([timothysu](https://github.com/timothysu))
|
9
|
+
|
3
10
|
## [v0.2.0](https://github.com/salsify/safer_rails_console/tree/v0.2.0) (2017-09-07)
|
4
11
|
[Full Changelog](https://github.com/salsify/safer_rails_console/compare/v0.1.4...v0.2.0)
|
5
12
|
|
@@ -72,16 +72,16 @@ module SaferRailsConsole
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
if SaferRailsConsole::RailsVersion.
|
75
|
+
if SaferRailsConsole::RailsVersion.four_two?
|
76
76
|
require 'rails/commands/commands_tasks'
|
77
77
|
::Rails::CommandsTasks.prepend(SaferRailsConsole::Patches::Boot::SandboxFlag::Rails::CommandsTasks4)
|
78
78
|
elsif SaferRailsConsole::RailsVersion.five_zero?
|
79
79
|
require 'rails/commands/commands_tasks'
|
80
80
|
::Rails::CommandsTasks.prepend(SaferRailsConsole::Patches::Boot::SandboxFlag::Rails::CommandsTasks50)
|
81
|
-
elsif SaferRailsConsole::RailsVersion.five_one?
|
81
|
+
elsif SaferRailsConsole::RailsVersion.five_one? || SaferRailsConsole::RailsVersion.five_two?
|
82
82
|
require 'rails/command'
|
83
83
|
require 'rails/commands/console/console_command'
|
84
|
-
# Rails 5.1 defaults `sandbox` to `false`, but we need it to NOT have a default value and be `nil` when it is not user-specified
|
84
|
+
# Rails 5.1 and 5.2 defaults `sandbox` to `false`, but we need it to NOT have a default value and be `nil` when it is not user-specified
|
85
85
|
::Rails::Command::ConsoleCommand.class_eval do
|
86
86
|
remove_class_option :sandbox
|
87
87
|
class_option :sandbox, aliases: '-s', type: :boolean, desc: 'Explicitly enable/disable sandbox mode.'
|
@@ -25,7 +25,7 @@ module SaferRailsConsole
|
|
25
25
|
end
|
26
26
|
|
27
27
|
if SaferRailsConsole::RailsVersion.supported?
|
28
|
-
if SaferRailsConsole::RailsVersion.five_one?
|
28
|
+
if SaferRailsConsole::RailsVersion.five_one? || SaferRailsConsole::RailsVersion.five_two?
|
29
29
|
require 'rails/commands/console/console_command'
|
30
30
|
else
|
31
31
|
require 'rails/commands/console'
|
@@ -22,20 +22,6 @@ module SaferRailsConsole
|
|
22
22
|
|
23
23
|
module ActiveRecord
|
24
24
|
module ConnectionAdapters
|
25
|
-
module PostgreSQLAdapter41
|
26
|
-
def exec_no_cache(sql, name, binds)
|
27
|
-
super
|
28
|
-
rescue => e
|
29
|
-
SaferRailsConsole::Patches::Sandbox::AutoRollback.handle_and_reraise_exception(e)
|
30
|
-
end
|
31
|
-
|
32
|
-
def exec_cache(sql, name, binds)
|
33
|
-
super
|
34
|
-
rescue => e
|
35
|
-
SaferRailsConsole::Patches::Sandbox::AutoRollback.handle_and_reraise_exception(e)
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
25
|
module PostgreSQLAdapter42
|
40
26
|
def execute_and_clear(sql, name, binds)
|
41
27
|
super
|
@@ -59,9 +45,7 @@ module SaferRailsConsole
|
|
59
45
|
end
|
60
46
|
|
61
47
|
if defined?(::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
|
62
|
-
if SaferRailsConsole::RailsVersion.
|
63
|
-
::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(SaferRailsConsole::Patches::Sandbox::AutoRollback::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter41)
|
64
|
-
elsif SaferRailsConsole::RailsVersion.four_two?
|
48
|
+
if SaferRailsConsole::RailsVersion.four_two?
|
65
49
|
::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(SaferRailsConsole::Patches::Sandbox::AutoRollback::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter42)
|
66
50
|
else
|
67
51
|
::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend(SaferRailsConsole::Patches::Sandbox::AutoRollback::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter5)
|
@@ -6,12 +6,7 @@ module SaferRailsConsole
|
|
6
6
|
|
7
7
|
class << self
|
8
8
|
def supported?
|
9
|
-
|
10
|
-
end
|
11
|
-
|
12
|
-
def four_one?
|
13
|
-
@is_four_one = Gem::Requirement.new('~> 4.1.0').satisfied_by?(SaferRailsConsole::RailsVersion::RAILS_VERSION) if @is_four_one.nil?
|
14
|
-
@is_four_one
|
9
|
+
four_two? || five_zero? || five_one? || five_two?
|
15
10
|
end
|
16
11
|
|
17
12
|
def four_two?
|
@@ -28,6 +23,11 @@ module SaferRailsConsole
|
|
28
23
|
@is_five_one = Gem::Requirement.new('~> 5.1.0').satisfied_by?(SaferRailsConsole::RailsVersion::RAILS_VERSION) if @is_five_one.nil?
|
29
24
|
@is_five_one
|
30
25
|
end
|
26
|
+
|
27
|
+
def five_two?
|
28
|
+
@is_five_two = Gem::Requirement.new('~> 5.2.0').satisfied_by?(SaferRailsConsole::RailsVersion::RAILS_VERSION) if @is_five_two.nil?
|
29
|
+
@is_five_two
|
30
|
+
end
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
data/safer_rails_console.gemspec
CHANGED
@@ -40,5 +40,5 @@ Gem::Specification.new do |spec|
|
|
40
40
|
spec.add_development_dependency 'salsify_rubocop', '~> 0.48.0'
|
41
41
|
spec.add_development_dependency 'sqlite3', '~> 1.3'
|
42
42
|
spec.add_development_dependency 'wwtd', '~> 1.3'
|
43
|
-
spec.add_runtime_dependency 'rails', '>= 4.
|
43
|
+
spec.add_runtime_dependency 'rails', '>= 4.2', '< 5.3'
|
44
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: safer_rails_console
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Salsify, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appraisal
|
@@ -156,20 +156,20 @@ dependencies:
|
|
156
156
|
requirements:
|
157
157
|
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: '4.
|
159
|
+
version: '4.2'
|
160
160
|
- - "<"
|
161
161
|
- !ruby/object:Gem::Version
|
162
|
-
version: '5.
|
162
|
+
version: '5.3'
|
163
163
|
type: :runtime
|
164
164
|
prerelease: false
|
165
165
|
version_requirements: !ruby/object:Gem::Requirement
|
166
166
|
requirements:
|
167
167
|
- - ">="
|
168
168
|
- !ruby/object:Gem::Version
|
169
|
-
version: '4.
|
169
|
+
version: '4.2'
|
170
170
|
- - "<"
|
171
171
|
- !ruby/object:Gem::Version
|
172
|
-
version: '5.
|
172
|
+
version: '5.3'
|
173
173
|
description: This gem makes Rails console sessions less dangerous in specified environments
|
174
174
|
by warning, color-coding, auto-sandboxing, and allowing read-only external connections
|
175
175
|
(disables job queueing, non-GET requests, etc.)
|
@@ -192,10 +192,10 @@ files:
|
|
192
192
|
- Rakefile
|
193
193
|
- bin/console
|
194
194
|
- bin/setup
|
195
|
-
- gemfiles/4.1.gemfile
|
196
195
|
- gemfiles/4.2.gemfile
|
197
196
|
- gemfiles/5.0.gemfile
|
198
197
|
- gemfiles/5.1.gemfile
|
198
|
+
- gemfiles/5.2.gemfile
|
199
199
|
- lib/safer_rails_console.rb
|
200
200
|
- lib/safer_rails_console/colors.rb
|
201
201
|
- lib/safer_rails_console/console.rb
|
@@ -232,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
232
232
|
version: '0'
|
233
233
|
requirements: []
|
234
234
|
rubyforge_project:
|
235
|
-
rubygems_version: 2.6
|
235
|
+
rubygems_version: 2.7.6
|
236
236
|
signing_key:
|
237
237
|
specification_version: 4
|
238
238
|
summary: Make rails console less dangerous!
|