web-console-rails3 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.markdown +1 -1
- data/app/controllers/web_console/console_sessions_controller.rb +1 -1
- data/lib/web_console/version.rb +1 -1
- data/test/controllers/web_console/console_sessions_controller_test.rb +1 -1
- data/test/dummy/log/test.log +23 -306
- metadata +3 -49
- data/lib/web_console/engine.rb.orig +0 -83
- data/lib/web_console/version.rb.orig +0 -7
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/log/development.log +0 -15683
- data/test/dummy/tmp/cache/assets/C3D/0C0/sprockets%2Fb01666017530b122ba58894b59b1551b +0 -0
- data/test/dummy/tmp/cache/assets/C5D/870/sprockets%2F9695d21699b362bcc13260e71b679474 +0 -0
- data/test/dummy/tmp/cache/assets/C79/7C0/sprockets%2F831cb415f919c0a15d95e148020953f2 +0 -0
- data/test/dummy/tmp/cache/assets/CB7/870/sprockets%2F5358761e3329e2a4655ee7c0fd2609b5 +0 -0
- data/test/dummy/tmp/cache/assets/CD0/9A0/sprockets%2F61b95b7833a131f56a2096a3d2ba0c94 +0 -0
- data/test/dummy/tmp/cache/assets/CDA/480/sprockets%2F26eb073018913d788d2ee3f5151eea04 +0 -0
- data/test/dummy/tmp/cache/assets/CE1/850/sprockets%2Fb962434bbb22f17db956b8091c975f30 +0 -0
- data/test/dummy/tmp/cache/assets/D0C/EE0/sprockets%2F3fdf5762c392175ad2cba21454e5b972 +0 -0
- data/test/dummy/tmp/cache/assets/D42/180/sprockets%2F4af57a79abba3d4790ba1e7157f41939 +0 -0
- data/test/dummy/tmp/cache/assets/D54/E60/sprockets%2F8abf0788cb7dc878ea82239456149bed +0 -0
- data/test/dummy/tmp/cache/assets/D5F/7E0/sprockets%2F26c1c2c6ba96ba84abf150e402d677c3 +0 -0
- data/test/dummy/tmp/cache/assets/D66/680/sprockets%2Fe0ba18d897f0c45f5e66b003c5ebd061 +0 -0
- data/test/dummy/tmp/cache/assets/D66/AE0/sprockets%2F25c91de251a8ab43652dc2ef55e2a29d +0 -0
- data/test/dummy/tmp/cache/assets/DA7/470/sprockets%2F65bb61bf1edac19c0666e89b667d23ff +0 -0
- data/test/dummy/tmp/cache/assets/DA9/F60/sprockets%2Fa95e444e8dca0e1a586dcef972b623f7 +0 -0
- data/test/dummy/tmp/cache/assets/DAC/A90/sprockets%2F2015f79881b518e9cdcdaf8dfb3e46c5 +0 -0
- data/test/web_console_test.rb.BACKUP.76930.rb +0 -133
- data/test/web_console_test.rb.BASE.76930.rb +0 -134
- data/test/web_console_test.rb.LOCAL.76930.rb +0 -133
- data/test/web_console_test.rb.REMOTE.76930.rb +0 -0
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,133 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class WebConsoleTest < ActiveSupport::TestCase
|
4
|
-
test 'custom default_mount_path' do
|
5
|
-
new_uninitialized_app do |app|
|
6
|
-
app.config.web_console.default_mount_path = '/shell'
|
7
|
-
app.initialize!
|
8
|
-
|
9
|
-
assert app.routes.named_routes['web_console'].path.match('/shell')
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
test 'disabling automounting' do
|
14
|
-
new_uninitialized_app do |app|
|
15
|
-
app.config.web_console.automount = false
|
16
|
-
app.initialize!
|
17
|
-
|
18
|
-
refute app.routes.named_routes['web_console']
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
test 'blank commands are expanded to the rails console' do
|
23
|
-
new_uninitialized_app do |app|
|
24
|
-
app.config.web_console.command = ' '
|
25
|
-
app.initialize!
|
26
|
-
|
27
|
-
assert_equal 'rails_console', app.config.web_console.command
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
test 'present commands are not processed' do
|
32
|
-
new_uninitialized_app do |app|
|
33
|
-
app.config.web_console.command = '/bin/login'
|
34
|
-
app.initialize!
|
35
|
-
|
36
|
-
assert_equal '/bin/login', app.config.web_console.command
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
test 'whitelisted ips are courced to IPAddr' do
|
41
|
-
new_uninitialized_app do |app|
|
42
|
-
app.config.web_console.whitelisted_ips = '127.0.0.1'
|
43
|
-
app.initialize!
|
44
|
-
|
45
|
-
assert_equal [ IPAddr.new('127.0.0.1') ], app.config.web_console.whitelisted_ips
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
test 'whitelisted ips are normalized and unique IPAddr' do
|
50
|
-
new_uninitialized_app do |app|
|
51
|
-
app.config.web_console.whitelisted_ips = [ '127.0.0.1', '127.0.0.1', nil, '', ' ' ]
|
52
|
-
app.initialize!
|
53
|
-
|
54
|
-
assert_equal [ IPAddr.new('127.0.0.1') ], app.config.web_console.whitelisted_ips
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
test 'whitelisted_ips.include? coerces to IPAddr' do
|
59
|
-
new_uninitialized_app do |app|
|
60
|
-
app.config.web_console.whitelisted_ips = '127.0.0.1'
|
61
|
-
app.initialize!
|
62
|
-
|
63
|
-
assert app.config.web_console.whitelisted_ips.include?('127.0.0.1')
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
test 'whitelisted_ips.include? works with IPAddr' do
|
68
|
-
new_uninitialized_app do |app|
|
69
|
-
app.config.web_console.whitelisted_ips = '127.0.0.1'
|
70
|
-
app.initialize!
|
71
|
-
|
72
|
-
assert app.config.web_console.whitelisted_ips.include?(IPAddr.new('127.0.0.1'))
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
test 'whitelist whole networks' do
|
77
|
-
new_uninitialized_app do |app|
|
78
|
-
app.config.web_console.whitelisted_ips = '172.16.0.0/12'
|
79
|
-
app.initialize!
|
80
|
-
|
81
|
-
1.upto(255).each do |n|
|
82
|
-
assert_includes app.config.web_console.whitelisted_ips, "172.16.0.#{n}"
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
test 'whitelist multiple networks' do
|
88
|
-
new_uninitialized_app do |app|
|
89
|
-
app.config.web_console.whitelisted_ips = %w( 172.16.0.0/12 192.168.0.0/16 )
|
90
|
-
app.initialize!
|
91
|
-
|
92
|
-
1.upto(255).each do |n|
|
93
|
-
assert_includes app.config.web_console.whitelisted_ips, "172.16.0.#{n}"
|
94
|
-
assert_includes app.config.web_console.whitelisted_ips, "192.168.0.#{n}"
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
private
|
100
|
-
|
101
|
-
def new_uninitialized_app(root = File.expand_path('../dummy', __FILE__))
|
102
|
-
skip if Rails::VERSION::MAJOR == 3
|
103
|
-
|
104
|
-
old_app = Rails.application
|
105
|
-
|
106
|
-
FileUtils.mkdir_p(root)
|
107
|
-
Dir.chdir(root) do
|
108
|
-
Rails.application = nil
|
109
|
-
|
110
|
-
app = Class.new(Rails::Application)
|
111
|
-
app.config.eager_load = false
|
112
|
-
app.config.time_zone = 'UTC'
|
113
|
-
app.config.middleware ||= Rails::Configuration::MiddlewareStackProxy.new
|
114
|
-
app.config.active_support.deprecation = :notify
|
115
|
-
|
116
|
-
yield app
|
117
|
-
end
|
118
|
-
ensure
|
119
|
-
Rails.application = old_app
|
120
|
-
end
|
121
|
-
|
122
|
-
def teardown_fixtures(*)
|
123
|
-
super
|
124
|
-
rescue
|
125
|
-
# This is nasty hack to prevent a connection to the database in JRuby's
|
126
|
-
# activerecord-jdbcsqlite3-adapter. We don't really require a database
|
127
|
-
# connection, for the tests to run.
|
128
|
-
#
|
129
|
-
# The sad thing is that I couldn't figure out why does it only happens on
|
130
|
-
# activerecord-jdbcsqlite3-adapter and how to actually prevent it, rather
|
131
|
-
# than work-around it.
|
132
|
-
end
|
133
|
-
end
|
@@ -1,134 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class WebConsoleTest < ActiveSupport::TestCase
|
4
|
-
test 'custom default_mount_path' do
|
5
|
-
new_uninitialized_app do |app|
|
6
|
-
app.config.web_console.default_mount_path = '/shell'
|
7
|
-
app.initialize!
|
8
|
-
|
9
|
-
assert app.routes.named_routes['web_console'].path.match('/shell')
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
test 'disabling automounting' do
|
14
|
-
new_uninitialized_app do |app|
|
15
|
-
app.config.web_console.automount = false
|
16
|
-
app.initialize!
|
17
|
-
|
18
|
-
refute app.routes.named_routes['web_console']
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
test 'blank commands are expanded to the rails console' do
|
23
|
-
new_uninitialized_app do |app|
|
24
|
-
app.config.web_console.command = ' '
|
25
|
-
app.initialize!
|
26
|
-
|
27
|
-
expected_path = Rails.root.join('bin/rails console').to_s
|
28
|
-
assert_equal expected_path, app.config.web_console.command
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
test 'present commands are not processed' do
|
33
|
-
new_uninitialized_app do |app|
|
34
|
-
app.config.web_console.command = '/bin/login'
|
35
|
-
app.initialize!
|
36
|
-
|
37
|
-
assert_equal '/bin/login', app.config.web_console.command
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
test 'whitelisted ips are courced to IPAddr' do
|
42
|
-
new_uninitialized_app do |app|
|
43
|
-
app.config.web_console.whitelisted_ips = '127.0.0.1'
|
44
|
-
app.initialize!
|
45
|
-
|
46
|
-
assert_equal [ IPAddr.new('127.0.0.1') ], app.config.web_console.whitelisted_ips
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
test 'whitelisted ips are normalized and unique IPAddr' do
|
51
|
-
new_uninitialized_app do |app|
|
52
|
-
app.config.web_console.whitelisted_ips = [ '127.0.0.1', '127.0.0.1', nil, '', ' ' ]
|
53
|
-
app.initialize!
|
54
|
-
|
55
|
-
assert_equal [ IPAddr.new('127.0.0.1') ], app.config.web_console.whitelisted_ips
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
test 'whitelisted_ips.include? coerces to IPAddr' do
|
60
|
-
new_uninitialized_app do |app|
|
61
|
-
app.config.web_console.whitelisted_ips = '127.0.0.1'
|
62
|
-
app.initialize!
|
63
|
-
|
64
|
-
assert app.config.web_console.whitelisted_ips.include?('127.0.0.1')
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
test 'whitelisted_ips.include? works with IPAddr' do
|
69
|
-
new_uninitialized_app do |app|
|
70
|
-
app.config.web_console.whitelisted_ips = '127.0.0.1'
|
71
|
-
app.initialize!
|
72
|
-
|
73
|
-
assert app.config.web_console.whitelisted_ips.include?(IPAddr.new('127.0.0.1'))
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
test 'whitelist whole networks' do
|
78
|
-
new_uninitialized_app do |app|
|
79
|
-
app.config.web_console.whitelisted_ips = '172.16.0.0/12'
|
80
|
-
app.initialize!
|
81
|
-
|
82
|
-
1.upto(255).each do |n|
|
83
|
-
assert_includes app.config.web_console.whitelisted_ips, "172.16.0.#{n}"
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
test 'whitelist multiple networks' do
|
89
|
-
new_uninitialized_app do |app|
|
90
|
-
app.config.web_console.whitelisted_ips = %w( 172.16.0.0/12 192.168.0.0/16 )
|
91
|
-
app.initialize!
|
92
|
-
|
93
|
-
1.upto(255).each do |n|
|
94
|
-
assert_includes app.config.web_console.whitelisted_ips, "172.16.0.#{n}"
|
95
|
-
assert_includes app.config.web_console.whitelisted_ips, "192.168.0.#{n}"
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
private
|
101
|
-
|
102
|
-
def new_uninitialized_app(root = File.expand_path('../dummy', __FILE__))
|
103
|
-
skip if Rails::VERSION::MAJOR == 3
|
104
|
-
|
105
|
-
old_app = Rails.application
|
106
|
-
|
107
|
-
FileUtils.mkdir_p(root)
|
108
|
-
Dir.chdir(root) do
|
109
|
-
Rails.application = nil
|
110
|
-
|
111
|
-
app = Class.new(Rails::Application)
|
112
|
-
app.config.eager_load = false
|
113
|
-
app.config.time_zone = 'UTC'
|
114
|
-
app.config.middleware ||= Rails::Configuration::MiddlewareStackProxy.new
|
115
|
-
app.config.active_support.deprecation = :notify
|
116
|
-
|
117
|
-
yield app
|
118
|
-
end
|
119
|
-
ensure
|
120
|
-
Rails.application = old_app
|
121
|
-
end
|
122
|
-
|
123
|
-
def teardown_fixtures(*)
|
124
|
-
super
|
125
|
-
rescue
|
126
|
-
# This is nasty hack to prevent a connection to the database in JRuby's
|
127
|
-
# activerecord-jdbcsqlite3-adapter. We don't really require a database
|
128
|
-
# connection, for the tests to run.
|
129
|
-
#
|
130
|
-
# The sad thing is that I couldn't figure out why does it only happens on
|
131
|
-
# activerecord-jdbcsqlite3-adapter and how to actually prevent it, rather
|
132
|
-
# than work-around it.
|
133
|
-
end
|
134
|
-
end
|
@@ -1,133 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class WebConsoleTest < ActiveSupport::TestCase
|
4
|
-
test 'custom default_mount_path' do
|
5
|
-
new_uninitialized_app do |app|
|
6
|
-
app.config.web_console.default_mount_path = '/shell'
|
7
|
-
app.initialize!
|
8
|
-
|
9
|
-
assert app.routes.named_routes['web_console'].path.match('/shell')
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
test 'disabling automounting' do
|
14
|
-
new_uninitialized_app do |app|
|
15
|
-
app.config.web_console.automount = false
|
16
|
-
app.initialize!
|
17
|
-
|
18
|
-
refute app.routes.named_routes['web_console']
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
test 'blank commands are expanded to the rails console' do
|
23
|
-
new_uninitialized_app do |app|
|
24
|
-
app.config.web_console.command = ' '
|
25
|
-
app.initialize!
|
26
|
-
|
27
|
-
assert_equal 'rails_console', app.config.web_console.command
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
test 'present commands are not processed' do
|
32
|
-
new_uninitialized_app do |app|
|
33
|
-
app.config.web_console.command = '/bin/login'
|
34
|
-
app.initialize!
|
35
|
-
|
36
|
-
assert_equal '/bin/login', app.config.web_console.command
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
test 'whitelisted ips are courced to IPAddr' do
|
41
|
-
new_uninitialized_app do |app|
|
42
|
-
app.config.web_console.whitelisted_ips = '127.0.0.1'
|
43
|
-
app.initialize!
|
44
|
-
|
45
|
-
assert_equal [ IPAddr.new('127.0.0.1') ], app.config.web_console.whitelisted_ips
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
test 'whitelisted ips are normalized and unique IPAddr' do
|
50
|
-
new_uninitialized_app do |app|
|
51
|
-
app.config.web_console.whitelisted_ips = [ '127.0.0.1', '127.0.0.1', nil, '', ' ' ]
|
52
|
-
app.initialize!
|
53
|
-
|
54
|
-
assert_equal [ IPAddr.new('127.0.0.1') ], app.config.web_console.whitelisted_ips
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
test 'whitelisted_ips.include? coerces to IPAddr' do
|
59
|
-
new_uninitialized_app do |app|
|
60
|
-
app.config.web_console.whitelisted_ips = '127.0.0.1'
|
61
|
-
app.initialize!
|
62
|
-
|
63
|
-
assert app.config.web_console.whitelisted_ips.include?('127.0.0.1')
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
test 'whitelisted_ips.include? works with IPAddr' do
|
68
|
-
new_uninitialized_app do |app|
|
69
|
-
app.config.web_console.whitelisted_ips = '127.0.0.1'
|
70
|
-
app.initialize!
|
71
|
-
|
72
|
-
assert app.config.web_console.whitelisted_ips.include?(IPAddr.new('127.0.0.1'))
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
test 'whitelist whole networks' do
|
77
|
-
new_uninitialized_app do |app|
|
78
|
-
app.config.web_console.whitelisted_ips = '172.16.0.0/12'
|
79
|
-
app.initialize!
|
80
|
-
|
81
|
-
1.upto(255).each do |n|
|
82
|
-
assert_includes app.config.web_console.whitelisted_ips, "172.16.0.#{n}"
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
test 'whitelist multiple networks' do
|
88
|
-
new_uninitialized_app do |app|
|
89
|
-
app.config.web_console.whitelisted_ips = %w( 172.16.0.0/12 192.168.0.0/16 )
|
90
|
-
app.initialize!
|
91
|
-
|
92
|
-
1.upto(255).each do |n|
|
93
|
-
assert_includes app.config.web_console.whitelisted_ips, "172.16.0.#{n}"
|
94
|
-
assert_includes app.config.web_console.whitelisted_ips, "192.168.0.#{n}"
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
private
|
100
|
-
|
101
|
-
def new_uninitialized_app(root = File.expand_path('../dummy', __FILE__))
|
102
|
-
skip if Rails::VERSION::MAJOR == 3
|
103
|
-
|
104
|
-
old_app = Rails.application
|
105
|
-
|
106
|
-
FileUtils.mkdir_p(root)
|
107
|
-
Dir.chdir(root) do
|
108
|
-
Rails.application = nil
|
109
|
-
|
110
|
-
app = Class.new(Rails::Application)
|
111
|
-
app.config.eager_load = false
|
112
|
-
app.config.time_zone = 'UTC'
|
113
|
-
app.config.middleware ||= Rails::Configuration::MiddlewareStackProxy.new
|
114
|
-
app.config.active_support.deprecation = :notify
|
115
|
-
|
116
|
-
yield app
|
117
|
-
end
|
118
|
-
ensure
|
119
|
-
Rails.application = old_app
|
120
|
-
end
|
121
|
-
|
122
|
-
def teardown_fixtures(*)
|
123
|
-
super
|
124
|
-
rescue
|
125
|
-
# This is nasty hack to prevent a connection to the database in JRuby's
|
126
|
-
# activerecord-jdbcsqlite3-adapter. We don't really require a database
|
127
|
-
# connection, for the tests to run.
|
128
|
-
#
|
129
|
-
# The sad thing is that I couldn't figure out why does it only happens on
|
130
|
-
# activerecord-jdbcsqlite3-adapter and how to actually prevent it, rather
|
131
|
-
# than work-around it.
|
132
|
-
end
|
133
|
-
end
|
File without changes
|